akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}
 
 
 
 
 
 
 







int dp[2005][2005];
int f[2005];
int main()
{
     string s;
     cin>>s;
     string t;
     for(int i=0;i<s.length();i++){
          if(i+1<s.length()&&s[i]=='B'&&s[i+1]=='C'){t.push_back('D');i++;}
          else{
               t.push_back(s[i]);
          }
     }
     ll res=0;
     ll ct=0;
     for(int i=0;i<t.length();i++){
          if(t[i]=='A')ct++;
          else if(t[i]=='D'){
               res+=ct;
          }
          else if(t[i]=='B'||t[i]=='C')ct=0;
     }
     cout<<res;
}


























Measured memory_bytes: 3904
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
using namespace std;
int		cnt;

int		main(void)
{
	int		N;
	cin >> N;
	set<string> gatha;
	string tmp;
	for (int i = 0; i < N; i++)
		cin >> tmp, gatha.insert(tmp);
	cout << gatha.size() << endl;
}


Measured memory_bytes: 15512
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

int main(){
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	for(int i=0; i<h; i++)
		cin >> s[i];
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			if(s[i][j] == '#'){
				bool judge = true;
				if(i!=0 && s[i-1][j]=='#')
					judge = false;
				if(j!=0 && s[i][j-1]=='#')
					judge = false;
				if(j!=w-1 && s[i][j+1]=='#')
					judge = false;
				if(i!=h-1 && s[i+1][j]=='#')
					judge = false;
				if(judge){
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
(function main() {
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n1 = Number(lines.shift());
  const arr1 = lines.shift().split(' ').map(Number);
  const n2 = Number(lines.shift());
  const arr2 = lines.shift().split(' ').map(Number);

  const solve = (i, m) => {
    if (m == 0) return true;
    if (i >= n1) return false;
    return solve(i + 1, m) || solve(i + 1, m - arr1[i]);
  };

  arr2.map(m => solve(0, m) ? 'yes' : 'no').forEach(res => console.log(res));
})();



Measured memory_bytes: 17156
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  cin>>s;
  
  int n=s.size();
  
  int a=0,b=0;
  rep(i,n){
    if(i%2==1){
      if(s[i]=='0') b++;
      else a++;
    }
    else{
      if(s[i]=='1') b++;
      else a++;
    }
  }
    
  cout<<min(a,b)<<endl;    
  
  return 0;
}

Measured memory_bytes: 3728
#include<iostream>
using namespace std;
int main()
{
  int tate, yoko;
  int n,m;

  while(1){ 
   cin >> tate >> yoko;
    if(tate == 0 && yoko == 0){
      break;
    }

    else{
      for(n = 1;n <= tate;n++){

	if(n == 1 || n == tate){
	  
             for(m = 1;m <= yoko;m++){
	       cout << "#";
	     }
	}
	else{
	  for(m = 1;m <= yoko;m++){
	    if(m == 1 || m == yoko){
	      cout << "#";
	    }

	    else{
	      cout << "."; 
	    }
	  }
	}
	cout << "\n";
      }
    }
    cout << "\n";
  }
}

	 

Measured memory_bytes: 1120
#include <iostream>
#include <stdio.h>

int main() {
	int a;
	scanf("%d",&a);
	int a1 = a / 100;
	int a2 = a % 100;
	if (a1>=1 && a1<=12 && !(a2 >=1 && a2<=12 )) {
		std::cout << "MMYY";
	}
	else if (a2 >= 1 && a2 <= 12 && !(a1 >= 1 && a1 <= 12)){
		std::cout << "YYMM";
	}
	else if (a1 >= 1 && a1 <= 12 && a2 >= 1 && a2 <= 12) {
		std::cout << "AMBIGUOUS";
	}
	else {
		std::cout << "NA";
	}
	return 0;
}

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

using namespace std;
const int maxn = 1e5 + 10;

#define ll long long
#define LL long long
const ll MOD = 1e9 + 7;
ll v[maxn], a[maxn];
LL da[maxn];//G++ long long
ll inv[maxn],fac[maxn],finv[maxn];
void make()
{
	fac[0]=fac[1]=1;
	finv[0]=finv[1]=1;
	inv[1]=1;
	for(int i=2;i<maxn;i++)
	{
		inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
		fac[i]=fac[i-1]*(ll) i%MOD;
		finv[i]=finv[i-1]*inv[i]%MOD;
	}
}
ll C(int a,int b)
{
	if(a<b) return 0;
	return fac[a]*(finv[b]*finv[a-b]%MOD)%MOD;
}
int main() {
    ios_base::sync_with_stdio(0);
    ll n;
    make();
    ll id1 = 0, id2 = 0;
    cin >> n;
    memset(a, 0, sizeof(a));
    memset(v, 0, sizeof(v));
    for(ll i = 1; i <= n + 1; ++i){
        cin >> a[i];
        v[a[i]]++;
    }
    for(ll i = 1; i <= n + 1; ++i){
        if(v[a[i]] == 2 && !id1){
            id1 = i;
        }
        else if(v[a[i]] == 2) {
            id2 = i;
        }
    }
    ll L = max(id1 - 1LL, 0LL), M = id2 - id1 - 1LL, R = max(n + 1LL - id2, 0LL);
    ll res = 0;
    for(ll i = 1; i <= n + 1; ++i){
        res = C(n + 1, i * 1LL);
        res -= C(L + R, (i - 1) * 1LL);
        if(res < 0)res += MOD;
        cout << res << '\n';
    }
    return 0;
}


Measured memory_bytes: 5888
#include<bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
/////////////////// TYPES & MACROS ///////////////////////////////
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
using ll=long long int; using dd=double;
using pii=pair<int,int>; using pll=pair<ll,ll>;
typedef vector<int> vi;
ll INFLL=(ll)2e18, MOD=1'000'000'007;
const int INF=0x3f3fffff ;
/////////////////// DEBUG /////////////////////////////////////////
#define D(x) cerr<<#x<<" is: "<<x<<'\n';
#define DD(x,y) cerr<<"("<<#x<<","<<#y<<") are: "<<x<<" "<<y<<'\n';
/////////////////// VARIABLES & FUNCTIONS//////////////////////////
vv<vi> adj; vv<vv<int>> vis;
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
inline ll mexp(ll x,ll n,ll m){ll res=1;while(n){if(n&1)res=(res*x)%m;n>>=1;x=((x%m)*(x%m))%m;}return res;}
inline bool ispow2(ll x){ return x && (!(x&(x-1)));}
inline ll gcd(ll x, ll y){ pll p{x,y}; while(p.ss) p={p.ss,p.ff%p.ss}; return p.ff;}


/////////////////// MAIN STARTS //////////////////////////////////
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
cout<<fixed;cerr<<fixed; cout<<setprecision(10); cerr<<setprecision(3);
// random_device rd; mt19937 genr(rd());

#ifdef DEBUG
  auto tStart = chrono::system_clock::now(); //freopen("op.txt","w",stdout);
#endif

int n,i; cin>>n>>i;
cout<<n-i+1<<endl;


#ifdef DEBUG
  auto diff=chrono::system_clock::now()-tStart;
  cerr<<"\nExecution time: "<<chrono::duration<dd,milli>(diff).count()<<" ms.\n";
#endif
return 0;
}


Measured memory_bytes: 256
n = int(input())
arr = [int(input()) for _ in range(n)]
sorted_arr = sorted(arr, reverse=True)
result = []

for a in arr:
  multi_same_num_flag = False
  for m in sorted_arr:
    if m > a:
      result.append(str(m))
      break
    elif m == a:
      if not multi_same_num_flag:
        multi_same_num_flag = True
        continue
      else:
        result.append(str(m))
        break
    elif m < a:
      result.append(str(m))
      break


print('{}'.format('\n'.join(result)))

Measured memory_bytes: 30496
import math

n = int(raw_input())
for i in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4 = map(float, raw_input().split())
    if (abs((y1-y2)*(x3-x4)-(y3-y4)*(x1-x2))<1e-10): print "YES"
    else: print "NO"

Measured memory_bytes: 4372
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numOfAttend = sc.nextInt();
        int outerRate = sc.nextInt();
        int N = 10;

        int innerRate = numOfAttend <= N ? outerRate + (N - numOfAttend) * 100 : outerRate;
        System.out.println(innerRate);
        sc.close();

    }
}

