akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
typedef long double LD;
#define LP(i, a, b) for (LL i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (LL i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-8
#define INF 1e9
#define LINF 1e18

LL const MOD = 1e9 + 7;
LL const MaxSize = 1e6 + 5;
//LL const MOD = 998244353;

/*

 #https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_d
 D - Lucky PIN

 Easy problem, but python version gives TLE in the last two cases
 */

int H, W, A, B;

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("/Users/georgeli/A_1.in", "r", stdin);

	cin >> H >> W >> A >> B;

	LP(i, 0, B)
	{
		LP(j, 0, A)
			cout << "0";

		LP(j, A, W)
			cout << "1";
		cout << endl;
	}

	LP(i, B, H)
	{
		LP(j, 0, A)
			cout << "1";

		LP(j, A, W)
			cout << "0";
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 1280
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def h(m):
    sm = 0
    for j in range(m+1):
        sm += max(b[j],n-b[j]) * 2**j
    return sm

def g(k,m):
    if m<0:
        return 0
    if k<2**m:
        return 2**m * b[m] + g(k,m-1)
    return max(2**m * b[m] + h(m-1), \
               2**m * (n-b[m]) + g(k-2**m, m-1))

n,k = inm()
a = inl()
b = [0]*40
for i in range(n):
    for j in range(40):
        b[j] += (a[i]>>j)%2
print(g(k,39))


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

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

	vector<int> arr(n);
    ll mn = 1e10;
	int cnt = 0;
	ll res = 0;
	for(int i = 0; i < n; i++){
		ll t;cin>>t;
		if(t<0){
			cnt++;
			mn = min(mn,abs(t));
			res+=abs(t); 
		} else {
			res+=t;
			mn = min(mn,t);
		}
	}
	
	if(cnt%2) cout<<ll(res-2*mn);
	else cout<<res;
}

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

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

use std::cmp::max;

fn main() {
    let n: usize = read();
    let a: Vec<u8> = read_vec();
    let mut b: Vec<bool> = vec![false; n];
    let mut cnt: u32 = 0;
    for i in (0..a.len()).rev() {
        let mut j: usize = 2;
        let mut tmp: u32 = 0;
        while (i + 1) * j - 1 < n {
            if b[(i + 1) * j - 1] {
                tmp += 1;
            }
            j += 1;
        }
        if (tmp + (a[i] as u32)) % 2 == 1 {
            b[i] = true;
            cnt += 1;
        }
    }
    println!("{}", cnt);
    let mut id: usize = 0;
    if cnt > 0 {
        while id < n {
            if b[id] {
                print!("{}", id + 1);
                cnt -= 1;
            }
            id += 1;
            if cnt == 0 {
                println!("");
                break;
            } else {
                print!(" ");
            }
        }
    }
}


