akhauriyash/Code-Regression huggingface dataset:
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int sod(int a){
    int ans=0;
    while(a>0){
        ans+=(a%10);
        a/=10;
    }
    return ans;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,a,b;
    cin>>n>>a>>b;

    int count=0;
    for(int i=1;i<=n;i++){
        if(sod(i)>=a && sod(i)<=b){
            count+=i;
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;

ll k,x;

void input(void){
    cin>>k>>x;
}

void solve(void){
    for(ll i=x-k+1;i<x+k;i++){
        cout<<i;
        if(i!=x+k-1)cout<<" ";
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef struct{
	int num;
	char color;
}CARD;

int main(){
	int n;
	for(cin>>n;n>0;n--){
		int flag=1;
		int card[3][10]={0};
		CARD tmp[9];
		for(int i=0;i<9;i++)cin>>tmp[i].num;
		for(int i=0;i<9;i++)cin>>tmp[i].color;
		for(int i=0;i<9;i++){
			//(tmp[i].color=='R'?0:(tmp[i].color=='G'?1:2))
			card[(tmp[i].color=='R'?0:(tmp[i].color=='G'?1:2))][0]++;
			card[(tmp[i].color=='R'?0:(tmp[i].color=='G'?1:2))][tmp[i].num]++;
		}
		
		//for(int i=0;i<3;i++)for(int j=0;j<10;j++)cout<<card[i][j]<<(j==9?"\n":" ");
		for(int i=0;i<3;i++)if(card[i][0]%3)flag=0;
		
		for(int i=0;i<3&&flag;i++){
			for(int j=1;j<=9&&flag;j++){
				if(card[i][j]<0)flag=0;
				else if(card[i][j]==1){
					if(j<=7)for(int k=0;k<3;k++)card[i][j+k]-=1;
					else flag=0;
				}
				else if(card[i][j]==2){
					if(j<=7)for(int k=0;k<3;k++)card[i][j+k]-=2;
					else flag=0;
				}
				else if(card[i][j]==3)card[i][j]-=3;
				else if(card[i][j]==4){
					card[i][j]-=3;
					if(j<=7)for(int k=0;k<3;k++)card[i][j+k]-=1;
					else flag=0;
				}
				
			}
		}
		
		cout<<(flag?1:0)<<endl;
	}
	
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 1160
program multi2;
var 
    total, current : qword;
    exploded : boolean;
    i, n : longint;
begin
    exploded := false;
    readln(n);
    total := 1;
    for i := 1 to n do begin
        read(current);
        if current = 0 then begin
            writeln(0);
            exit;
        end;
        if 1000000000000000000 div current < total then begin
            exploded := true;
        end;
        total := total * current;
    end;
    if exploded then
        writeln(-1)
    else
        writeln(total);
end.

Measured memory_bytes: 1356
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  string s;
  cin >> s;
  if (s == "ABC")
    cout << "ARC" << endl;
  else
    cout << "ABC" << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 3572
import sys, re
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from collections import deque, defaultdict, Counter
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop, heapify
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M, R = MAP()
r = LIST()
ABC = [LIST() for _ in range(M)]

dist_matrix = [[INF]*N for _ in range(N)]

for A, B, C in ABC:
	dist_matrix[A-1][B-1] = C
	dist_matrix[B-1][A-1] = C

for i in range(N):
	dist_matrix[i][i] = 0

#for i in range(N):
#	print(dist_matrix[i])

#ワーシャルフロイド法  注意 PyPy非対応!!!!
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
 
graph = csr_matrix(dist_matrix) #隣接行列からcsr行列をつくる
dist_matrix = floyd_warshall(graph, directed=False) #無向の場合directed=False
#dist_matrixの中身はfloatになっているので注意！

#for i in range(N):
#	print(dist_matrix[i])

ans = INF
for x in permutations(r):
	tmp = 0
	for i in range(1, R):
		tmp += dist_matrix[x[i-1]-1][x[i]-1]
	ans = min(ans, tmp)

print(int(ans))
	


Measured memory_bytes: 20392
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	ll a,b,c;
	ll ans=0LL;
	cin >>a>>b>>c;
	if(a%2LL==0 || b%2LL==0 || c%2LL==0){
		ans=0LL;
	}else{
		ans=min({a*b,b*c,c*a});
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3576
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


const string NA = "NA";
const string OK = "OK";

double sq( double x ) {
    return x * x;
}

string solve( int r, int R[3] ) {
    for ( int i = 0; i < 3; ++ i ) {
        for ( int j = i + 1; j < 3; ++ j ) {
            if ( sqrt( sq( R[i] ) + sq( R[j] ) ) < 2 * r ) return OK;
        }
    }
    return NA;
}

int main() {
    int x, y, z;
    while ( cin >> x >> y >> z ) {
        if ( x == 0 && y == 0 && z == 0 ) break;
        int R[3] = { x, y, z };
        int n;
        cin >> n;
        for ( int i = 0; i < n; ++ i ) {
            int r;
            cin >> r;
            cout << solve( r, R ) << endl;
        }
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  sort(s.begin(), s.end());
  
  map<string, int> vote;
  rep(i, n){
    vote[s[i]]++;
  }
  
  int max=0;
  rep(i, n){
    if(vote[s[i]] > max) max = vote[s[i]];
  }
  
  rep(i, n){
    if(i==0 && vote[s[0]]==max) cout << s[0] << endl;
    else if(vote[s[i]]==max && s[i]!=s[i-1]) cout << s[i] << endl;
  }
  
}

Measured memory_bytes: 26752
A, B, C = list(map(int, input().split()))

ListA = [A]*10000
ListB = [B]*10000
ListC = [C]*10000

if A%2==1 or B%2==1 or C%2==1:
	print(0)
	exit()

for i in range (1, 10000):
	ListA[i]= ListB[i-1]/2+ListC[i-1]/2
	ListB[i]= ListA[i-1]/2+ListC[i-1]/2
	ListC[i]= ListA[i-1]/2+ListB[i-1]/2
	if ListA[i]%2==1 or ListB[i]%2==1 or ListC[i]%2==1:
			print(i)
			exit()

print(-1)

Measured memory_bytes: 3956
<?php
$N = trim(fgets(STDIN));
list($S,$T) =  explode(" ",trim(fgets(STDIN)));
//$A =  explode(" ",trim(fgets(STDIN)));

$res="";
for($i=0;$i<$N;$i++) {
  $res .= $S[$i] . $T[$i];
}
printf("%s\n",$res);


Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> d(m);
  int k;
  cin>>k;
  for(int i=0;i<n;i++){
    vector<int> w(k);
    for(int j=0;j<k;j++){
      cin>>w[j];
    }
    for(int j=0;j<k;j++){
      d[w[j]-1]++;
    }
    cin>>k;
  }
  int ans=0;
  for(int i=0;i<m;i++){
    if(d[i]==n){
      ans++;
    }
  }
  cout<<ans<<endl;
      
}

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


int main() {
    int a;
    cin >> a;
    if(a == 3 || a == 5 || a == 7){
        cout << "YES";
    }
    else{
        cout << "NO";
    }
    cout << endl;
}


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

int main() {
	
	ll n, k; cin >> n >> k;
	vector<ll> x(n);
	for (ll i = 0; i < n; i++) {
		cin >> x[i];
	}
	
	ll ans = 9223372036854775807LL;
	for (ll left = 0; left <= n - k ; left++) {
		ll right = left + k - 1;
		ll tmpL = abs(x[left]) + abs(x[right] - x[left]);
		ll tmpR = abs(x[right]) + abs(x[right] - x[left]);
		ll tmp = min(tmpL, tmpR);
		ans = min(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4032
#include<bits/stdc++.h>
using namespace std;
int n;
char ch[105];
bool f,k;
int main()
{
	cin>>ch;
	int chlen=strlen(ch);
	for(int i=0;i<chlen;i++)
	{
		if(ch[i]=='C')f=1;
		if(f==1&&ch[i]=='F')
		{
			k=1;
			break;
		}
	}
	if(k==1)printf("Yes\n");
	if(k!=1)printf("No\n");
}

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

int main()
{
  int h, n, count=0;
  cin >> h >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
    count += a[i];
  }

  if(h > count){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }


  return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();
        string t = sc.Next();

        if (s.Length < t.Length)
        {
            Console.WriteLine("UNRESTORABLE");
            return;
        }

        List<string> answers = new List<string>();
        for (int i = 0; i < s.Length - t.Length + 1; i++)
        {
            bool ok = true;
            string tmpAnswer = "";
            for (int j = 0; j < i; j++)
            {
                tmpAnswer += s[j] == '?' ? "a" : s[j].ToString();
            }
            for (int j = 0; j < t.Length; j++)
            {
                if (s[i + j] != '?' && s[i + j] != t[j])
                {
                    ok = false;
                    break;
                }
                else
                {
                    tmpAnswer += t[j];
                }
            }
            for (int j = 0; j < s.Length - i - t.Length; j++)
            {
                tmpAnswer += s[i + t.Length + j] == '?' ? "a" : s[i + t.Length + j].ToString();
            }
            if (ok)
            {
                answers.Add(tmpAnswer);
            }

        }

        if (answers.Count > 0)
        {
            string answer = answers.OrderBy(str => str).First();
            Console.WriteLine(answer);
        }
        else
        {
            Console.WriteLine("UNRESTORABLE");
            return;
        }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


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

int main(){

    int n;
    string s,a,b;
    cin>>n>>s;
    a=s.substr(0,s.size()/2);
    b=s.substr(s.size()/2);
    if(a==b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    






    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vec vector<ll>
#define fl(i,from,to) for(ll i=from;i<=to;i++)
#define um unordered_map<ll,ll>
#define pa pair<ll,ll>
#define pb push_back
#define ff first
#define ss second
#define mod 1000000004
#define start ll t;cin>>t;while(t--)
#define inp(a) ll a;cin>>a
#define fasti  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
ll arr[10004];
int main()
{
  inp(n);
  ll max=102;
  fl(x,1,max)
  {
    fl(y,1,max)
    {
      fl(z,1,max)
      {
        ll temp=x*x +y*y+z*z+x*y+y*z+z*x;
        if(temp>n)continue;
        arr[temp]++;
      }
    }
  }
  fl(i,1,n)
  cout<<arr[i]<<endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
void gao(int &a,int b){
	if(a<b)a=b;
}
int n,m,sum,a[15][15],g[1<<15],f[1<<15][15];
int main(){
	n=read(),m=read();
	memset(f,-1,sizeof(f));
	f[1][0]=0;
	for(int i=1;i<=m;i++){
		int x=read()-1,y=read()-1,z=read();
		sum+=z,a[x][y]=a[y][x]=z;
		for(int j=0;j<(1<<n);j++)
			if((j>>x)&(j>>y)&1)
				g[j]+=z;
	}
	for(int i=1;i<(1<<n);i++)
		for(int j=0;j<n;j++)
			if(~f[i][j]){
				for(int k=0;k<n;k++)
					if(!(i>>k&1)and a[j][k])
						gao(f[1<<k|i][k],f[i][j]+a[j][k]);
				for(int U=((1<<n)-1)^i,k=U;k;k=(k-1)&U)
					gao(f[i|k][j],f[i][j]+g[1<<j|k]);
			}
	printf("%d",sum-f[(1<<n)-1][n-1]);
	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) rrepi(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define ZERO(x) memset(x,0,sizeof(x))
#define MINUS(x) memset(x,-1,sizeof(x))
#define UNIQUE(x) (x).erase(unique(ALL(x)), (x).end())
#define TOUPPER(x) transform(ALL(x), (x).begin(), ::toupper)
#define TOLOWER(x) transform(ALL(x), (x).begin(), ::tolower)
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){for(const auto& v : vv){ view(v); } }
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void viewarr(T arr[], int n) { for(int i = 0; i < n; ++i) std::cout << arr[i] << " "; std::cout << std::endl; }
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 qp(ll a,ll b){ll ans=1;do{if(b&1)ans=1ll*ans*a;a=1ll*a*a;}while(b>>=1);return ans;}
ll qp(ll a,ll b,ll mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const int INF = 1e9;
const ll INFL = 1e18;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5;

int main() {
    int x; cin >> x;
    int cnt500 = 0, cnt5 = 0;
    cnt500 = x / 500;
    x %= 500;
    cnt5 = x / 5;
    cout << cnt500 * 1000 + cnt5 * 5 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i > 0; i++)
const int MOD =1e9+7;
    
int main(){
    int n, m;
    cin >> n >> m;
    vector<int> cnt(n+1);
    vector<bool> j(n+1);
    int ac = 0, wa = 0;
    rep(i,m){
        
        int p;
        string s;
        cin >> p >> s;
        if(j[p] == 1) continue;
        if(s=="AC") {
            ac++;
            wa += cnt[p];
            j[p] = 1;
            cnt[p] = 0;
        } else cnt[p]++;
    }
    cout << ac << " " << wa;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
      #include <chrono>
    
      using namespace std;
      using namespace std::chrono; 
   
      typedef long long int ll;
   
      #define MOD (ll)(1e9+7)
      #define endl "\n"
      #define pb push_back
      #define TEST_CASES  ll t;cin>>t;while(t--)
      #define forn(i,a,n) for (int i = a; i < n; ++i)
      #define f first
      #define s second
      #define all(x) x.begin(), x.end()


      
      ll powD(ll x,ll y){
        ll res = 1;
        while(y > 0){
          if(y & 1)
            res = (res*x)%MOD;
          x = (x*x)%MOD;
          y = y>>1;
        }
        return res;
      }
  
      int main()
      {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        int x,y;
        cin>>x>>y;
        if(y%2 || y < 2*x){
          cout<<"No"<<endl;
          return 0;
        }
        int b = y/2 -x;
        int a = x - b;
        if(a >= 0 && b >= 0){
          cout<<"Yes"<<endl;
        }
        else
          cout<<"No"<<endl;
      }

      
    


Measured memory_bytes: 3636
#include<stdio.h>

int n, a[20];

int solve ( int i, int m) {
    if (m == 0) return 1;
    if (i >= n) return 0;
    int res = solve(i + 1, m) || solve(i + 1, m - a[i]);
    return res;
}

int main() {
    int q, m, i;
    
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    
    scanf("%d", &q);
    for (i = 0; i < q; i++){
        scanf("%d", &m);
    if (solve(0, m))
        printf("yes\n");
    else
        printf("no\n");
    }
    
    return 0;
}

Measured memory_bytes: 1820
/* ****revpro**** */
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    ll a,b;
    cin>>a>>b;
    cout<<max(0LL,a-2*b);
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int a;
    cin >> a;
    int ans = a + (a * a) + (a * a * a);
    cout << ans << endl;
}

Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<set>
#include<cmath>
#include<stack>
#include<random>
#include<iterator>
#include <algorithm>
#include <functional>
#include <cassert>
using namespace std;

template <typename T>
void printvec(vector<T> v)
{
    for(auto it=v.begin();it != v.end();it++)
    {
        cout << (*it) << endl;
    }
    cout << endl;
}


struct ListNode {
    int val;
    ListNode *next;
    ListNode() : val(0), next(nullptr) {}
    ListNode(int x) : val(x), next(nullptr) {}
    ListNode(int x, ListNode *next) : val(x), next(next) {}
};


void printl(ListNode* l){
    ListNode *h;h=l;
    while(h!= NULL){
        cout << h->val<< endl;
        h = h->next;
    }
}

template <typename T>
void chmax(T& a,const T& b){if(b > a)a = b;}
template<typename T>
void chmin(T& a ,const T& b){if(a > b)a = b;}

int lower_bound(vector<int> v,int k){//vの中でk以下の値をみっけるないときは一番いひだりが帰ってくる
    int l(0),r(v.size());
    long long int mid;
    while(l<r){
        mid = (l+r)/2;
        if(mid == v.size() -1 ){
            return v.size()-1;
        }
        if(v[mid] <= k && v[mid+1] >k ){
            return mid;
        }else if(v[mid] > k){
            r = mid-1;
        }else{
            l = mid + 1;
        }
    }
    return l;
}
template <typename T>
void print2dvec(vector<vector<T>> v){
    for(int j=0;j<v[0].size();j++)
    {
        for(int i=0;i<v.size();i++){
            cout << v[i][j];
        }
        cout << endl;
    }
    
}


int lcs(string s1,string s2){
    int dp[50][50] = {0};
    cout << dp[2][2] << endl;
    //i,jは何文字目か
    for(int i=1;i<=s1.size();i++){
        for(int j = 1;j<=s2.size();j++){
            if(s1[i-1] ==s2[j-1] ){
                chmax(dp[i][j] , dp[i-1][j-1] + 1);
            }
            chmax(dp[i][j],dp[i-1][j]);
            chmax(dp[i][j] , dp[i][j-1]);
        }
    }
    return dp[s1.size()][s2.size()];
}


struct veccomp{
    bool operator()(const vector<int>& a,const vector<int>& b)const{
        return a[0] < b[0];
    }
};    

int main(){
    string s;
    int k;
    cin >> k;
    cin >> s;
    if(s.size() <= k){
        cout << s << endl;
    }else{
        string s_(s.begin(), s.begin() + k);
        s_ += "...";
        cout << s_ << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define y_n(ans) cout<<(ans?"Yes":"No")<<endl;

int main() {
    long long n; cin >> n;
    n--;
    long long ans = 0;
    for (long long i = 1; i <= n; ++i) {
        ans += n / i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#coding:utf-8
S=str(input())
n=len(S)-1
answer=0
for i in range(2**(n)):
  formula=S[0]
  for j in range(n):
    if ((i>>j)&1):
      formula+="+"
    formula+=S[j+1]
  answer+=sum(map(int,formula.split("+")))
print(answer)

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <ctime>
#include <iostream>
#include <cstdlib>
#define sbc __builtin_popcount
#define pb push_back
#define em emplace
#define emb emplace_back
int mod = 1e9+7;
using namespace std;
// template<typename T>
	// T pwm(T a,T b)
    // {
        // T p=1,one=1;
        // while(b)
        // {
            // if(b&one) p=p*a%mod;
            // a=a*a%mod;
            // b >>=1;
        // }
        // return p;
    // }

    void solve() {
		int a,b,x,y;
		cin>>x>>y;
		a=x*12;
		b=(y+1)*10+2;
		while(a<b)
		{
			if(a && floor(a*0.08)==x && y==floor(a*0.1))
			{
				cout<<a<<'\n';
				return;
			}
			a++;
		}
		cout<<-1<<'\n';
    }

int main()
{
	
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	
	
   // int t;
   // cin>>t;
   // while(t--)
	  solve();
  
	
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <math.h>


using namespace std;


int main(){
    int N, D;
    std::vector<std::vector<int>> points;
    cin>>N>>D;
    for(int i=0; i<N; i++){
        std::vector<int> tmp;
        for(int j=0; j<D; j++){
            int X;
            cin>>X;
            tmp.push_back(X);
        }
        points.push_back(tmp);
    }

    int answer = 0;
    for(int i=0; i<N-1; i++){
        for(int j=i+1; j<N; j++){
            std::vector<int> a = points[i];
            std::vector<int> b = points[j];
            double norm=0;
            for(int k=0; k<D; k++){
                norm += pow(a[k]-b[k],2);
            }
            norm = sqrt(norm);

            if(ceil(norm)==floor(norm))
                answer++;
        }
    }

    cout<<answer<<endl;

    return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cstring>
#include <cassert>
using namespace std;
using LL = long long;
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifdef zerol
#define dbg(x...) do { cout << "\033[32;1m" << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif


#ifdef L_JUDGE
#pragma warning(disable:4996)
#endif

using namespace std;

template <typename T>
inline bool read(T& ret) {
    T x = 0, f = 1; char ch = getchar();
    while(ch!=EOF && (ch > '9' || ch < '0')) { if(ch == '-') f = -1; ch = getchar();  }
    if(EOF==ch)return false;
    do x = x * 10 + ch - 48, ch = getchar(); while(ch >= '0' && ch <= '9');
    ret = x * f;
    return true;
}


inline char nc() {
    static char buf[100000], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++;
}
template <typename T>
bool rn(T& v) {
    static char ch;
    while (ch != EOF && !isdigit(ch)) ch = nc();
    if (ch == EOF) return false;
    for (v = 0; isdigit(ch); ch = nc())
        v = v * 10 + ch - '0';
    return true;
}

template <typename T>
void o(T p) {
    static int stk[70], tp;
    if (p == 0) { putchar('0'); return; }
    if (p < 0) { p = -p; putchar('-'); }
    while (p) stk[++tp] = p % 10, p /= 10;
    while (tp) putchar(stk[tp--] + '0');
}


LL bin(LL x, LL n, LL MOD) {
    LL ret = MOD != 1;
    for (x %= MOD; n; n >>= 1, x = x * x % MOD)
        if (n & 1) ret = ret * x % MOD;
    return ret;
}
inline LL get_inv(LL x, LL p) { return bin(x, p - 2, p); }



void Solve(){
}

int N;
const int MOD=1e9+7;
LL A[200010];

int main(){
#ifdef L_JUDGE
    freopen("in1.txt","r",stdin);
    //		freopen("out.txt","w",stdout);
#endif
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    while(EOF!=scanf("%d", &N)){
        LL tmpsum=0;
        LL ans=0;
        for(int i=0;i<N;i++){
            scanf("%lld", A+i);
            ans = ans+tmpsum*A[i];
            ans%=MOD;
            tmpsum+=A[i];
            tmpsum%=MOD;
        }
        cout<<ans<<endl;
    }
    return 0;

#ifdef L_JUDGE
    fclose(stdin);
    fclose(stdout);
    //		system("out.txt");
#endif

	return 0;
}


Measured memory_bytes: 4808
#include<cstdio>
#include<iostream>
#include<queue>
#include<string>
#include<vector>
#include<random>
#include<fstream>
#include<map>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if ((b * 10 + c) % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


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


int main()
{
  	string S;
	cin >> S;
	if (S.at(0) == S.at(1) && S.at(2) == S.at(3) && S.at(0)!=S.at(2)){
		cout << "Yes" << endl;
		return 0;	
	}
	else if (S.at(0) == S.at(2) && S.at(1) == S.at(3) && S.at(0)!=S.at(1)){
		cout << "Yes" << endl;
		return 0;	
	}
	else if (S.at(0) == S.at(3) && S.at(1) == S.at(2) && S.at(0)!=S.at(1)){
		cout << "Yes" << endl;
		return 0;	
	}
	else{
		cout << "No" << endl;
	}
	
	return 0;
}

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

struct Timer {
  chrono::high_resolution_clock::time_point st;

  Timer() { reset(); }

  void reset() {
    st = chrono::high_resolution_clock::now();
  }

  chrono::milliseconds::rep elapsed() {
    auto ed = chrono::high_resolution_clock::now();
    return chrono::duration_cast< chrono::milliseconds >(ed - st).count();
  }
};

int main() {
    Timer tim;
    int h, w, m;
    cin >> h >> w >> m;
    map<pair<int, int>, int> mp;
    map<int, int> h_mp, w_mp;
    for(int i = 0; i < m; ++i) {
        int h1, w1;
        cin >> h1 >> w1;
        h_mp[h1]++;
        w_mp[w1]++;
        mp[{h1, w1}]++;
    }
    tim.reset();
    vector<int> h_mp_max_index, w_mp_max_index;
    int h_mp_max = 0, w_mp_max = 0;
    auto begin = h_mp.begin(), end = h_mp.end();
    for(auto iter = begin; iter != end; iter++) {
        if(iter->second > h_mp_max) h_mp_max = iter->second;
    }
    for(auto iter = begin; iter != end; iter++) {
        if(iter->second == h_mp_max) h_mp_max_index.push_back(iter->first);
    }

    begin = w_mp.begin(), end = w_mp.end();
    for(auto iter = begin; iter != end; iter++) {
        if(iter->second > w_mp_max) w_mp_max = iter->second;
    }
    for(auto iter = begin; iter != end; iter++) {
        if(iter->second == w_mp_max) w_mp_max_index.push_back(iter->first);
    }

    for(auto v : h_mp_max_index) {
        for(auto e : w_mp_max_index) {
            if(mp[{v, e}] == 0) {
                cout << (h_mp_max + w_mp_max) << '\n';
                return 0;
            }
            if(tim.elapsed() >= 1800) {
                cout << (h_mp_max + w_mp_max - 1) << '\n';
                return 0;
            }
        }
    }
    cout << (h_mp_max + w_mp_max - 1) << '\n';
}


Measured memory_bytes: 54312
#include <bits/stdc++.h>
using namespace std;
#define int long long
 
signed main(){
  string S;
  cin>>S;
  int N=S.length();
  N--;
  int totalans=0;
  int ans=0;
  int temp=0;
  
  for(int i=0;i<(1 << N);i++){
    ans=0;
    temp=0;
    for(int j=0;j<N;j++){
      temp+=(S.at(j)-'0');
      if(i&(1<<j)){
        ans+=temp;
        temp=0;
        continue;
      }
      else{
        temp*=10;
      }
    }
    if(i&(1<<N)){
      ans+=temp;
      ans+=(S.at(N)-'0');
    }
    else{
      //temp*=10;
      temp+=(S.at(N)-'0');
      ans+=temp;
    }
    //cout<<ans<<endl;
    totalans+=ans;
  }
  cout<<setprecision(18)<<totalans<<endl;
  return 0;
}




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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
#define vi vector<int>

#define ll long long int

int ctoi(char c) {return c-'0';}
int ord(char c) {return c-'a';}
int len(string s) {return s.length();}
int itoc(int i) {return i+'a';}

int main() {
int N;
cin>>N;
vector<int> v(N);
int mini = N+1;
int dp[N];
int c = 0;
for(int i=0;i<N;i++) {
    cin>>v[i];
    if(v[i]<mini) {
        mini = v[i];
        dp[i] = dp[i-1]+1;
        c++;
    }
    else dp[i] = 0;
}
cout<<c<<endl;
return 0;
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
  ll q, h, s, d, n;
  cin >> q >> h >> s >> d >> n;

  ll l = min(4*q, min(2*h, s));

  if(n == 1){
    cout << l << endl;
    return 0;
  }else{
    ll ans = n/2 * min(2*l, d);
    ans += n%2 * l;
    cout << ans << endl;
  }

  return 0;
}


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

void insertSort(int a[], int n)
{
    for (int i = 0; i < n; ++i) {
        int v = a[i];
        int j = i - 1;
        
        while(0 <= j && a[j] > v) {
            a[j+1] = a[j];
            --j;
        }
        a[j + 1] = v;
        
        for (int k = 0; k < n; ++k)
            cout << ((k==0)? "" : " ") << a[k];
        cout << endl;
    }
    
}

int main(void)
{
    int a[100], n;
    
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
        
    insertSort(a, n);
    
    return 0;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int main()
{
	//code
	int k;
	string s;
	
	cin>>k;
	cin>>s;
	
	if(s.size()>k)
		s=s.substr(0,k)+"...";
		
	cout<<s<<endl;
 	return 0;
}



Measured memory_bytes: 3580
x, y = map(int, input().split())

ans = 0
p = [300000, 200000, 100000]
if 1 <= x <= 3:
    ans += p[x-1]
if 1 <= y <= 3:
    ans += p[y-1]

if x * y == 1:
    ans += 400000

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ld = long double;

int main()
{
    ld a, b, h, m;
    cin >> a >> b >> h >> m;

    ld ans, ak, bk, tmp;
    ak = 2.0 * M_PI * (h / 12.0 + m / 720.0);
    bk = 2.0 * M_PI * (m / 60.0);

    tmp = powl(a, 2.0) + powl(b, 2.0) - 2.0 * a * b * cosl(abs(ak - bk));
    ans = sqrtl(tmp);

    cout << setprecision(11) << ans << endl;
}

Measured memory_bytes: 4152
/*
 * @Author: Luisvacson
 * @LastEditors: Luisvacson
 * @Descriptions: None
 * @Date: 2020-06-27 20:03:40
 * @LastEditTime: 2020-06-27 20:04:49
 * @FilePath: \VSC\C++\Public\AC abc172 B.cpp
 */ 
#include<bits/stdc++.h>
using namespace std;

string s,t;
signed main(){
    ios_base::sync_with_stdio(0);
    cin>>s>>t;
    int ans=0;

    for(register int i=0;i<s.size();++i) if(s[i]!=t[i]) ++ans;
    printf("%d\n",ans);
    return 0;
}

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

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

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


int main() {
    int n;
    cin>>n;
    ll a=1, b=1;
    for (int i = 0; i < n; i++) {
        ll x,y;
        cin>>x>>y;
        ll t=max((a+x-1)/x, (b+y-1)/y);
        a=x*t;
        b=y*t;
    }
    cout<<a+b<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    string s;
    cin >> s;
    ll n = s.size(), p = 2019;
    vll a(n);
    REP(i, n) a[i] = int(s[i] - '0');
    reverse(ALL(a));
    vll v(n + 1);
    ll d = 1;
    map<ll, ll> mp;
    mp[0] = 1;
    ll res = 0;
    REP(i, n) {
        v[i + 1] = v[i] + d * a[i];
        v[i + 1] %= p;
        res += mp[v[i + 1]];
        mp[v[i + 1]]++;
        d *= 10;
        d %= p;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 6792
#include<iostream>
using namespace std;
int main(){
    int a;
    int b;
    cin>>a>>b;
    
    if(a==b){
        cout<<"a == b"<<endl;
    }
    else if(a<b){
        cout<<"a < b"<<endl;
    }
    else{
        cout<<"a > b"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>

using namespace std;
 int main(){
 	int x ,a ,b;
 	cin >> x >> a >> b;
 	
 	if(a >= b){
 		cout << "delicious" << endl;
 	}
 	else if (a+x>=b){
 		cout << "safe" << endl;
 	}
 	else {
 		cout << "dangerous" << endl;
 	}
 	return 0 ;
 	
 }
 

Measured memory_bytes: 256
///supercalifragilisticexpialidocious.
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <utility>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <complex>
using namespace std;
#define f first
//#define s second
#define PB pop_back 
#define pb push_back
#define mp make_pair
#define int long long
#define y1 y_golabi
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll; 
typedef map<int , int> mii;
typedef pair<int , int> pii; 
typedef map<string , int> msi;
typedef pair<int , string> pis; 
typedef pair<int , pair<int , int> > piii;
int a , b , c , cnt;
int32_t main()
{
	cin >> a >> b >> c;
	if((a & 1) or (b & 1) or (c & 1))
		return cout << 0 << endl , 0;
	while(true)
	{
		cnt ++ , a /= 2 , b /= 2 , c/= 2;	
		if((a % 1) or (b & 1) or (c & 1))
		{
			if((a & 1) == (b & 1) and (a & 1) == (c & 1))
				cnt ++;
			break;
		}
	}
	if(a == b and a == c)
		return cout << -1 << endl , 0;
	return cout << cnt << endl , 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    bool check = false;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        if(a[i] == 1) check = true;
    }
    if(!check)
    {
        cout << -1 << endl;
        return 0;
     }
    int pos = 0;
    for(int i = 0; i < n; i++)
    {
        if(a[i] == pos+1)
        {
            pos++;
        }
    }
    cout << n - pos << endl;
}



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

using edge = pair<int,int>;
vector<vector<edge>> G;

ll dfs(int v, int p, int g, ll num){
    if (v == g) return num;
    for (auto nv : G[v]) {
        if (nv.first == p) continue;
        ll next_num = num | (1ll<<nv.second);
        ll res = dfs(nv.first, v, g, next_num);
        if (res > 0ll) return res;
    }
    return 0ll;
}

int main() {
    int n; cin >> n;
    G.resize(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b; cin >> a >> b; a--; b--;
        G[a].pb(edge(b,i));
        G[b].pb(edge(a,i));
    }

    int m; cin >> m;
    vector<ll> dist(m);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b; a--; b--;
        dist[i] = dfs(a, -1, b, 0ll);
    }

    ll ans = 0ll;
    for (int i = 0; i < 1<<m; i++) {
        ll num = 0ll;
        bool check = true;
        for (int j = 0; j < m; j++) if (i & (1<<j)) { num |= dist[j]; check = !check; }
        int k = n - 1 - (int)__builtin_popcountl(num);
        if (check) ans += 1ll<<k;
        else ans -= 1ll<<k;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = ii()
    dp = [0] * (S + 1)

    dp[0] = 1
    # 0 <= i <= Sの範囲を探索
    for i in range(1, S + 1):
        # 0 <= j <= i - 3の範囲で、
        # 間仕切りを置くことができる個数の合計を集計
        if i > 2:
            dp[i] = sum(dp[0:i - 2])
            dp[i] %= MOD
    print(dp[-1])


if __name__ == '__main__':
    main()


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

using namespace std;

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

	constexpr int MOD{1'000'000'007};
	int H, W;
	cin >> H >> W;
	vector<string> grid(H);
	for(auto& row : grid)
	{
		cin >> row;
	}
	vector<vector<int> > dp(H + 1, vector<int>(W + 1, 0));
	dp[H][W - 1] = 1;
	for(int i = H - 1; i >= 0; --i)
	{
		for(int j = W - 1; j >= 0; --j)
		{
			if(grid[i][j] == '.')
			{
				dp[i][j] = dp[i][j + 1] + dp[i + 1][j];
				if(dp[i][j] >= MOD)
				{
					dp[i][j] %= MOD;
				}
			}
		}
	}

	cout << dp[0][0] << "\n";

	return 0;
}

Measured memory_bytes: 5248
s = input()
n = int(input())

for i in range(n):
  c = input().split()
  a = int(c[1])
  b = int(c[2])

  if "replace" in c:
    s = s[:a] + c[3] + s[b+1:]
        
  if "reverse" in c:
    u = s[a:b+1]
    s = s[:a] + u[:: -1] +s[b + 1:]

  if "print" in c:
    print(s[a:b+1], sep = '')




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

void solve();
int main(int argc, char *argv[]) {
    if (argc == 2) {
        freopen(argv[1], "r", stdin);
    } else if (argc == 3) {
        freopen(argv[1], "r", stdin);
        freopen(argv[2], "w", stdout);
    }
    solve();
    return 0;
}

const int N=100+10;
int n,a[N],cnt[N];
bool check(int x, int y){
    for(int i=x;i<=y;i++) if(cnt[i]<2) return false;
    return true;
}
void solve() {
    while(cin>>n) {
        fill(cnt,cnt+n,0);
        for(int i=0;i<n;i++) {
            cin>>a[i];
            cnt[a[i]]++;
        }

        sort(a,a+n);
        int minD=a[0], maxD=a[n-1];
        bool flag=false;
        if(minD==1&&maxD==1) {
            if(cnt[1]==2) flag=true;
        } else if(maxD==2*minD-1) {
            if(cnt[minD]==2&&check(minD+1,maxD)) flag=true;
        } else if(maxD==2*minD) {
            if(cnt[minD]==1&&check(minD+1,maxD)) flag=true;
        }
        if(flag) puts("Possible");
        else puts("Impossible");

    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
    int n,l;
    char s[110][110], tmp[110];
    scanf("%d%d", &n, &l);
    for(int i=0;i<n;i++) scanf("%s", s[i]);
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            if(strcmp(s[i], s[j]) > 0){
                strcpy(tmp, s[j]);
                strcpy(s[j], s[i]);
                strcpy(s[i], tmp);
            }
        }
    }
    for(int i=0;i<n;i++) printf("%s",s[i]);
    printf("\n");
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

int main(void){
  int i, j, n, *s, q, *t, c = 0;

  scanf("%d", &n);
  s = (int *)malloc(sizeof(int) * n);
  for(i = 0; i < n; i++){
    scanf("%d", &s[i]);
  }
  scanf("%d", &q);
  t = (int *)malloc(sizeof(int) * q);
  for(i = 0; i < q; i++){
    scanf("%d", &t[i]);
  }

  for(i = 0; i < q; i++){
    for(j = 0; j < n; j++){
      if(t[i] == s[j]){
	c++;
	break;
      }
    }
  }
  printf("%d\n", c);
  free(s);
  free(t);
  return 0;
}

Measured memory_bytes: 636
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
    REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll

const int md = 1000000007;
const int INF = 1<<30;



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

    ll ans = 0;

    rep(i,n-1){
        rep(j,i+1,n){
            ans += d[i] * d[j];
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 256