Measured memory_bytes: 23124
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N);
  FOR(i, N) cin >> A[i];
  vector<ll> acc(N + 1);
  map<ll, ll> list;
  list[0] = 1;
  FOR(i, N) {
    acc[i + 1] = (i > 0 ? acc[i] : 0) + A[i];
    list[acc[i + 1] % M]++;
  }
  ll ans = 0;
  for (pair<ll, ll> p : list) {
    ans += p.second * (p.second - 1) / 2;
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 5760
#include <iostream>
#include <algorithm>

using namespace std;

int t,n,k,s=0;
int main()
{
    cin >> t;
    for(int i=0;i<t;i++)
    {
        cin >> n >> k;
        int A[n],B[n-1];
        for(int j=0;j<n;j++)
        {
            cin >> A[j];
        }
        if(k>=n)
        {
            cout << 0 << endl;
            continue;
        }
        sort(&A[0],&A[n]);
        for(int j=0;j<n;j++)
        {
            B[j]=A[j+1]-A[j];
        }
        sort(&B[0],&B[n-1]);
        for(int j=0;j<n-k;j++)
        {
            s=s+B[j];
        }
        cout << s << endl;
        s=0;
    }
    return 0;
}


Measured memory_bytes: 3920
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define Cout(s) cout<<s<<endl

bool sosuu(const int x)
{
	if (x == 2)return true;
	if (x < 2 || x % 2 == 0)return false;
	for (int i = 3; i * i <= x; i += 2)
		if (x % i == 0)return false;
	return true;
}
int gcd(int a, int b)
{
	if (a % b == 0) { return b; }
	else { return gcd(b, a % b); }
}
int ketawa(int a)
{
	if (a < 10)return a;
	else return a % 10 + ketawa(a / 10);
}

bool kaibun(std::string s)
{
	
	for(int i=0;i< sz(s);i++)
	{
		if (s[i] != s[sz(s) - i - 1])
			return false;
	}
	return true;
}

typedef long long ll;
using namespace std;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================

int a = 0, b = 0, c, d, n, k = 0, ans = 0;
string s, t;


int main()
{
	cin >> s;
	n = sz(s); 
	
	Cout(Yes(kaibun(s.substr(0,(n-1)/2)) && kaibun(s.substr((n+3)/2-1))&&kaibun(s)));

	return 0;
}


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

#define FO(i,a,b) for (int i = (a); i < (b); i++)
#define sz(v) int(v.size())

using namespace std;

int h, w;
char g[10][10];

bool go(int y, int x) {
    if (g[y][x] == '.') return false;
    if (y == h-1 && x == w-1) return true;

    if (g[y+1][x] == '#') return go(y+1,x);
    if (g[y][x+1] == '#') return go(y,x+1);
    return false;
}

int main() {
    scanf("%d%d", &h, &w);
    int nm = 0;
    FO(y,0,h) {
        scanf("%s", g[y]);
        FO(x,0,w) nm += g[y][x] == '#';
    }
    if (nm != h+w-1 || !go(0,0)) {
        printf("Impossible\n");
        return 0;
    } else {
        printf("Possible\n");
        return 0;
    }
}



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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;
typedef vector<vector<int> > ivve;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pp         pop_back`
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define lb         lower_bound
#define up         upper_bound
#define setp       setprecision
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define spc(x)     cout<<fixed<<setp(x)

const   long long  inf = 1e18;
const   long long  cs =  200005;
const   long long  mod = 1000000007;
const   double     PI =  2 * acos(0.0);
void solve()
{
    ll t,n,m,a,b,c,i,j,k,x,y,cnt=0,cnt1=0;
    bool flag = false;
    
    string s;
    cin>>s;
    n=s.size();
    for(i=0;i<n;i+=2)
    {
        if(s[i]=='L') 
        {
            flag=true;
            break;
        }
    }
    for(i=1;i<n;i+=2)
    {
        if(s[i]=='R') 
        {
            flag=true;
            break;
        }
    }
    if(flag) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

    // freopen ("input.txt","r",stdin);
    // freopen ("output.txt","w",stdout);

    // int32_t tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}

Measured memory_bytes: 3652
import java.util.*;
import java.util.Comparator;
 
public class Main { 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);       
        int n=sc.nextInt();
        int k=sc.nextInt();
        double[] p=new double[n];
        //int id=0;
        double o=0;
      double a=0;
        for(int i=0;i<n;i++){
        	p[i]=sc.nextDouble();
            if(i==k-1){                
                for(int j=0;j<k;j++){
            		a+=(p[i-j]+1)/2;
                } 
                if(a>o)o=a;
            }else if(i>k-1){
              a-=(p[i-k]+1)/2;
              a+=(p[i]+1)/2;
               if(a>o)o=a;
            }
        }
        
      System.out.println(o);
    }
}


Measured memory_bytes: 161508
/*
17/10/2017
*/
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int d,t,v;
cin>>d>>t>>v;
int k=d/t;
if(d%t!=0)
{
k++;
}
if(v>=k)
{
cout<<"Yes";
}
else
{
cout<<"No";
}
}


Measured memory_bytes: 3620
// う　し　た　ぷ　に　き　あ　く　ん　笑
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long
constexpr int INF = 1000000000 + 8;

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

    int n, m, k;
    cin >> n >> m >> k;

    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<int> b(m);
    for (int i = 0; i < m; i++) cin >> b[i];

    vector<int> csa(n + 1);
    csa[0] = 0;
    for (int i = 0; i < n; i++) csa[i + 1] = csa[i] + a[i];
    vector<int> csb(m + 1);
    csb[0] = 0;
    for (int i = 0; i < m; i++) csb[i + 1] = csb[i] + b[i];

    int ans = 0;

    // aを読む本数を全探索

    auto maxcsaunderk = prev(upper_bound(csa.begin(), csa.end(), k));
    // k以内に読めるaの本数
    const int maxaread = distance(csa.begin(), maxcsaunderk);

    for (int i = 0; i <= maxaread; i++) {
        int k_a = csa[i];

        int k_b = k - k_a;
        auto maxcsbunderk = prev(upper_bound(csb.begin(), csb.end(), k_b));
        const int maxbread = distance(csb.begin(), maxcsbunderk);

        ans = max(i + maxbread, ans);
    }

    cout << ans << endl;
}


Measured memory_bytes: 9500
#include <iostream>
#include <sstream>
using namespace std;
struct P{double x,y;};

void output(double x,double y){
	printf("%.6lf %.6lf\n",x,y);
}
int main(){
	P a,b,r; string s;
	while(getline(cin,s)){
		while(~s.find(","))s[s.find(",")] = ' ';
		stringstream ss(s);
		ss >> a.x >> a.y >> b.x >> b.y >> r.x >> r.y;
		
		double x , y , X = a.x-b.x , Y = a.y-b.y;
		if(X == 0){
			output(2*a.x-r.x,r.y);
		}else if(Y == 0){
			output(r.x,2*a.y-r.y );
		}else{
			x = ( r.y -a.y + (Y/X)*a.x + (X/Y)*r.x ) / ( (X*X+Y*Y)/(X*Y) );
			y = (Y/X)*(x-a.x) + a.y;
			output(2*x-r.x,2*y-r.y);
		}
	}
}

Measured memory_bytes: 3252
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);

        int debt = 100000;
        int nWeeks = sc.nextInt();
        for (int i = 0; i < nWeeks; i++) {
            debt = (int)(Math.ceil(debt*1.05 / 1000) * 1000);
        }

        System.out.println(debt);
    }
}

Measured memory_bytes: 25936
#include <iostream>

using namespace std;

int main()
{
    int a,b;
    
    cin >> a >> b;
    
    if (a>b){
        cout << "a > b" <<endl;
    }
    else if(a<b){
        cout << "a < b" <<endl;
    }
    else if(a==b){
        cout <<"a == b" <<endl;
    }

    return 0;
}



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

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

void solve() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    const ll INF = 1LL << 61;
    vector<vector<ll>> dp(N + 1, vector<ll>(2, -INF));

    dp[0][0] = 0;
    for (int i = 0; i < N; i++) {
        if (i != 0) {
            chmax(dp[i + 1][1], dp[i][0] - A[i] - 2 * A[i - 1]);
            chmax(dp[i + 1][1], dp[i][1] - A[i] + 2 * A[i - 1]);  
        }
        chmax(dp[i + 1][0], dp[i][0] + A[i]);
        chmax(dp[i + 1][0], dp[i][1] + A[i]);
    }

    cout << max(dp[N][0], dp[N][1]) << endl;
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B;
    cin >> A >> B;
    REP(i, std::max(A, B) * 100) {
        ll n = i + 1;

        ll a = n * 0.08;
        ll b = n * 0.1;
        if (a == A && b == B) {
            cout << n << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  for (int i = 0; i < H; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < W + 2; i++) {
    cout << '#';
  }
  cout << endl;
  for (int i = 0; i < H; i++) {
    cout << '#' << a.at(i) << '#' << endl;
  }
  for (int i = 0; i < W + 2; i++) {
    cout << '#';
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;
const int mod998 = 998244353;

int N, X, S[200];
ll DP[100001][201], res, ModInv[201];

ll pw(ll x, int y) {
	ll a = 1;
	while (y) {
		if (y & 1) {
			a = a * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return a;
}

ll modinv(ll x) {
	return pw(x, mod - 2);
}

int main() {
	cin >> N >> X;
	for (int i = 0; i < N; ++i) {
		cin >> S[i];
	}
	for (int i = 0; i <= N; ++i) {
		ModInv[i] = modinv(i);
	}
	sort(S, S + N, greater<>());
	DP[X][0] = 1;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j <= X; ++j) {
			DP[j][i] *= ModInv[N - i];
			DP[j][i] %= mod;
			DP[j%S[i]][i + 1] += DP[j][i];
			DP[j%S[i]][i + 1] %= mod;
			DP[j][i + 1] += DP[j][i] * (N - i - 1);
			DP[j][i + 1] %= mod;
		}
	}
	for (int i = 0; i <= X; ++i) {
		res += i * DP[i][N];
		res %= mod;
	}
	for (int i = 1; i <= N; ++i) {
		res *= i;
		res %= mod;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 157312
#include<stdio.h>
#include<string.h>
int main(void){
    int a,b,x,y;
    scanf("%d%d",&a,&b);
    x=a>=b?b:a;
    y=a>=b?a:b;
    for(int i=0;y>i;++i)
    printf("%d",x);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,x,y) for(ll i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif
 
typedef long long int ll;
typedef pair<ll,ll> pii;
template<typename T> using vec=std::vector<T>;
 
const ll inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-9;
const ll dx[]={1,0,-1,0},dy[]={0,1,0,-1};
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}
 
template<class T> class segtree{
public:
    int n;
    vector<T> dat;
    segtree(int size,T x){
        n=1;
        while(n<size) n*=2;
        dat.assign(2*n-1,x);
    }
    // update k th element
    void update(int k, T a) {
        k+=n-1; // leaf
        dat[k]=a;
        while(k>0) {
            k=(k-1)/2;
            dat[k]=min(dat[k*2+1],dat[k*2+2]);
        }
    }
    // min [a, b)
    T query(int a,int b) { return query(a,b,0,0,n); }
    T query(int a,int b,int k,int l,int r) {
        if(r<=a or b<=l) return infll;
        if(a<=l and r<=b) return dat[k];
        int m=(l+r)/2;
        return min(query(a,b,k*2+1,l,m),query(a,b,k*2+2,m,r));
    }
};
 
void solve(){
    int n,q;
    cin >> n >> q;
    segtree<ll> seg(n,(1LL<<31)-1);
    rep(i,0,q){
        int com,x,y;
        cin >> com >> x >> y;
        if(com==0) seg.update(x,y);
        else cout << seg.query(x,y+1) << endl;
    }
}
 
int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}

Measured memory_bytes: 4928
#include <stdio.h>

char S[100050];

int main()
{
	scanf("%s", S);
	int l = 0;
	while (S[l]) l++;

	while (l > 0)
	{
		if (S[l - 1] == 'r' && S[l - 2] == 'e' && S[l - 3] == 's' && S[l - 4] == 'a' && S[l - 5] == 'r' && S[l - 6] == 'e') l -= 6;
		else if (S[l - 1] == 'e' && S[l - 2] == 's' && S[l - 3] == 'a' && S[l - 4] == 'r' && S[l - 5] == 'e') l -= 5;
		else if (S[l - 1] == 'r' && S[l - 2] == 'e' && S[l - 3] == 'm' && S[l - 4] == 'a' && S[l - 5] == 'e' && S[l - 6] == 'r' && S[l - 7] == 'd') l -= 7;
		else if (S[l - 1] == 'm' && S[l - 2] == 'a' && S[l - 3] == 'e' && S[l - 4] == 'r' && S[l - 5] == 'd') l -= 5;
		else break;
	}

	puts(l == 0 ? "YES" : "NO");
	return 0;
}

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

bool check(int a[],int n){
    if(n%2==0){
        int j=1,i=0;
        while(i<n){
            if(i+1==n)return 0;
            if(a[i]!=a[i+1])return 0;
            else{
                if(a[i]!=j)return 0;
            }
            i+=2;j+=2;
            if(i>=n)break;
        }
    }
    else{
        if(a[0]!=0)return 0;
        int j=2,i=1;
        while(i<n){
            if(i+1==n)return 0;
            if(a[i]!=a[i+1])return 0;
            else{
                if(a[i]!=j)return 0;
            }
            i+=2;j+=2;
            if(i>=n)break;
        }
    }
    return 1;
}

int answer(int n){
    int ans=1;
    while(n--){
        ans=((ans%mod)*(2%mod))%mod;
    }
    return ans%mod;
}

int main() {
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    if(check(a,n)){
        cout<<answer(n/2);
    }
    else cout<<0;
}

Measured memory_bytes: 3920
n = int(input())
v = list(input().split())
def f(b):
  h = v[b::2]
  d = {0:0}
  for i in h: d[i] = d.get(i,0)+1
  return sorted(d.items(),key=lambda k:-k[1])
l,r = f(0),f(1)
print(n-l[0][1]-[r[0][1],max(l[1][1],r[1][1])][l[0][0] == r[0][0]])

Measured memory_bytes: 22700
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <chrono>

    #pragma GCC optimize("O3")
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("unroll-loops")
    /*#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    #pragma GCC target ("avx2")*/

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

ll MAX = 1e15;
double PI = 3.141592653589793238463;
//double PI = acos(-1);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


void solve(){
    ll n;
    cin >> n;
    vector<ll> nums(n);
    for(ll i=0; i<n; i++){
        cin >> nums[i];
    }
    sort(nums.begin(), nums.end());
    if(nums[0]==0){
        cout << 0;
        return;
    }
    ll ans=1;
    for(ll i=0; i<n; i++){
        if(ans>1e18/nums[i]){
            cout << -1;
            return;
        }
        ans*=nums[i];
    }
    ll x = 1e18;
    if(ans>x){
        cout << -1;
        return;
    }
    cout << ans;

}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif


    ll t=1;
    //cin >> t;
    while(t--){
        solve();
    }


    return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n, l; cin >> n >> l;
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        sum += l + i - 1;
    }
    int res = 1234567;
    for (int i = 1; i <= n; i++) {
        int cur = 0;
        for (int j = 1; j <= n; j++) {
            if (j == i) {
                continue;
            }
            cur += l + j - 1;
        }
        if (abs(sum - cur) < abs(sum - res)) {
            res = cur;
        }
    }
    cout << res << "\n";
}


Measured memory_bytes: 256
#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() {
        ll X;
        cin >>X;
        ll i=0;
        ll XX=100;
        double x;
        while (XX<X) {
                x=XX;
                x *=1.01;
                XX=x;
                i++;
        }
        cout <<i <<endl;
        return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <vector>
#include <map>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){

  int n, m, ans = 0;
  map<string, int> mp;
  
  cin >> n;
  
  rep(i, n){
    string s;
    cin >> s;
    mp[s]++;
  }
  
  cin >> m;
  
  rep(i, m){
    string s;
    cin >> s;
    mp[s]--;
  }
  
  for(auto itr = mp.begin(); itr != mp.end(); itr++){
    if(ans < itr->second){
      ans = itr->second;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

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

int n, dp[100005][3], a[100005][3];

int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
   	dp[i][0] = a[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
    dp[i][1] = a[i][1] + max(dp[i - 1][0], dp[i - 1][2]);
    dp[i][2] = a[i][2] + max(dp[i - 1][0], dp[i - 1][1]);
  }
  cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
}

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


#define li			long long int
#define rep(i,to)	for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)	for(li i=(li)(start);i<((li)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)		idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)	for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)		idp p2((x).F, (x).S)
#define dump(x,n)	idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)	idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)	idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)	idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)	rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)	rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
	string s;
	cin >> s;
	if (sz(s) >= 4 && s.substr(0, 4) == "YAKI") {
		puts("Yes");
	} else {
		puts("No");
	}

	return 0;
}

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

int x,y,z,n,m;
char tmp;
pair<int,int> ar[100005];
string s1,s2;

int main() {
	cin >> x;
	for (int i = 0; i < x; i++) {
		cin >> ar[i].first;
		ar[i].second = i;		
	}
	stable_sort(ar,ar+x);
	for (int i = 0; i < x; i++) {
		if (ar[i].second%2 != i%2) {
			n++;
		}
	}
	cout << n/2;
}

Measured memory_bytes: 4836
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	string s;
	string t;
	cin >> s >> t;
	for (int i = 0; i < 3; i++) {
		N += s[i] == t[i];
	}
	cout << N << endl;
}

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

typedef long long int lli;
typedef long double lld;
typedef long long ll;
//Datatype
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vvlli vector<vector<long long int>>
#define ppi pair<int, int>
#define rppi pair<int, pair<int, int>>
#define lppi pair<pair<int, int>, int>
#define vppi vector<pair<int, int>>
#define sppi stack<pair<int int>>
#define qppi queue<pair<int, int>>
//function
#define f first
#define s second
#define pb(x) push_back(x)
#define mkp(i, j) make_pair(i, j)
#define lmkp(i,j,k) make_pair(make_pair(i,j),k)
#define rmkp(i,j,k) make_pair(i,make_pair(j,k))
//loop
#define loop(i,n) for (i = 0; i < n; ++i)
#define loops(i,k,n) for (i = k; i <= n; ++i)
#define looprev(i,k,n) for (i = k; i >= n; --i)
//Const
#define inf (int)1e9
#define eps 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
//Print
#define prd(n) printf("%d", n)
#define prl(n) printf("%lld", n)
#define prdn(n) printf("%d\n", n)
#define prln(n) printf("%lld\n", n)
#define prf(n) printf("%f", n)
//Scan
#define scd(n) scanf("%d", &n)
#define scd2(a, b) scanf("%d %d", &a, &b)
#define scd3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define scl(n) scanf("%lld", &n)
#define scl2(a, b) scanf("%lld %lld", &a, &b)
#define scl3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c)
#define scf(n) scanf("%f", &n)

using namespace std;
class Solution{
  public:
    int frog1(int N, vector<int> vec){
      if(vec.size() == 1){
          return 0;
      }
      else if(vec.size() == 2){
          return abs(vec[1]-vec[0]);
      }
      int i, j, A[N];
      A[0] = 0;
      A[1] = abs(vec[1]-vec[0]);
      loops(i, 2, N-1){
          A[i] = min(A[i-1] + abs(vec[i] - vec[i-1]), A[i-2] + abs(vec[i] - vec[i-2]));
      }
      return A[N-1];
    }
};
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli i, j, k, n;
    Solution s;
    cin>>n;
    vector<int> vec(n, 0);
    loop(i, n){
        cin>>vec[i];
    }
    int res = s.frog1(n, vec);
    cout<<res<<endl;
  return 0;
}

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

int h, w;
vector<string>s;
int cnt[55][55];
const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
const int dy[8] = {1, 1, 1, 0, 0, -1, -1, -1};

void search(int y, int x){
  for(int i = 0; i < 8; i++){
    int nx = x + dx[i];
    int ny = y + dy[i];
    if(nx < 0 || nx >= w || ny < 0 || ny >= h)continue;
    if(s[ny][nx] == '#')cnt[y][x] += 1;
  }
}
void solve(){
  cin >> h >> w;
  s.resize(h);
  memset(cnt, 0, sizeof(cnt));
  for(int i = 0; i < h; i++)cin >> s[i];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      search(i, j);
      if(s[i][j] != '#')cout<<cnt[i][j];
      else cout << '#';
    }
    cout << endl;
  }
}

int main(){
  solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print() { cout << endl; }
template<typename Head,typename... Tail> void print(Head head,Tail... tail){cout<<head;if(sizeof...(Tail)>0)cout<<" ";print(tail...);}
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<head;print0(tail...);}
// clang-format on

using pll = pair<ll, ll>;
int main() {
    ll N;
    cin >> N;
    vector<pll> points;

    ll XMAX = 1000000001L;
    vector<ll> distl(N);
    vector<ll> distr(N);
    for (ll i = 0; i < N; i++) {
        ll x, y;
        cin >> x >> y;
        //pll p = make_pair(x, y);
        distl[i] = x + y;
        distr[i] = XMAX - x + y;
    }
    sort(distl.begin(), distl.end());
    sort(distr.begin(), distr.end());

    ll result = max(distl[N - 1] - distl[0], distr[N - 1] - distr[0]);
    print(result);
}


Measured memory_bytes: 6420
# coding=utf-8
import math

class Tree():
    def __init__(self, key):
        self.root = key

class Node():
    def __init__(self, id, key):
        self.id = id
        self.key = key
        self.parent = None
        self.left = None
        self.right = None

    def set_status(self, id, key):
        global node_list
        parent_id = math.floor(id/2)
        odd = id % 2
        self.parent = node_list[parent_id]
        if odd == 0:
            self.parent.left = self
        else:
            self.parent.right = self

def print_nodes():
    global node_list
    node_list.pop(0)
    for node in node_list:
        print("node {}: key = {}".format(node.id, node.key), end = "")
        if node.parent:
            print(", parent key = {}".format(node.parent.key), end = "")
        if node.left:
            print(", left key = {}".format(node.left.key), end = "")
        if node.right:
            print(", right key = {}".format(node.right.key), end = "")
        print(", ")

n = int(input())
input_num = list(map(int, input().split()))
node_list = [None]

for i, num in enumerate(input_num):
    i = i + 1 #suffix starts from 1
    node = Node(i, num)
    node_list.append(node)

    if i == 1:
        tree = Tree(num)
    else:
        node.set_status(i, num)

print_nodes()

Measured memory_bytes: 7788
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    N, K = map(int, input().split())
    sunuke_list = [0 for i in range(N)]
    for i in range(K):
        d = int(input())
        A_list = list(map(int, input().split()))
        for a in A_list:
            sunuke_list[a-1] += 1
    answer = 0
    for sunuke in sunuke_list:
        if sunuke == 0:
            answer += 1
    print(answer)

if __name__ == "__main__":
    main()




Measured memory_bytes: 9204
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<iostream>
using namespace std;
int n,k,ans,x;
bool flag;
int flag2;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		ans=__gcd(x,ans);
		if(k%ans==0)flag=1;
		flag2=max(flag2,x);
	}
	if(flag==1&&flag2>=k)
	cout<<"POSSIBLE"<<endl;
	else cout<<"IMPOSSIBLE"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define popcnt(a) __builtin_popcount(a)
#define FastIO() ios::sync_with_stdio(false), cin.tie(0);
#define IO() freopen("palindrome.in","rw",stdin)
#define error(args...)                       \
{                                            \
    cerr<<"LINE "<<__LINE__;                 \
    string _s = #args;                       \
    replace(_s.begin(), _s.end(), ',', ' '); \
    stringstream _ss(_s);                    \
    istream_iterator<string> _it(_ss);       \
    err(_it, args);                          \
    cerr<<endl;                              \
}
void err(istream_iterator<string> it)
{
} 
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
  cerr<<' '<< *it << " = " << a ;
  err(++it, args...);
} 
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e6+9, M = (1<<31), OO = 0x3f3f3f3f;
int arr[101];
int main()
{
  int n,mn=OO,l=0,r=0;
  scanf("%d",&n);
  for(int i=0;i<n;++i)
  {
    scanf("%d",arr+i);
    r+=arr[i];
  }
  for(int i=0;i<n;++i)
  {
    r-=arr[i];
    l+=arr[i];
    mn=min(mn,abs(l-r));
  }
  printf("%d\n",mn);
  #ifdef _LOCAL_DEFINE
  cerr << (double)clock() * 1.0 / CLOCKS_PER_SEC << endl;
  #endif
  return 0; 
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int k, sum;
vector <int> v[2000];

int dfs(int x, int y, int z) {
    int c1 = 0, c2 = 0, i;
    
    if (z > (k + 1) / 2) sum++;
    
    for (i = 0; i < v[x].size(); i++) {
        if (v[x][i] != y) {
            int c = dfs(v[x][i], x, z + 1);
            
            c1 += c;
            c2 = max(c2, c);
        }
    }
    
    if (y == -1) {
        if (k % 2 == 0) {
            return sum;
        } else {
            return sum + c1 - c2;
        }
    } else {
        if (z == (k + 1) / 2) {
            return 1;
        } else if (z > (k + 1) / 2) {
            return 0;
        } else {
            return c1;
        }
    }
}

int main() {
    int n, ans = 1e9, i;
    
    scanf("%d %d", &n, &k);
    
    for (i = 0; i < n - 1; i++) {
        int x, y;
        
        scanf("%d %d", &x, &y);
        
        x--;
        y--;
        
        v[x].push_back(y);
        v[y].push_back(x);
    }
    
    for (i = 0; i < n; i++) {
        sum = 0;
        
        ans = min(ans, dfs(i, -1, 0));
    }
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n,q; cin>>n>>q;
    multiset<int> obj;
    // {time,x}
    priority_queue<tuple<int,int>,vector<tuple<int,int>>,greater<tuple<int,int>>> put;
    priority_queue<tuple<int,int>,vector<tuple<int,int>>,greater<tuple<int,int>>> del;
    rep(i,n){
        int s,t,x; cin>>s>>t>>x;
        s-=x,t-=x;
        put.push(make_tuple(s,x));
        del.push(make_tuple(t,x));
    }
    while(q--){
        int d; cin>>d;
        while(put.size()){
            int t,x; tie(t,x)=put.top();
            if(d<t) break;
            put.pop();
            obj.insert(x);
        }
        while(del.size()){
            int t,x; tie(t,x)=del.top();
            if(d<t) break;
            del.pop();
            obj.erase(obj.find(x));
        }
        if(obj.size()){
            cout<<*obj.begin()<<endl;
        }else{
            cout<<-1<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 13796
#include <bits/stdc++.h>
using namespace std;
#define erorp(x) cout<<#x<<"={"<<(x.F)<<" , "<<x.S<<"}"<<endl;
#define print(v,r) f(i,0,r) cout<<v[i]<<" "; cout<<endl;
#define is_bit(x,y) (x%(1<<(y+1))>=(1<<y))
#define eror(x) cout<<#x<<'='<<(x)<<endl;
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define Gett(x,y) scanf("%d%d",&x,&y);
#define f(i,a,b) for(int i=a;i<b;i++)
#define get(x) scanf("%I64d",&x);
#define All(x) x.begin(),x.end()
#define gett(x) scanf("%d",&x);
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first

const int N=1e5+99;

int n,c,x,mv,ans,res,a[N],b[N],mark[N];
map<int,int> t,tn;
vector<int> g[N];

void dfs(int x){
    mark[x]=1;
    f(i,0,g[x].size())
        if(!mark[g[x][i]])
            dfs(g[x][i]);
    ans+=g[x].size();
}

int main(){
    cin>>n;
    f(i,1,n+1){
        gett(a[i]);
        a[0]^=a[i];
        t[a[i]]++;
    }
    t[a[0]]++;
    f(i,1,n+1){  
        gett(b[i]);
        b[0]^=b[i];
    }
    f(i,0,n+1){
        t[b[i]]--;
        if(t[b[i]]<0)
            return cout<<-1,0;
    }
    f(i,0,n+1){
        if(!tn[a[i]]){
            c++;
            tn[a[i]]=c;
        }
    }
    f(i,0,n+1){
        a[i]=tn[a[i]];
        b[i]=tn[b[i]];
        if(a[i]!=b[i]) g[a[i]].pb(b[i]);
    }
    f(i,1,n+1)
        if(b[i]==a[0] && b[0]==a[0])
            mv=1;
    f(i,1,n+2)
        if(!mark[i] && sz(g[i])){
            res++;
            dfs(i);
        }
    if(ans==0) return cout<<0,0;
    cout<<ans+res-(a[0]!=b[0])*2-mv;
}
            

Measured memory_bytes: 22792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n;
    cin>>n;
    int sumw[n+1];
    sumw[0]=0;
    for(int i=1;i<=n;i++){
        int w;
        cin>>w;
        sumw[i]=sumw[i-1]+w;
    }
    int ans=INF;
    for(int i=1;i<n;i++){
        ans=min(ans,abs(sumw[n]-2*sumw[i]));
    }
    cout<<ans<<endl;
}


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

const int N = 1e5 + 5;

ll f(ll x){
    int num1 = (x+1)/2;
    ll ans;
    if(num1&1) ans = 1;
    else ans = 0;

    if((x+1)%2==1 ){
        return (ans^x);
    }else{
        return ans;
    }
}


int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    ll a, b;
    cin>>a>>b;

    ll ans = f(b);
    if(a) ans ^= f(a-1);
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String Sa = scanner.next();
		String Sb = scanner.next();
		String Sc = scanner.next();

		char[][] C = new char[3][100];
		C[0] = Sa.toCharArray();
		C[1] = Sb.toCharArray();
		C[2] = Sc.toCharArray();

		int[] t = new int[3];
		int now = 0;
		String ans = "";
		while(true) {
			switch(C[now][t[now]]) {
			case 'a':
				t[now]++;
				now = 0;
				break;
			case 'b':
				t[now]++;
				now = 1;
				break;
			case 'c':
				t[now]++;
				now = 2;
				break;
			}

			if(t[0]==Sa.length()&&now==0) {
				ans = "A";
				break;
			}
			if(t[1]==Sb.length()&&now==1) {
				ans = "B";
				break;
			}
			if(t[2]==Sc.length()&&now==2) {
				ans = "C";
				break;
			}
		}
		System.out.println(ans);
		scanner.close();
	}

}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef vector<pll> vll;
typedef vector<vl> vvl;

#define fori(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i >= 0; i--)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define trav(x, a) for (auto &x : a)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define sz(a) (int)(a).size()
#define fi first
#define se second

clock_t time_p = clock();
void time_taken()
{
    time_p = clock() - time_p;
    cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}

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

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

    int n;
    cin >> n;
    int last = 0;
    ll ans = 0;
    fori(i,n){
        int x;
        cin >> x;
        if(x > last) {last=x;continue;}
        ans += (last - x);
    }
    cout << ans << endl;

    time_taken();
    return 0;
}

Measured memory_bytes: 3808