Measured memory_bytes: 5244
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


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

    REP(i,N+1) {
        REP(j,M+1) {
            auto open = (N*M) - ((i*M)+(j*N))+(i*j)*2;
            if (K==open || ((N*M)-open)==K) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

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

        int N = sc.nextInt();
        int X = sc.nextInt();

        int[] x = new int[N];
        for (int i = 0; i < N; i++) {
            x[i] = sc.nextInt();
        }

        int[] distances = new int[N];
        for (int i = 0; i < N; i++) {
            if (x[i] >= X) {
                distances[i] = x[i] - X;
            } else {
                distances[i] = X - x[i];
            }
        }

        int ret = distances[0];
        for (int i = 1; i < N; i++) {
            ret = gcd(ret, distances[i]);
        }

        System.out.println(ret);
    }

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


Measured memory_bytes: 50204
#include <bits/stdc++.h>
using namespace std;
int main() {
  int h,w; cin>>h>>w;
  char s[h+2][w+2];
  int dx[4]={1,0,-1,0};
  int dy[4]={0,-1,0,1};
  for(int x=0;x<w+2;x++) s[0][x]='.',s[h+1][0]='.';
  for(int y=0;y<h+2;y++) s[y][0]='.',s[y][w+1]='.';
  for(int y=1;y<h+1;y++) for(int x=1;x<w+1;x++) cin>>s[y][x];
  for(int y=1;y<h+1;y++) for(int x=1;x<w+1;x++){
    if(s[y][x]=='#'){
      bool f=false;
      for(int i=0;i<4;i++) if(s[y+dy[i]][x+dx[i]]=='#') f=true;
      if(!f){cout<<"No"; return 0;}
    }
  }
  cout<<"Yes";
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#include <stdlib.h>
#include <stdio.h>
#define f first
#define s second
#define inf 1e18
#define ll long long
#define mod 1000000007
#define pb emplace_back
#define vll vector<long long>
#define ull unsigned long long
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) ((long long)(x).size())
#define mll map<long long, long long>
#define pll pair<long long, long long>
using namespace std;

ll n, d;

void input(){
	cin >> n >> d;
}

void solve(){
	ll ans = 0;
	while(n--){
		ll x,y;
		cin >> x >> y;
		ll D = x*x + y*y;
		if(D <= d*d)ans++; 
	}
	cout<<ans;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(20);
	ll t;
	t = 1;
	//cin >> t;
	while(t--){
		input();
		solve();
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int W = scanner.nextInt();
        int H = scanner.nextInt();
        int x = scanner.nextInt();
        int y = scanner.nextInt();
        int r = scanner.nextInt();

        if (0 < W && 0 < H && 0 < r && 100 >= W && 100 >= H && 100 >= r && x >= 0 && y >= 0 && x >= -100 && 100 >= x && y >= -100 && 100 >= y && W - x - r >= 0 && W >= r + x && H - y - r >= 0 && H >= y + r) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}

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

ll calc(ll n, ll m, vector<ll> xs, vector<ll> ys, vector<ll> zs, bool px, bool py, bool pz) {
  vector<ll> a(n,0);
  if(px) {
    rep(i,n) a[i]+=xs[i];
  } else {
    rep(i,n) a[i]-=xs[i];
  }
  if(py) rep(i,n) a[i]+=ys[i];
  else rep(i,n) a[i]-=ys[i];
  if(pz) rep(i,n) a[i]+=zs[i];
  else rep(i,n) a[i]-=zs[i];
  vector<pair<ll, int> > p(n);
  rep(i,n) p[i] = make_pair(a[i],i);
  sort(p.begin(),p.end());
  ll x = 0;
  ll y = 0;
  ll z = 0;
  for(int i=n-1; i>=0&&m>0; i--) {
    x += xs[p[i].second];
    y += ys[p[i].second];
    z += zs[p[i].second];
    m--;
  }
  return abs(x)+abs(z)+abs(y);
}

int main() {
  ll n,m; cin >> n >> m;
  vector<ll> xs(n);
  vector<ll> ys(n);
  vector<ll> zs(n);
  rep(i, n) cin >> xs[i] >> ys[i] >> zs[i];
  vector<bool> bs = {true, false};
  ll ans=0;
  for(auto b1 : bs) {
    for(auto b2 : bs) {
      for(auto b3 : bs) {
	ans = max(ans, calc(n,m,xs,ys,zs,b1,b2,b3));
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

ll calc(ll x,ll y){
	if(y == 0){
		return x;
	}else{
		return calc(y,x%y);
	}
}

int main(){

	ll N,POW[70];

	POW[0] = 1;
	POW[1] = 2;
	for(int i = 2; i <= 69; i++){
		POW[i] = POW[i-1]*2;
	}

	scanf("%lld",&N);

	for(int i = 0; i <= 69; i++){
		if(POW[i]-1 == N){
			printf("%lld\n",N+1);
			return 0;
		}
	}

	if(N%2 == 0){
		printf("1\n");
		return 0;
	}

	vector<ll> bunshi;

	bunshi.push_back(N);

	ll tmp,common;

	for(ll m = 2; ;m *= 2){

		ll tmp = N-(m-1);

		if(tmp >= m){
			common = calc(tmp,m);
		}else{
			common = calc(m,tmp);
		}

		tmp /= common;

		if(tmp%2 == 0){
			printf("%lld\n",m);
			return 0;
		}

	}

	printf("%lld\n",N+1);

	return 0;
}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, bool> PIB;
typedef vector<int> VI;
typedef VI::iterator VII;
const int INF = 2e9;

int n, m, ans;
int k[160];
int x[160][10];
int d[160][10];
int dp[160][80][10];

int main()
{
  while(true){
    scanf("%d%d", &n, &m);
    if(!n && !m)
      break;

    for(int i1 = 1; i1 <= n; i1++){
      scanf("%d", &k[i1]);
      for(int i3 = 0; i3 < k[i1]; i3++)
	scanf("%d%d", &x[i1][i3], &d[i1][i3]);
    }
    
    for(int i1 = 1; i1 <= n; i1++)
      for(int i2 = 0; i2 <= m; i2++)
	for(int i3 = 0; i3 < 10; i3++)
	  dp[i1][i2][i3] = INF;
    ans = INF;

    for(int i3 = 0; i3 < k[1]; i3++)
      dp[1][0][i3] = 0;
    for(int i3 = 0; i3 < k[2]; i3++)
      dp[2][1][i3] = 0;

    for(int i1 = 2; i1 <= n; i1++)
      for(int i2 = 0; i2 <= n / 2; i2++){
	for(int i3 = 0; i3 < k[i1]; i3++)
	  for(int i4 = 0; i4 < k[i1 - 1]; i4++)
	    dp[i1][i2][i3] = min(dp[i1][i2][i3], dp[i1 - 1][i2][i4] + abs(x[i1][i3] - x[i1 - 1][i4]) * (d[i1][i3] + d[i1 - 1][i4]));

	if(i2 > 0 && i1 > 2)
	  for(int i3 = 0; i3 < k[i1]; i3++)
	    for(int i4 = 0; i4 < k[i1 - 2]; i4++)
	      dp[i1][i2][i3] = min(dp[i1][i2][i3], dp[i1 - 2][i2 - 1][i4] + abs(x[i1][i3] - x[i1 - 2][i4]) * (d[i1][i3] + d[i1 - 2][i4]));
      }

    for(int i2 = 0; i2 <= m; i2++)
      for(int i3 = 0; i3 < k[n]; i3++)
	ans = min(ans, dp[n][i2][i3]);
    for(int i2 = 0; i2 < m; i2++)
      for(int i3 = 0; i3 < k[n - 1]; i3++)
	ans = min(ans, dp[n - 1][i2][i3]);
    
    printf("%d\n", ans);
  }
    
  return 0;
}

Measured memory_bytes: 1680
#define NOT_FOUND 20000

#include <stdio.h>

//????????????????????£?¨?.
int linearSearch(int key, int *t, int n);

int main(void) {
	int s[10001] = {};
	int t[501] = {};
	int n = 0;
	int q = 0;
	int k = 0;				//?????´????????°.
	int i = 0;
	int j = 0;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &s[i]);

	scanf("%d", &q);
	for (i = 0; i < q; i++)
		scanf("%d", &t[i]);

	for (i = 0; i < q; i++) {
		if (linearSearch(t[i], s, n) != NOT_FOUND)
			k++;
	}

	printf("%d\n", k);

	return 0;
}

//key?????¢?´¢.
int linearSearch(int key, int *s, int n) {
	int i = 0;

	s[n] = key;

	while (s[i] != key) {
		i++;
	}

	if (i == n)
		return NOT_FOUND;

	return i;
}

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

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

  map <string, int> mp_n;

  // 青いカードの文字列をmapに挿入していく
  for(int i = 0; i < n; ++i){
    string str;
    cin >> str;
    if(mp_n.count(str) == 0) mp_n[str] = 1;
    else ++mp_n[str];
  }

  int m;
  cin >> m;

  for(int j = 0; j < m; ++j){
    string str;
    cin >> str;
    if(mp_n.count(str) == 0) mp_n[str] = -1;
    else --mp_n[str]; // 青いカードにも含まれる文字列の時
  }

  // 一番大きいvalueのindexを求めればよい
  int maxi = 0;
  for(auto k : mp_n){
    if(maxi < k.second) maxi = k.second;
  }

  cout << maxi << endl;

  return 0;
  
}


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(1) == s.at(2)) || s.at(0) == s.at(2))
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  
}

Measured memory_bytes: 384
import java.io.*;
import java.util.*;


public class Main {
    static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
    static BufferedReader cin  = new BufferedReader(new InputStreamReader(System.in));
    static int[][] arr ;
    static int n, m;

    public static void main(String[] args) throws IOException {
        int n = Integer.parseInt(cin.readLine());
        Object[][] orders = new Object[n][3];
        for (int i = 0; i < n; i++){
            String[] strs = cin.readLine().split(" ");
            String s = strs[0];
            int p = Integer.parseInt(strs[1]);
            orders[i] = new Object[]{s,p,i+1};
        }

        Arrays.sort(orders, new Comparator<Object[]>() {
            @Override
            public int compare(Object[] o1, Object[] o2) {
                if (((String)o1[0]).compareTo((String)o2[0]) < 0)
                    return -1;
                else if (((String)o1[0]).compareTo((String)o2[0]) > 0)
                    return 1;
                else
                    if((int)o1[1] > (int)o2[1])
                        return -1;
                    else
                        return 1;
            }
        });
        System.out.println();

        for (int i = 0; i < n; i++){
            System.out.println((int)orders[i][2]);
        }


    }


}

Measured memory_bytes: 19924
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int ki = 0; //最初が0
        int gu = 0; //最初が1
        string S;
        cin >> S;

        for (int i = 0; i < S.size(); ++i) {
            if (i % 2 == 0) {
                if (S[i] == '0') gu++;
                else ki++;
            } else {
                if (S[i] == '1') gu++;
                else ki++;
            }
        }

        int ans = min(ki, gu);
        cout << ans << endl;


    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 512
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)

long double L;

signed main(){
	cin >> L;
	cout << fixed << setprecision(16) << L*L*L/27.0 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct node{
  struct node *left;
  struct node *right;
  struct node *parent;
  int key;
};
struct node *T;
void Insert(int);
void Inorder(struct node*);
void Preorder(struct node*);
void Free(struct node*);
int main(){
  int n, i, key;
  char func[6];
  T = (struct node *)malloc(sizeof(struct node) * 1);
  T->parent = T->left = T->right = NULL;
  T->key = -1;
  scanf("%d",&n);
  for(i=0; i<n; i++){
    scanf("%s",&func);
    if(strcmp(func,"insert") == 0){
      scanf("%d",&key);
      Insert(key);
    }
    else if(strcmp(func,"print") == 0){
      Inorder(T);
      printf("\n");
      Preorder(T);
      printf("\n");
    }
  }
  Free(T);
  return 0;
}

void Inorder(struct node* X){
  if(X != NULL){
    Inorder(X->left);
    printf(" %d",X->key);
    Inorder(X->right);
  }
}

void Preorder(struct node* X){
  if(X != NULL){
    printf(" %d",X->key);
    Preorder(X->left);
    Preorder(X->right);
  }
}

void Free(struct node* X){
  if(X != NULL){
    Free(X->left);
    Free(X->right);
    free(X);
  }
}

void Insert(int key){
  struct node *x, *y, *S;
  if(T->key == -1){
    T->key = key;
    return;
  }
  S = (struct node *)malloc(sizeof(struct node) * 1);
  S->key = key;
  S->parent = S->left = S->right = NULL;
  x = T;
  while(x != NULL){
    y = x;
    if(key < x->key)
      x = x->left;
    else
      x = x->right;
  }
  S->parent = y;
  if(S->key < y->key)
    y->left = S;
  else
    y->right = S;
}

Measured memory_bytes: 24040
#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;
}


Measured memory_bytes: 3096
# -*- coding: utf-8 -*-
cds = {'a':list(input()), 'b':list(input()), 'c':list(input())}
player = 'a'
flg = True
while flg:
    if len(cds[player]) == 0:
        flg = False
        break
    else:
        val = cds[player][0]
        del cds[player][0]
        player = val

print(player.upper())


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

using namespace std;
typedef long long ll;
char s[4010];
struct sss{
    int R;
    int G;
    int B;
}h[4010];
int main()
{
    int n;
    scanf("%d",&n);
    scanf("%s",s);
    int r,g,b;
    r=g=b=0;
    for(int i=n-1;i>=0;i--){
        h[i].R=r;
        h[i].G=g;
        h[i].B=b;
        if(s[i]=='G')g++;
        if(s[i]=='R')r++;
        if(s[i]=='B')b++;
    }
    ll ans=0;

    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
                //cout<<ans<<endl;
            if(s[i]==s[j]) continue;
            //cout<<s[i]<<" "<<s[j]<<endl;
            if((s[i]=='R'&&s[j]=='G')||(s[i]=='G'&&s[j]=='R')){
                //B
              //  cout<<"HERE";
                ans+=h[j].B;
                if(j+j-i<n&&s[j+j-i]=='B') ans--;
            }
            if(s[i]=='R'&&s[j]=='B'||s[i]=='B'&&s[j]=='R'){
                //G
                ans+=h[j].G;
                if(j+j-i<n&&s[j+j-i]=='G') ans--;
            }
            if(s[i]=='B'&&s[j]=='G'||s[i]=='G'&&s[j]=='B'){
                //R
                ans+=h[j].R;
                if(j+j-i<n&&s[j+j-i]=='R') ans--;
            }
        }
    }
    printf("%lld\n",ans);
}



Measured memory_bytes: 3856
while True:
    s,p = list(map(int,input().split()))
    if s+p == 0:
        break
    sa = p-s
    a100 = 0
    a500 = 0
    a1000 = 0
    if sa != 0:
        a1000 = sa/1000
        sa = sa%1000
        a500 = sa/500
        sa = sa%500
        a100 = sa/100
    print(int(a100),int(a500),int(a1000))


Measured memory_bytes: 5616
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i,j,n) for (int i=(j); i < (n); i++)
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; }


int main() {
    int n; cin >> n;
    vector<ll> place(n+1); //各番号の位置を示す
    fo(i, 1, n+1){
        int a; cin >> a; place[a] = i; //数aはi番目に出現する
    }

    set<int> st{0, n+1};
    ll ans = 0;
    fo(i, 1, n+1){
        auto iter = st.lower_bound(place[i]);
        int r = *iter;
        int l = *(--iter);
        ans += i * (place[i] - l) * (r - place[i]);
        st.insert(place[i]);
    }
    cout << ans << ln;
}

    

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

using namespace std;

int N,W,value[101],weight[101],dp[101][10001];

int main(){
  cin>>N>>W;
  for(int i=0;i<N;i++){
    cin>>value[i]>>weight[i];
  }
  for(int i=0;i<N;++i){
    for(int w=0;w<=W;++w){
      if(w>=weight[i]){
        dp[i+1][w]=max(dp[i][w],dp[i+1][w-weight[i]]+value[i]);
      }else{
        dp[i+1][w]=dp[i][w];
      }
      }
    }
  cout<<dp[N][W]<<endl;
}


Measured memory_bytes: 6980
N, K = map(int, input().split( ))
list = []
for mem in range(N):
    list.append(0)


for shop in range(K):
    members = int(input())
    holder = input().split( )
    i=0
    for i in holder:
        list[int(i)-1] = 1
print(list.count(0))

Measured memory_bytes: 9188
#include <stdio.h>

int main(){
    int a, b, d, r;
    double f;
    scanf("%d %d", &a, &b);
    d=a/b;
    r=a%b;
    f=(double)a/(double)b;
    printf("%d %d %f\n", d, r, f);
    return 0;
}


Measured memory_bytes: 2140
#include <stdio.h>

int main(void)
{
	int a,b;
	
	scanf("%d %d",&a,&b);
	
	if(a<b){
		printf("a < b\n");
	}else if(a>b){
		printf("a > b\n");
	}else{
		printf("a == b\n");
	}
	
	return 0;
}


Measured memory_bytes: 2052
use proconio::{input, fastout};
use proconio::marker::Chars;

#[fastout]
fn main() {
    input! {
        s: Chars,
        t: Chars
    }
    let mut res = std::u32::MAX;
    for i in 0..s.len() - t.len() + 1 {
        let mut c = 0;
        for j in 0..t.len() {
            if s[i+j] != t[j] {
                c += 1;
            }
        }
        res = std::cmp::min(res, c);
    }
    println!("{}", res);
}


Measured memory_bytes: 2168
import Control.Monad

main :: IO ()
main = do
  [h, w] <- (map read . words) <$> getLine :: IO [Int]
  replicateM_ (w + 2) $ putStr "#"
  putStrLn ""
  replicateM_ h $ do
    putStr "#"
    getLine >>= putStr
    putStrLn "#"

  replicateM_ (w + 2) $ putStr "#"
  putStrLn ""


Measured memory_bytes: 1020
/* planet earth is blue, there is nothing left to do */
#include <bits/stdc++.h>
using namespace std;

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

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
 
/* Coding Space*/
struct Edge{
  int from,to,cost;
};
vector<Edge> G;
ll d[1001];
int n,m;
ll t_ans = 0;
bool BellmanFord(int s){
  rep(i,n) d[i] = LLINF;
  d[s] = 0;
  for(int x = 0;; x++){
    bool update = false;
    rep(i,m){
      Edge e = G[i];
      if(d[e.from] != LLINF && d[e.to] > d[e.from] + e.cost){
        d[e.to] = d[e.from] + e.cost;
        update = true;
      }
    }
    if(!update) break;
    if(x == 1001){
      t_ans = d[n-1];
    }else if(x == 2002){
      if(t_ans == d[n-1])
        return false;
      else
        return true;
    }
  }
  return false;
}

int main(){
  cin >> n >> m;
  G.resize(m);
  rep(i,m){
    int a,b,c; cin >> a >> b >> c;
    a--,b--;
    G[i] = Edge{a,b,-c};
  }
  if(BellmanFord(0)){
    cout << "inf" << endl;
  }else{
    cout << -d[n-1] << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define prin(num) cout << num << endl
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define mp make_pair
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 150005
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

ll modpow(ll x, ll n) {
    ll res=1;
    while(n>0) {
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}

int main(void) {
    string s;
    cin >> s;
    ll i;
    ll ans=INF;
    
    for(i=0; i<s.size()-2; i++) {
        ll tmp=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
        ans=min(ans, abs(tmp-753));
        
    }
    
    prin(ans);
    
}

Measured memory_bytes: 256
#include <iostream>
 
int main()
{
  int A, B, C, K, ans;
  std::cin >> A >> B >> C >> K;
 
  if (A >= K)
  {
    ans = K;
  }
  else
  { // A < K
    if (A + B >= K)
    {
      ans = A;
    }
    else // A+B < K, K-(A+B) cards from C
    {
      ans = A - (K - (A + B));
    }
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 3604
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

n = INT()
a = LIST()
arr = [0 for _ in range(n)]
arr[0] = a[0]
for i in range(1, n):
    arr[i] = arr[i - 1] + a[i]
s = arr[-1]
mn = inf
for i in range(n):
    mn = min(mn, abs(s / 2 - arr[i]))
print(int(mn * 2))

Measured memory_bytes: 112404
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = a[:]
ini = sum(c)
for i in range(n):
  if a[i] < b[i]:
    b[i] -= a[i]
    a[i] = 0   
  else:
    a[i] -= b[i]
    b[i] = 0
  

  if a[i+1] < b[i]:
    a[i+1] = 0
  else:
    a[i+1] -= b[i]

print(ini-sum(a))

Measured memory_bytes: 18436
#include<cstdio>

int n;
char x[200005];

int popcount(int x) {
  if (x == 0) {
    return 0;
  }
  if (x % 2 == 0) {
    return popcount(x / 2);
  } else {
    return popcount(x / 2) + 1;
  }
}

int f(int s) {
  int t = 1;
  while (s) {
    s %= popcount(s);
    t++;
  }
  return t;
}

int pow(int x, int y, int z) {
  if (y == 0) {
    return 1;
  }
  if (y % 2 == 0) {
    return pow(1ll * x * x % z, y / 2, z) % z;
  } else {
    return 1ll * x * pow(x, y - 1, z) % z;
  }
}

int main() {
  scanf("%d", &n);
  scanf("%s", x);
  int pc = 0;
  for (int i = 0; x[i]; i++) {
    if (x[i] == '1') {
      pc++;
    }
  }
  int res_p = 0;
  int res_m = 0;
  for (int i = 0; x[i]; i++) {
    res_p = (res_p * 2 + (x[i] - '0')) % (pc + 1);
    if (pc != 1) res_m = (res_m * 2 + (x[i] - '0')) % (pc - 1);
  }
  for (int i = 0; i < n; i++) {
    int pc_n = x[i] == '0' ? pc + 1 : pc - 1;
    if (pc_n == 0) {
      printf("0\n");
      continue;
    }
    int diff = pow(2, n - i - 1, pc_n);
    int res;
    if (x[i] == '0') {
      res = res_p + diff;
    } else {
      res = res_m - diff;
    }
    res = ((res % pc_n) + pc_n) % pc_n;
    printf("%d\n", f(res));
  }
}


Measured memory_bytes: 1920
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

template<typename T>T&get(){T a;cin >> a;return a;}
template<typename T>T&rev(T&a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>a){sort(all(a));return a;}

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int inf = 1e9;
const ll linf = 3e18;

struct edge {
    int to, cost, time;
    edge(int to0,int cost0,int time0) {
        to = to0; cost = cost0; time = time0;
    };
};

int N, M;

vector<edge> G[100];
int d[100];

void dijkstra(int s, int mode)
{
    priority_queue<pii, vector<pii>, greater<pii> > q;

    fill(d, d + M, inf);
    d[s] = 0;

    q.push(MP(0, s));

    while (q.size()) {
        pii p = q.top(); q.pop();
        int v = p.scd;
        rep(u, G[v].size()) {
            edge e = G[v][u];
            int a = mode == 0 ? e.cost : e.time;
            if (d[e.to] > d[v] + a) {
                d[e.to] = d[v] + a;
                q.push(MP(d[e.to], e.to));
            }
        }
    }
}

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

    while (cin >> N >> M, N || M) {
        rep(i, M) G[i].clear();

        rep(i, N) {
            int a, b, cost, time; cin >> a >> b >> cost >> time; a--; b--;
            G[a].PB(edge(b, cost, time));
            G[b].PB(edge(a, cost, time));
        }

        int K; cin >> K;

        rep(i, K) {
            int p, q, r; cin >> p >> q >> r; p--; q--;
            dijkstra(p, r);
            cout << d[q] << endl;
        }
    }
}

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

int main(){
    int a, b, c;
    cin >> a >> b;
    c = (a+b)/2;
    if(abs(a-c) == abs(b-c)){
        cout << c << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
(defmacro defsolver (name vars &body body)
  `(defun ,name ()
     (let (,@(mapcar #'list
            vars
            (mapcar (constantly '(read))
                vars)))
       ,@body)))

(defsolver solution-c (n m)
  (let ((maxl 0) (minr 1000000))
    (dotimes (i m 0)
      (let ((l (read))
	    (r (read)))
	(if (< maxl l)
	    (setf maxl l))
	(if (> minr r)
	    (setf minr r))))
    (format t "~a~%"
	    (let ((diff (- minr maxl)))
	      (if (>= diff 0)
		  (1+ diff)
		  0)))))

(solution-c)

Measured memory_bytes: 57828
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()
	A := getInt()
	x := make([]int, N)
	for i := 0; i < N; i++ {
		x[i] = getInt()
	}

	var dp [51][51][2601]int

	dp[0][0][0] = 1
	for i := 0; i < N; i++ {
		for j := 0; j < N; j++ {
			for k := 0; k < 2500; k++ {
				dp[i+1][j][k] += dp[i][j][k]
				dp[i+1][j+1][k+x[i]] += dp[i][j][k]
			}
		}
	}

	ans := 0
	for i := 1; i <= N; i++ {
		ans += dp[N][i][A*i]
	}
	out(ans)
}


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

ll solve() {
    string S, T;
    cin >> S >> T;
    ll ans = 0;
    for ( int i = 0; i < 3; i++ ) {
        if ( S[i] == T[i] ) ans++;
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	
	static boolean isPrime(int x){
		
		for(int i=2;i<=Math.sqrt(x);i++)
			if(x%i==0)return false;
		
		return true;
	}
	
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		
		int n=scan.nextInt();
		int cnt=0;
		for(int i=0;i<n;i++){
			int x=scan.nextInt();
			if(isPrime(x))
				cnt++;
		}
		
		System.out.println(cnt);
		
	}
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll A,B,C;
ll i,j,ans;
int main(){
    scanf("%lld%lld", &A, &B);
    ans = A + B;
    C = A - B;
    if(ans<C){
        ans = C;
    }
    C = A * B;
    if(ans<C){
        ans = C;
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 256
S = input()
N = len(S)
ans = [0]*N

cnt = 0
for i in range(N) :
    if S[i] == "R" :
        cnt += 1

    elif cnt % 2 == 0 :
        ans[i] += cnt//2
        ans[i-1] += cnt//2
        cnt = 0
    else :
        ans[i] += cnt//2
        ans[i-1] += cnt//2 + 1
        cnt = 0
cnt = 0
for i in range(N-1,-1,-1) :
    if S[i] == "L" :
        cnt += 1
    
    elif cnt % 2 == 0 :
        ans[i] += cnt//2
        ans[i+1] += cnt//2
        cnt = 0
    else :
        ans[i] += cnt//2
        ans[i+1] += cnt//2 + 1
        cnt = 0
print(*ans)


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

int main() {
    int a, b;
    cin >> a >> b;
    
    int r = 0;
    for (int i = a; i <= b; i++) {
       int k1 = i % 10, k5 = i / 10000;
       int k2 = i % 100 / 10, k4 = i % 10000 / 1000;
       if (k1 == k5 && k2 == k4) {
           r++;
       }
    }
    
    cout << r <<endl;
}

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

int main(){
    string s ="Sunny", c = "Cloudy", r = "Rainy";
    string S;
    cin >> S;
    if(S == s) cout << c << endl;
    else if(S == c) cout << r << endl;
    else if(S == r) cout << s << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;

bool possible(int b, int M, const vi &v)
{
	b *= 2;
	for(int i=b, j=v.size()-1; i<j; i++, j--)
	{
		if(v[i]+v[j] < M)
			return false;
	}
	return true;
}

int maxZ(int b, int M, const vi &v)
{
	b *= 2;
	int mx = -1;
	for(int i=0, j=b-1; i<j; i++, j--)
	{
		mx = max(mx,v[i]+v[j]);
	}
	for(int i=b, j=v.size()-1; i<j; i++, j--)
	{
		mx = max(mx,v[i]+v[j]-M);
	}
	return mx;
}

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

	int n, M;
	while(cin >> n >> M)
	{
		vi v(2*n);
		for(int i=0; i<v.size(); i++)
		{
			cin >> v[i];
		}
		sort(v.begin(),v.end());

		int lo = 0, hi = n;
		while(lo < hi-1)
		{
			int mid = (lo+hi)/2;
			if(possible(mid,M,v))
				hi = mid;
			else 
				lo = mid+1;
		}

		if(possible(lo,M,v))
			cout << maxZ(lo,M,v) << endl;
		else
			cout << maxZ(hi,M,v) << endl;
	}

	return 0;
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

int n;
vi g[1000];
vi x(1000);

int dfs(int v)
{
	vvi dp(2, vi(x[v]+1));
	int cur = 0, tar = 1;
	fill(all(dp[cur]), inf);
	dp[cur][0] = 0;

	for(int to : g[v]){
		fill(all(dp[tar]), inf);
		int w = dfs(to);
		int b = x[to];
		rep(i, 0, x[v]+1){
			if(dp[cur][i] != inf){
				if(i+w <= x[v]) chmin(dp[tar][i+w], dp[cur][i] + b);
				if(i+b <= x[v]) chmin(dp[tar][i+b], dp[cur][i] + w);
			}
		}
		cur ^= 1, tar ^= 1;
	}

	int res = inf;
	rep(i, 0, dp[cur].size()){
		chmin(res, dp[cur][i]);
	}
	return res;
}

signed main()
{
	cin >> n;
	rep(i, 1, n){
		int p;
		cin >> p;
		g[--p].pb(i);
	}
	rep(i, 0, n) cin >> x[i];

	cout << (dfs(0) != inf ? "POSSIBLE" : "IMPOSSIBLE") << endl;

	return 0;
}


Measured memory_bytes: 22100
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}


int main(){
    ll x;
    cin >> x;
    ll i;
    for(i=0;i*(i+1)/2<x;++i);
    put(i);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int n;
    cin>>n;
    vector<int> l(n);
    rep(i,n) cin>>l[i];
    int m=0;
    rep(i,n-1){
        if(l[m]<l[i+1]) m=i+1;
    }
    int a=0;
    rep(i,n){
        if(i==m) continue;
        a+=l[i];
    }
    if(a>l[m]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream> 
using namespace std; 
int main(){ 
	int n; 
	cin>>n;  
	int a[n]; 
 	for(int i=0;i<n;i++)cin>>a[i]; 
 	int f,c=0; 
 	do{  	 
		f = 0; 
 	 	for(int i=0; i<n; i++){ 
 	 	if(a[i]%2==0){  	 	 	 	
			a[i]=a[i]/2; 
		} 
	else{  	 	 	 	
		f = 1;  	 	 
		break; 
	} 
 	 	} 
 		if(f==0)c++; 
 	 }while(f==0); 
	cout<<c; 
	return 0; 
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

int main() {

  int a, b;
  cin >> a >> b;
  cout << ((a*b)%2 == 1 ? "Yes" : "No") << endl;

  return 0;
}



//


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] b = new int[n - 1];
        
        for (int i = 0; i < n - 1; i++) {
            b[i] = sc.nextInt();
        }
        
        int sum = 0;
        sum += b[0] + b[n - 2];
        for (int i = 1; i < n - 1; i++) {
            sum += Math.min(b[i - 1], b[i]);
        }
        System.out.println(sum);
    }
}


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

using namespace std;

int main() {

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

	string n;
	cin >> n;
	cout << (n == "ABC" ? "ARC" : "ABC");
	cout << '\n';
	return 0;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
int cnt[100000];
int main() {
	int N, K, Q;
	cin >> N >> K >> Q;
	for (int i = 0; i < Q; i++) {
		int A;
		cin >> A;
		A--;
		cnt[A]++;
	}
	for (int i = 0; i < N; i++) {
		if (K - (Q - cnt[i]) > 0) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 1024
#include<stdio.h>
int main() 
{ 
    int A,B;
    scanf("%d %d", &A,&B);
    if(A == 1)
        A = 14;
    if(B == 1)
        B = 14;
    if(A > B){
        printf("Alice\n");
    }
    else if(A < B){
        printf("Bob\n");
    }
    else{
        printf("Draw\n");
    }
    return 0; 
}

Measured memory_bytes: 128
//                                 Alisher_2211
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        # include <bits/stdc++.h>
# define  long          long long
# define  all(vc)       vc.begin(),vc.end()
# define  allr(vc)      vc.rbegin(),vc.rend()
# define  pb            push_back
# define  fi            first 
# define  se            second
# define  pi            pair <long, long>    
# define  lcm(a, b)     (a * b) / __gcd(a, b)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        using namespace std;
const long N = 100100;
void read(){freopen("input.txt" , "r" , stdin );freopen("output.txt", "w" , stdout );}
void solve(){
    long n;
    cin >> n;
    vector <long> v(n);
    for(auto &i: v){
        cin >> i;
        if( !i ){
            cout << 0;
            return;
        }
    }
    long ans = 1;
    for (int i = 0; i < n; ++i){
        if( ans > 1000000000000000000 / v[i] ){
            cout << -1;
            return;
        }
        ans *= v[i];
    }
    cout << ans;
}
int32_t main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); 
        long T = 1;
        //cin >> T;
        while( T-- ){
            solve();
            cout<<'\n';
        }
cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}

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

signed main() {
	int l,r,m=2019,ans,s,t;
	cin>>l>>r;
	for(int i=l;i<r;i++)
	{
		for(int j=i+1;j<=r;j++)
		{
			 s=i%2019;
			 t=j%2019;
			ans=(s*t)%2019;
			m=min(ans,m);
			if(m==0)break;
		}
		if(m==0)break;
	}
	cout<<m;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define eps 1e-10

typedef struct line{
	ll x1,y1;
	ll x2,y2;
}L;

int sgn(ll x){return x<0?-1:x>0;}

int iscloss(L s,L t){
	//点(p,q)が直線f(x,y)=ax+by+c=0のどっち側にあるかはf(p,q)を見ればよい
	//点(x1,y1),(x2,y2)を結ぶ直線の式は(y2-y1)*(x-x1)+(x2-x1)*(y1-y)=0
	ll t1=(s.y2-s.y1)*(t.x1-s.x1)+(s.x2-s.x1)*(s.y1-t.y1);
	ll t2=(s.y2-s.y1)*(t.x2-s.x1)+(s.x2-s.x1)*(s.y1-t.y2);
	ll t3=(t.y2-t.y1)*(s.x1-t.x1)+(t.x2-t.x1)*(t.y1-s.y1);
	ll t4=(t.y2-t.y1)*(s.x2-t.x1)+(t.x2-t.x1)*(t.y1-s.y2);
	//2線分が同一直線上になく、かつ、共有点があればtrue
	//（同一直線上にある2線分が共有点を持ってもfalseが返るので注意）
	return sgn(t1)!=sgn(t2) && sgn(t3)!=sgn(t4);
}

double calcx,calcy;
void calc(L s,L t){
	//交点は、線分tを|t1|:|t2|に内分する点
	ll t1=(s.y2-s.y1)*(t.x1-s.x1)+(s.x2-s.x1)*(s.y1-t.y1);
	ll t2=(s.y2-s.y1)*(t.x2-s.x1)+(s.x2-s.x1)*(s.y1-t.y2);
	t1=llabs(t1);
	t2=llabs(t2);
	calcx=t.x1+(double)(t.x2-t.x1)*t1/(t1+t2);
	calcy=t.y1+(double)(t.y2-t.y1)*t1/(t1+t2);
}

L s,t;
double x[200],y[200];
int st[200];
int idx[200];

int main(){
	int q;
	scanf("%d",&q);
	
	while(q--){
		scanf("%lld%lld%lld%lld",&s.x1,&s.y1,&s.x2,&s.y2);
		int cnt=0;
		int n;
		scanf("%d",&n);
		rep(i,1,n+1){
			int a,b;
			scanf("%lld%lld%lld%lld%lld%lld",&t.x1,&t.y1,&t.x2,&t.y2,&a,&b);
			if(iscloss(s,t)){
				calc(s,t);
				x[cnt]=calcx;
				y[cnt]=calcy;
				st[cnt]=a^b;
				idx[cnt]=cnt;
				cnt++;
			}
		}
		//ソート
		rep(i,0,cnt)rep(j,0,cnt-1){
			if(x[idx[j]]>x[idx[j+1]]+eps || (fabs(x[idx[j]]-x[idx[j+1]])<eps&&y[idx[j]]>y[idx[j+1]]+eps)){
				int temp=idx[j];
				idx[j]=idx[j+1];
				idx[j+1]=temp;
			}
		}
		int ans=0,crr=st[idx[0]];
		rep(i,1,cnt)if(st[idx[i-1]]!=st[idx[i]])ans++;
		printf("%d\n",ans);
	}
}


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

#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed fixed<<setprecision(14)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
const lol inf=(1LL<<60);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
lol n,m,k,r;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>n;
  vector<long double> a(n);
  for(int i=0;i<n;i++) cin >>a[i];
  long double p=1e18;
  sort(a.begin(),a.end());
  long double sum=1;
  for(int i=0;i<n;i++){
    sum*=a[i];
    if(sum>p){
      cout <<"-1\n";
      return 0;
    }
  }
  cout<<(long long)sum<<'\n';
  return (0);
}

Measured memory_bytes: 4756