akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
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() {
	
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	
	int x, y; cin >> x >> y;
	
//vector<int> a(n); rep(i,n) cin >> a[i];
//	sort(all(a));


	
	
	string ans = "No";
	
	if(2*x <= y && y <=4*x && y%2==0) ans = "Yes";
	
	cout << ans << endl;
	
	return 0;
}


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

int main(){
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  vector<string> use = {"0", "1", "2", "3"};
  queue<string> Q;
  for(int i=0; i<4; i++){
    Q.push(use.at(i));
  }
  for(int i=0; i<N-1; i++){
    int x = Q.size();
    int cnt = 0;
    while(cnt < x){
      string S = Q.front();
      Q.pop();
      for(int j=0; j<4; j++){
        string T = S + use.at(j);
        Q.push(T);
      }
      cnt++;
    }
  }
  
  int x = Q.size();
  int64_t ans = 10000000000000;
  for(int i=0; i<x; i++){
    string S = Q.front();
    int64_t cost = 0;
    int64_t one = 0;
    int64_t two = 0;
    int64_t three = 0;
    for(int j=0; j<N; j++){
      if(S.at(j) == '1'){
        if(one != 0){
          cost += 10;
        }
        one += vec.at(j);
      }
      if(S.at(j) == '2'){
        if(two != 0){
          cost += 10;
        }
        two += vec.at(j);
      }
      if(S.at(j) == '3'){
        if(three != 0){
          cost += 10;
        }
        three += vec.at(j);
      }
    }
    if(one != 0 && two != 0 && three != 0){
      cost += abs(A-one) + abs(B-two) + abs(C-three);
      ans = min(ans,cost);
    }
    Q.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 3840
const main = function(arg) {
    var input = arg.trim().split("\n");
    var nums = input[1].trim().split(" ");
    var go = true
    var count = 0
    while(go){
        for(var i =0;i< nums.length; i++) {
            num = parseInt(nums[i])
            if(num%2!=0){
                go = false 
            }
            nums[i] = num/2
        }
        if(go) count ++
    }
    console.log(count)
}
main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
num = []

for k in range(5):
  num.append(int(input()))

k = int(input())

bool = True

for i in range(4,0,-1):
  for j in range(i):
    if (num[i] - num[j]) > k:
      bool = False
    else:
      continue
    break
    
if bool:
  print("Yay!")
else:
  print(":(")

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            int takahashiAge = Integer.parseInt(br.readLine());
            Set<Integer> sevenAndFiveAndThree = new HashSet<>();
            sevenAndFiveAndThree.add(3);
            sevenAndFiveAndThree.add(5);
            sevenAndFiveAndThree.add(7);

            String canCelebrate = "NO";
            if (sevenAndFiveAndThree.contains(takahashiAge)) {
                canCelebrate = "YES";
            }

            System.out.println(canCelebrate);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 23252
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        try (Scanner s = new Scanner(System.in)) {
            long x = s.nextLong();
            long c = 100;
            int count = 0;
            while (c < x) {
                c += c / 100;
                count++;
            }
            System.out.println(count);
        }
    }
}

Measured memory_bytes: 35760
using System;

namespace CompetitiveProg
{
    class Program
    {
        static void Main(string[] args)
		{
			var n = int.Parse(Console.ReadLine());

			for (var i = 1; i < 10; i++)
			for (var j = 1; j < 10; j++)
			{
				if (i * j == n)
				{
					Console.WriteLine("Yes");
					return;
				}
			}

			Console.WriteLine("No");
		}
	}
}


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

#define MN 1001000
#define MOD 1000000007

using namespace std;
typedef long long ll;

ll n, ans, a[MN], dp[MN], last[MN];

int main() {
    memset(last, -1, sizeof last);
    scanf("%lld", &n);

    for(int i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
    }

    dp[n] = 1;
    for(int i = n-1; i >= 0; i--) {
        dp[i] = dp[i+1];
        if(last[a[i]] > i + 1) {
            dp[i] += dp[last[a[i]]];
            if(dp[i] >= MOD) dp[i] -= MOD;
        }
        last[a[i]] = i;
    }

    printf("%lld\n", dp[0]);
    return 0;
}


Measured memory_bytes: 14592
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#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 ALL(v) (v).begin(),(v).end()
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; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    map<int,int> mp;
    ll ans=0;
    REP(i,n){
        int a;cin >> a;
        ans+=mp[i-a];
        mp[a+i]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 20616
#include <cstdio>
#include <cstdlib>

int main()
{
	int N;
	int t, x, y;
	int pt=0, px=0, py=0, wt, wx, wy;
	bool no=false;
	int i;
	
	scanf("%d", &N);
	
	for(i=0; i<N; i++)
	{
		scanf("%d %d %d", &t, &x, &y);
		
		wx = abs(x-px);
		wy = abs(y-py);
		wt = abs(t-pt);
		
		if(wt < wx+wy)
			no = true;
		
		if(wt % 2 != (wx+wy) % 2)
			no = true;
		
		px = x;
		py = y;
		pt = t;
	}
	
	if(no == false)
		puts("Yes");
	else
		puts("No");
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fr(i1,m) for(int i1=0;i1<m;i1++)
using namespace std;

int main()
{
    long  n;
    while(cin>>n)
    {
      string s;
      long m=0,p=0;
      cin>>s;
      fr(i,n)
      {
          if(s[i]=='I')
            p++;
          else
            p--;
          m=max(m,p);
      }
      cout<<m<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << endl;
typedef long long ll;
const int MAX = 999999999;

int main(){
    int x, a, b;
    cin >> x >> a >> b;

    x -= a;
    x %= b;

    cout << x << endl;
}

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

int main(void)
{
  int W, a, b;
  std::cin >> W >> a >> b;

  int move;
  if (b >= a && b <= a+W || b+W >= a && b+W <= a+W) {
    move = 0;
  }
  else {
    if (a < b) {
      move = std::abs(b - (a + W));
    }
    else if (a > b) {
      move = std::abs(a - (b + W));
    }
  }

  std::cout << move << std::endl;

  return 0;
}

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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    freopen ("in.txt", "r", stdin);
#endif
}


int main() {
    ll a,b;cin>>a>>b;
    a += b;
    if (a%2!=0) cout << "IMPOSSIBLE";
    else cout << a/2;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll ans = b * d;
	ans = max(ans, a * c);
	ans = max(ans, a * d);
	ans = max(ans, b * c);
	cout << ans << endl;
	return 0;
}

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

#define ll long long
#define endl "\n";
#define mod 1000000007
#define pii pair<int,int>
#define vii vector<pii>
#define mp make_pair
#define all(a) a.begin(), a.end()
#define mk(arr,n,type) type *arr=new type[n];

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

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

    mk(arr, n, ll);
    ll full_xor = 0;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        full_xor ^= arr[i];
    }

    for (int i = 0; i < n; i++) {
        cout << (arr[i]^full_xor) << " ";
    }

    return 0;
}


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

int main(){
    int R,G,B,N;
    cin >> R >> G >> B >> N;
    long count = 0;

    for(int r=0;r<=3000;r++){
        for(int g=0;g<=3000;g++){
            int brest = N - r*R - g*G;
            if(brest >= 0 && brest%B == 0){
                count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
A,B,C,D,E,F = list(map(int, input().split()))
maxdensity=0;
maxtotal=0;
maxsugar=0;

listwater = list()
for nA in range(30):
    for nB in range(15):
    	water = 100*(nA*A+nB*B)
    	if water == 0:
    		continue
    	if water <= F and (not water in listwater):
    		listwater.append(water)

listsugar = list()
for nC in range(3000):
    for nD in range(1500):
    	sugar = (nC*C+nD*D)
    	if sugar <= F/2 and (not sugar in listsugar):
    		listsugar.append(sugar)

listsugar.sort()
listwater.sort()

for i in range(len(listsugar)):
    for j in range(len(listwater)):
    	total = listsugar[i] + listwater[j]
    	sugar = listsugar[i]
    	if total == 0:
    		continue
    	if total <= F and sugar*100 <= E*(total-sugar):
    		if maxdensity*total < sugar:
    			maxdensity = float(sugar)/float(total)
    			maxtotal = total
    			maxsugar = sugar
    	
if maxtotal == 0:
	maxtotal = A*100
print(maxtotal,end=" ")
print(maxsugar)

Measured memory_bytes: 3188
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        ltmp: [i32; 2 *n],
    }
    let mut l = ltmp;
    l.sort();
    let mut current_count = 0;
    let mut total_count = 0;
    for (i, &li) in l.iter().enumerate() {
        if i % 2 == 0 {
            current_count = li;
            continue;
        } else {
            total_count += current_count;
        }
    }
    println!("{}", total_count);
}


Measured memory_bytes: 4352
/// Thank you tanakh!!!
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;

fn main() {
    input!(n: usize);

    let mut l: Vec<usize> = vec![0; n + 1];
    l[0] = 2;
    l[1] = 1;
    for i in 2..(n + 1) {
        l[i] = l[i - 1] + l[i - 2];
    }
    println!("{}", l[n]);
}


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


int main()
{
	double PI = acos(-1), a, b, C;
	cin >> a >> b >> C;
	C = C * PI / 180;
	printf("%.6f\n", a * b * sin(C) / 2);
	printf("%.6f\n", sqrt(a*a+b*b-2*a*b*cos(C))+a+b);
	printf("%.6f\n", b * sin(C)); 
	return 0;
}



Measured memory_bytes: 3560
n = int(input())
d,x = map(int,input().split())
a = [int(input()) for i in range(n)]
c = 0

for i in range(n):
  for j in range(1,101):
    tmp = j*a[i]+1
    if tmp > d:
      c += j
      break
      
      
print(c + x)

Measured memory_bytes: 3060
#include "iostream"
#include "string"
#include "algorithm"
using namespace std;
/*
struct dice {
	int s[6];
	void roll(char c) {
		int b;
		if (c == 'E') {
			b = s[0];
			s[0] = s[3];
			s[3] = s[5];
			s[5] = s[2];
			s[2] = b;
		}
		if (c == 'N') {
			b = s[0];
			s[0] = s[1];
			s[1] = s[5];
			s[5] = s[4];
			s[4] = b;
		}
		if (c == 'S') {
			b = s[0];
			s[0] = s[4];
			s[4] = s[5];
			s[5] = s[1];
			s[1] = b;
		}
		if (c == 'W') {
			b = s[0];
			s[0] = s[2];
			s[2] = s[5];
			s[5] = s[3];
			s[3] = b;
		}
		if (c == 'R') {
			b = s[1];
			s[1] = s[3];
			s[3] = s[4];
			s[4] = s[2];
			s[2] = b;
		}
	}
	int top() {
		return s[0];
	}
	int right() {
		return s[2];
	}
	int left() {
		return s[3];
	}
	int front() {
		return s[1];
	}

};

int main() {
	dice d;
	for (int i = 0; i < 6; i++) {
		cin >> d.s[i];
	}
	int order;
	cin >> order;
	while(order--) {
		int top, front;
		cin >> top >> front;
		if (d.left() == top) {
			d.roll('E');
		}
		if (d.right() == top) {
			d.roll('W');
		}
		while (d.top() != top) {
			d.roll('N');
		}
		while (d.front() != front) {
			d.roll('R');
		}
		cout << d.right() << endl;
	}
}
*/

int main() {
	int n, a[100];
	cin >> n;
	int oneCnt = 0, oneCntMax = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] == 1) {
			oneCnt++;
		}
		else {
			oneCnt = 0;
		}
		if (oneCnt > oneCntMax) {
			oneCntMax = oneCnt;
		}
	}
	cout << oneCntMax + 1 << endl;
}


Measured memory_bytes: 3112
input()
S=list(input())
ans=0
 
def index(x,l):
    if x in l:
        return l.index(x)
    else:
        return -1
 
for i in range(1000):
    s=list(str(i).zfill(3))
    if index(s[0],S) != -1:
        if index(s[1],S[S.index(s[0])+1:]) != -1:
            if index(s[2],S[S.index(s[0])+1:][S[S.index(s[0])+1:].index(s[1])+1:]) != -1:
                ans += 1
print(ans)

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

int main(){
    ll n, k;
    cin >> n >> k;
    set<ll> exist;
    ll minv = n;
    n = n%k;
    while(true){
        n = abs(n - k);
        minv = min(n, minv);
        if (exist.count(n) == 1) break;
        exist.insert(n);
    }
    cout << minv << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> C(300, vector<int>(4));

int main() {
	int n, W, D;
	while (cin >> n >> W >> D, n or W or D) {
		C[0][0] = -1;
		C[0][1] = W * D;
		C[0][2] = W;
		C[0][3] = D;
		for (int i = 0; i < n; i++) {
			int p, s;
			cin >> p >> s;
			int h = C[p - 1][3];
			int w = C[p - 1][2];
			int w2 = w, w3 = w, h2 = h, h3 = h;
			s = s % (2 * (h + w));
			if (s < w or (2 * w + h > s and w + h < s) ){
				if (s > w) s = s - w - h;
				w2 = s;
				w3 = w - s;
			}
			else {
				if (s > w + h) s = s - w - h;
				s -= w;
				h2 = s;
				h3 = h - s;
			}
			C[p - 1][0] = i; C[i + 1][0] = i;
			C[p - 1][1] = w2 * h2; C[i + 1][1] = w3 * h3;
			C[p - 1][2] = w2; C[i + 1][2] = w3;
			C[p - 1][3] = h2; C[i + 1][3] = h3;
			sort(C.begin(), C.begin() + i + 2, [](auto& x, auto& y) {return x[0] == y[0] ? x[1] < y[1] : x[0] < y[0]; });
			}
		for(int i = 0; i <= n; i++ ){
			swap(C[i][0], C[i][1]);
		}
		sort(C.begin(), C.begin() + n + 1, [](auto& x, auto& y) {return x[0] == y[0] ? x[1] < y[1] : x[0] < y[0]; });
		for (int i = 0; i <= n; i++) {
			if (i != n) {
				cout << C[i][0] << " ";
			}
			else {
				cout << C[i][0] << endl;
			}
		}

	}

}


Measured memory_bytes: 3088
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

int main()
{ 
    LL D;
    cin>>D;
    LL c[26];
    for(int i=0;i<26;i++){
        cin>>c[i];
    }
    LL s[D][26];
    for(int i=0;i<D;i++){
        for(int j=0;j<26;j++){
            cin>>s[i][j];
        }
    }
    LL t[D];
    for(int i=0;i<D;i++){
        cin>>t[i];
        t[i]--;
    }
    LL ans[D];
    LL mem[26];
    for(int i=0;i<26;i++){mem[i]=0;}
    for(int i=0;i<D;i++){
        if(i==0){ans[i]=0;}
        else{ans[i]=ans[i-1];}
        ans[i]=ans[i]+s[i][t[i]];
        mem[t[i]]=i+1;
        for(int j=0;j<26;j++){
            ans[i]=ans[i]-(c[j]*(i+1-mem[j]));
        }
    }
    for(int i=0;i<D;i++){
        cout<<ans[i]<<endl;
    }
        return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int main(){

    long long a,b=0,c,d,r=0,g=0,i,j,k,sum2=0,sum=0;
    string s;
    cin >> a >> s;

    map<long,long>mpr,mpg,mpb;
    map<char,long>mp;
    map<long long,char>mp1;
    mp['R']=2;
    mp1[2]='R';
    mp1[100]='G';
    mp1[40]='B';
    mp['G']=100;
    mp['B']=40;
    for(i=s.length()-1;i>=0;i--)
    {
        if(s[i]=='R')
        {
            r++;

        }
        else if(s[i]=='G')
        {
            g++;

        }
        else
        {
            b++;
        }
        mpr[i]=r;
        mpg[i]=g;
        mpb[i]=b;

      }

    for(i=0;i<s.length()-2;i++)
    {
        sum=0;
        sum=mp[s[i]];
        for(j=i+1;j<s.length()-1;j++)
        {
            long long q=mp[s[j]];
            long long l=142-(q+sum);
            //cout << "l  " << l << endl;
            if(mp1[l]=='R' || mp1[l]=='G' || mp1[l]=='B')
            {
               // cout << "entry " << endl;
            if(mp1[l]=='B')
            {

                if(j+(j-i)<s.length() && s[j+(j-i)]=='B')
                {
                   // cout << j+(j-i) << " * "<< B << endl;
                   sum2=sum2+mpb[j+1]-1;
                }


               else
               {
                   sum2=sum2+mpb[j+1];

               }


            }
            else if(mp1[l]=='G')
            {
              if(j+(j-i)<s.length() && s[j+(j-i)]=='G')
                {
                   sum2=sum2+mpg[j+1]-1;
                }


               else
               {
                   sum2=sum2+mpg[j+1];

               }
            }
            else
            {
                if(j+(j-i)<s.length() && s[j+(j-i)]=='R')
                {
                   sum2=sum2+mpr[j+1]-1;
                }


               else
               {
                   sum2=sum2+mpr[j+1];

               }
            }
           }
        }




    }
    cout << sum2 << endl;





}


Measured memory_bytes: 4392
MAX=100000
def Allocate(A, p, k, n):
    count=1
    s=0     
    index=0
    while index<n:
        if s+A[index]<=p:
            s+=A[index]
            index+=1
        else:
            count+=1
            s=0
        if count>k:
            return False

    return True
         
    
n, k=map(int,input().split())
A=[int(input()) for i in range(n)]
left=0
right=MAX*MAX
while left+1<right:
    mid=left+(right-left)//2
    if Allocate(A,mid,k,n):
        right=mid
    else:
        left=mid
print(right)


Measured memory_bytes: 9560
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++ i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; -- i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++ i)
#define ri rd<int>
using namespace std;
const int maxN = 1e5 + 7;

template<class T> inline T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - 48; return f ? x : -x;
}

inline void NIE() { puts("No"); exit(0); }

int n;
int mp[maxN][3], a[maxN], b[maxN], nw[maxN];
int cnt[2], to[maxN];

int chk(int *v) {
	int res = v[0] < v[1] ? 1 : -1;
	if (res < 0) swap(v[0], v[2]);
	if (v[0] % 3 != 1) NIE();
	if (v[0] + 1 != v[1]) NIE();
	if (v[1] + 1 != v[2]) NIE();
	return res * (v[0] / 3 + 1);
}

inline int sgn(int x) {return (x & 1) ? -1 : 1;}

namespace Fenwick {
	int c[maxN];

	inline int lb(int x) {return x & (-x);}

	inline void add(int x) {
		for (; x > 0; x -= lb(x)) c[x] ^= 1;
	}

	inline int sum(int x) {
		int res = 0;
		for (; x <= n; x += lb(x)) res ^= c[x];
		return res;
	}

	inline void init() {
		memset(c, 0, sizeof c);
	}
}

int solve(int bg) {
	int res = 0;
	Fenwick::init();
	for (int i = bg; i <= n; i += 2) {
		res ^= Fenwick::sum(to[i]+1);
		Fenwick::add(to[i]);
	}
	return res;
}

int main() {

	n = ri();
	For (j, 0, 3) rep (i, 1, n) mp[i][j] = ri();
	rep (i, 1, n) b[i] = chk(mp[i]);
	rep (i, 1, n) a[i] = i;

	rep (i, 1, n) {
		int p = abs(b[i]);
		if ((i & 1) != (p & 1)) NIE();
		to[p] = i;
		nw[i] = a[p] * sgn((i - p) >> 1);
		cnt[i & 1] ^= (nw[i] != b[i]);
	}

	cnt[0] ^= solve(1);
	cnt[1] ^= solve(2);

	puts((cnt[0] == 0 && cnt[1] == 0) ? "Yes" : "No");

	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    int a, b;
    cin >> a >> b;
    int temp = 0;
    int bb = b;
    while (bb)
    {
        bb /= 10;
        temp++;
    }
    
    
    bool ans = 0;
    for (size_t i = 0; i < 1000; i++)
    {
        if (a*pow(10,temp)+b == pow(i,2))
        {
           ans = true;
           break;
        }
        
    }

    if(ans) {
    cout << "Yes" << endl;
    } else {
    cout << "No" << endl;
    }
    

    return 0;
}

Measured memory_bytes: 3932
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <map>
#include <list>
#include <queue>
#include <cstdlib>
#define INF (1000000007)
#define distance(x1,y1,x2,y2) sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
#define rep(i,N) for(ll i=0;i<N;i++)
#define rep2(i,j,k) for(ll i=j; i<k;i++)
typedef long long int ll;
using namespace std;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vs=vector<string>;
using vvs=vector<vector<string>>;

template <typename T>
void print(T v){
    for(size_t i=0;i<v.size();i++){
        cout<<i<<": "<<v[i]<<endl;}
}

template <typename T>
void print2(T v){
    for(size_t i=0;i<v.size();i++){
        cout<<i<<": ";
        for(size_t j=0;j<v[0].size();j++){
            cout<<v[i][j]<<" ";
        }
        cout<<endl;
    }
}

template <typename T>
T slice(T v,ll left,ll right){
    T ret(0);
    copy(v.begin()+left,v.begin()+right,back_inserter(ret));
    return ret;
}

bool func(vl s,vl t){
    return s[1]<t[1];
}

int main(){
    
    vl vec(5);
    rep(i,5){
        cin>>vec[i];
    }
        
    ll sum=0;
    ll max=0;
    ll t;
       
    rep(i,5){
        t=vec[i]%10;
        if(t!=0){
            sum+=vec[i]+10-t;
        }
        else{
            sum+=vec[i];
        }
        
        if(t!=0 && max<10-t){
            max=10-t;
        }
    }
    
    cout<<sum-max<<endl;       
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	vector<int> vec(26, 0);
	char ch;
	while (cin >> ch) {
		if (65 <= ch && ch <= 90) {
			vec.at(ch - 65)++;
		}
		else if (97 <= ch && ch <= 122) {
			vec.at(ch - 97)++;
		}
		else {}
	}
	for (int i = 0; i < 26; i++) {
		char a = (char)i + 97;
		cout << a << " : " << vec.at(i) << endl;
	}
}


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

namespace ProgramingStydying
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(long.Parse).ToArray();

            var divider = (long)1e9 + 7;
            var sum = a.Sum();
            long ans = 0;

            for(int i = 0; i < n; i++)
            {
                sum -= a[i];
                var sumMod = sum % divider;
                ans = (ans + a[i] * sumMod) % divider;
            }
            Console.WriteLine(ans);
        }
    }
}

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

int main(){
  string s;
  int K;
  cin >> s >> K;
  const int N = s.size();

  set<string> ss;
  for(int i=0;i<N;++i)
    for(int j=1;j<=K;++j)
      if(N>=i+j) ss.insert(s.substr(i,j));

  auto it = ss.begin();
  for(int i=1;i<K;++i) ++it;

  cout << *it << endl;

  return 0;
}


Measured memory_bytes: 1664
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define rt return
using dbl = double;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

vi G[100001];

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

    int N; // 2<=N<=10^5
    cin >> N;
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        G[--a].push_back(--b);
        G[b].push_back(a);
    }

    queue<pii> Q;
    Q.push(mp(0, 1));
    Q.push(mp(N - 1, 2));
    vi co(N);
    while (sz(Q)) {
        int u, c;
        tie(u, c) = Q.front();
        Q.pop();
        if (co[u])continue;
        co[u] = c;
        each(v, G[u]) if(!co[v]){
            Q.push(mp(v, c));
        }
    }
    int x = 0, y = 0;
    rep(i, N) {
        if (co[i] == 1)x++;
    }
    y = N - x;
    if (y >= x) {
        cout << "Snuke" << endl;
    }
    else {
        cout << "Fennec" << endl;
    }
}


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

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

int k;
string s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> k >> s;
  if (s.length() > k) {
    cout << s.substr(0, k) + "..." << endl;
  } else {
    cout << s << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3640
using System;

class Solution
{
    public static void Main(string[] args)
    {
        var input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int n = input[0], y = input[1];
        int n10000 = -1, n5000 = -1, n1000 = -1;
        for (var i = 0; i <= n; i++)
        {
            for (var j = 0; i + j <= n; j++)
            {
                var c = n - (i + j);
                if ((10000 * i) + (5000 * j) + (1000 * c) == y)
                {
                    n10000 = i;
                    n5000 = j;
                    n1000 = c;
                    goto END;
                }
            }
        }
        END:;
        Console.WriteLine($"{n10000} {n5000} {n1000}");
    }
}


Measured memory_bytes: 13140
// Problem : A - Coffee
// Contest : AtCoder Beginner Contest 160
// URL : https://atcoder.jp/contests/abc160/tasks/abc160_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) cout << "Yes";
	else cout << "No\n";
	return 0;
}
 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{static false_type c(string v);template<class U>static auto c(U v)->decltype(all(v),true_type());static false_type c(...);public:const static bool value=decltype(c(declval<T>()))::value;};
template<class T,typename=enable_if_t<iterable<T>::value>>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}


int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cout<<setprecision(10);
    cin>>n;
    string s;
    cin>>s;
    vector<bool> res(n);
    REP(i,4){
        res[0]=i&1;
        res[1]=i&2;
        REP(j,1,n-1){
            res[j+1]=(s[j]!='o')^res[j-1]^res[j];
        }
        REP(j,n)cerr<<(res[j]?'W':'S');cerr<<endl;
        if((res[n-1]==(s[n-1]=='o')) == (res[n-2]==res[0])){
            dprint(__LINE__);
            continue;
        }
        if((res[0]==(s[0]=='o')) == (res[n-1]==res[1])){
            dprint(__LINE__);
            continue;
        }
        REP(j,n)cout<<(res[j]?'W':'S');
        cout<<endl;
        return 0;
    }
    cout<<-1;
}


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

using namespace std;

typedef long long ll;

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

	int A, B;
	cin >> A >> B;
	if(A >= 13){
		cout << B << endl;
	}else if(A >= 6){
		cout << B / 2 << endl;
	}else{
		cout << 0 << endl;
	}

}


Measured memory_bytes: 256
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];
int t[64];
int d[100100];
int n;

void Solve() {
	int n;
	ll k;
	cin >> n >> k;
	ll ar[100010];
	for (size_t i = 0; i < n; i++)
	{
		ll a;
		cin >> a;
		ar[i] = a;
		int dig = 0;
		while (a > 0)
		{
			if (a & 1 == 1) t[dig]++;
			dig++;
			a >>= 1;
		}
	}

	ll num = 0;
	for (ll i = 50; i >= 0; i--)
	{
		if  (n > (t[i] * 2) ) {
			if (num + (1LL << i) <= k) {
				num += 1LL << i;
			}
		}
	}
	ll res = 0;
	for (size_t i = 0; i < n; i++)
	{
		res += num ^ ar[i];
	}
	cout << res << endl;
	//int m;
	//cin >> n >> m;
	//for (size_t i = 0; i < m; i++)
	//{
	//	cin >> t[i];
	//}
	//sort(t, t + m);
	//d[0] = 0;
	//for (size_t i = 1; i < m; i++)
	//{
	//	d[i] += d[i-1] + (t[i] - t[i - 1]);
	//}
	//rec(m, 0, m - 1);
}


int main() {
	Solve();
	return 0;
}



Measured memory_bytes: 6784
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
int dp[110][11100];
int weight[110];
int value[110];
int main(){
  int n,w;
  cin >> n >> w;
  for(int i=0;i<n;i++){
    cin >> value[i] >> weight[i];
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<=w;j++){
      dp[i][j+weight[i]] = max(dp[i][j]+value[i],dp[i][j+weight[i]]);
      dp[i+1][j] = max(dp[i][j],dp[i+1][j]);
    }
  }
  int res = 0;
  for(int i=0;i<=w;i++){
    res = max(res,dp[n][i]);
  }
  cout << res << endl;
	return 0;
}



Measured memory_bytes: 7456
n = int(input())
aList = list(map(int, input().split(' ')))

halfableCount = 0

while(True):
    # すべての数が割れるか確認する
    existOdd = False
    for i in range(len(aList)):
        if aList[i] % 2 != 0:
            existOdd = True

    # 割れない数があったので操作終了
    if existOdd:
        break

    # 割る
    for i in range(len(aList)):
        aList[i] = aList[i] >> 1

    halfableCount += 1

print(halfableCount)

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=270005;
const int mod=998244353;
int n,sum;
int a[maxn],F[maxn],G[maxn];

int quickpow(int x,int pow){
	int res=1;
	for(;pow;pow>>=1){
		if(pow&1)res=1LL*res*x%mod;
		x=1LL*x*x%mod;
	}
	return res;
}

void fwt(int *x,int tp){
	for(int m=1;m<(1<<n);m<<=1){
		for(int i=0;i<(1<<n);i+=(m<<1)){
			for(int j=i;j<i+m;j++){
				int u=x[j],v=x[j+m];
				x[j]=(u+v)%mod;
				x[j+m]=(u-v+mod)%mod;
				if(tp<0){
					x[j]=1LL*x[j]*(mod+1)/2%mod;
					x[j+m]=1LL*x[j+m]*(mod+1)/2%mod;
				}
			}
		}
	}
}

int main(){
	scanf("%d",&n);
	rep(i,1<<n){
		scanf("%d",&F[i]);
		sum+=F[i];
	}
	sum=quickpow(sum,mod-2);
	rep(i,1<<n){
		F[i]=1LL*F[i]*sum%mod;
		G[i]=mod-1;
	}
	F[0]=(F[0]-1+mod)%mod;
	G[0]=(1<<n)-1;
	fwt(F,1);
	fwt(G,1);
	rep(i,1<<n)F[i]=1LL*quickpow(F[i],mod-2)*G[i]%mod;
	fwt(F,-1);
	rep(i,1<<n)printf("%d\n",(F[i]-F[0]+mod)%mod);
	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int n;
  scanf("%d", &n);
  vector<ll> a(n), b(n);
  for (int i = 0; i < n; ++i) { scanf("%lld", &a[i]); }
  for (int i = 0; i < n; ++i) { scanf("%lld", &b[i]); }

  ll ans = 0;
  for (int bit = 0; bit < 30; ++bit) {
    ll T = (1 << bit);
    vector<ll> aa(n), bb(n);
    for (int i = 0; i < n; ++i) {
      aa[i] = a[i] % (T << 1);
      bb[i] = b[i] % (T << 1);
    }
    sort(bb.begin(), bb.end());
    ll cnt = 0;
    for (int i = 0; i < n; ++i) {
      cnt += upper_bound(bb.begin(), bb.end(), 2 * T - aa[i] - 1) -
        lower_bound(bb.begin(), bb.end(), T - aa[i]);
      cnt += upper_bound(bb.begin(), bb.end(), 4 * T - aa[i] - 1) -
        lower_bound(bb.begin(), bb.end(), 3 * T - aa[i]);
    }
    if (cnt % 2) { ans |= (1 << bit); }
  }

  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 6552
#include<iostream>
#include<string>
using namespace std;;
int main(void){
string a;
cin >>a;
int i=a.length();
int flag=0;
for(int j=0;j<i-1;j++){
if(a[j]=='A'&&a[j+1]=='C'){
flag=1;
}
}
if(flag==1){
cout<<"Yes";
}
else{
cout<<"No";
}
return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for(int i=0; i<n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  cout << v[n-1]-v[0] << endl;
  return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>

int main(void) {

  int A, B, T;
  do {
    scanf("%d %d %d", &A, &B, &T);
  } while (A < 1 || A > 20 || B < 1 || B > 20 || T < 1 || T > 20);

  int n = 0;
  for (int i = T; i - A >= 0; i-= A) {
    n += B;
  }

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

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define _GLIBCXX_DEBUG
#define ll long long
#define rep(i,n) for (ll i = 0; i < n; i++)
#define vl vector<ll>
#define vpl vector<pair<ll,ll>>
#define vvl vector<vector<ll>> //a(縦行,vector<ll>(横列));
#include<algorithm>//__gcd(a,b)
#include <iostream>
#include <vector>
#include <cstdlib>
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;

int main(){
   ll n;cin>>n;
   vl a(n);rep(i,n)cin>>a[i];

ll ans=0;

rep(i,n){
    rep(j,n){
        rep(k,n){
            if(a[i]!=a[j]&&a[i]!=a[k]&&a[j]!=a[k]&&a[i]+a[j]>a[k]&&a[i]+a[k]>a[j]&&a[j]+a[k]>a[i]){ans++;}
        }
    }
}


cout<<ans/6<<endl;

}

Measured memory_bytes: 3640
#include <iostream> 
#include <algorithm> 
using namespace std; 
	 
bool cmp(int a,int b)
{  
	return a>b; 
} 
	 
int main()
{  
	int n,k,x;  
	cin>>n>>k; 
	 
	int a[200000+5]={0}; 
	 	 
	for(int i=0;i<n;i++)
	{    
	    cin>>x;    
	    a[x]++; 
	}
	          
	sort(a+1,a+200000+1,cmp); 
	         
	int count=0;          
	for (int i=k+1;i<=200000;i++) count+=a[i]; 
	    cout<<count<<endl;  
		   
	return 0; 
} 


Measured memory_bytes: 1152
n=int(input())
s=[]
s.append(list(input()))
s.append(list(input()))
MOD=1000000007
ans=1
hflag=False
wflag=False
i=0
while(i<n):
    if(s[0][i]==s[1][i]):
        #縦型の時
        if(hflag):
            ans*=2
        elif(wflag):
            ans*=1
        elif((not hflag) and (not wflag)):
            #最初が縦型の時
            ans*=3
#        print(i,ans)
        hflag=True
        wflag=False
        i+=1
    else:
        #横型の時
        if(hflag):
            ans*=2
        elif(wflag):
            ans*=3
        elif((not hflag) and (not wflag)):
            #最初が横型の時
            ans*=6
#        print(i,ans)
        hflag=False
        wflag=True
        i+=2
print(ans%MOD)


Measured memory_bytes: 3064
import sys
from collections import defaultdict


def eratosthenes_generator():
    yield 2
    n = 3
    h = {}
    while True:
        m = n
        if n in h:
            b = h[n]
            m += 2 * b
            while m in h:
                m += 2 * b
            h[m] = b
            del h[n]
        else:
            m += 2 * n
            while m in h:
                m += 2 * n
            h[m] = n
            yield n
        n += 2


gen = eratosthenes_generator()
p = 0
primes = []
for p in gen:
    if p > 2154:
        break
    primes.append(p)

prime_pairs = {1: 1, p: p * p, p * p: p}
for p in gen:
    if p > 100000:
        break
    p2 = p * p
    prime_pairs[p] = p2
    prime_pairs[p2] = p

n, *sss = map(int, sys.stdin.buffer.read().split())
normalized = defaultdict(int)
over_pairs = {}
frac_pairs = {}
ans = 0
for s in sss:
    # sを2154までの素数で全て割る → ～10^5 までの単一の素数またはその2乗以外は、10^10 までの範囲にペアは存在し得ない
    frac = 1  # 2154までの素因数について、立方数とならない端数を掛け合わせたもの
    pair = 1  # 2154までの素因数について、立方数となるためにペアに求められる因数
    for p in primes:
        if s < p:
            break
        x = 0
        d, m = divmod(s, p)
        while m == 0:
            x += 1
            s = d
            d, m = divmod(s, p)
        x %= 3
        if x == 1:
            frac *= p
            pair *= p ** 2
        elif x == 2:
            frac *= p ** 2
            pair *= p
    if s > 2154 and s not in prime_pairs:
        ans += 1
        continue
    frac_pairs[frac] = pair
    normalized[s, frac] += 1

if (1, 1) in normalized:
    ans += 1
    del normalized[1, 1]

tmp = 0
for (s, frac), cnt in normalized.items():
    pair = (prime_pairs[s], frac_pairs[frac])
    if pair not in normalized:
        tmp += cnt * 2
    else:
        tmp += max(cnt, normalized[pair])
ans += tmp // 2

print(ans)


Measured memory_bytes: 70748
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

string S,T;

signed main(){
	cin>>S>>T;
	if(T.substr(0,T.size()-1)==S){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3640
#nの約数列挙
#-------------------------------------------------------------------------
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass #sortされていない
#-------------------------------------------------------------------------
# テスト
N = int(input())
cnt = 0

for i in range(N+1):
    if i%2 == 1 and len(divisor(i)) == 8:
        cnt += 1
print(cnt)

Measured memory_bytes: 38384
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = '-' + sr()
N = len(S) - 1

def solve(S):
    if S[1] == '0' or S[N] == '1':
        return None
    prev = 1
    graph = []
    for i in range(1, N//2 + 1):
        if S[i] != S[N-i]:
            return None
        if S[i] == '0':
            continue
        for x in range(prev, i):
            graph.append('{} {}'.format(x, i))
        prev = i
    for x in range(prev, N):
        graph.append('{} {}'.format(x, N))
    return graph

graph = solve(S)
if graph is None:
    print(-1)
else:
    print('\n'.join(graph))

# 42

Measured memory_bytes: 14232
import math

a, b, x = map(int, input().split())
volume = a ** 2 * b

if x >= volume / 2:
  c = (volume - x) / (a * a / 2)
  tan_theta = c / a
else:
  c = x / (a * b / 2)
  tan_theta = b / c
  
print(math.degrees(math.atan(tan_theta)))

Measured memory_bytes: 3060
#include<stdio.h>
#include<algorithm>
#include<string>
using namespace std;
char str[120];
string ans;
int cur;
string ci();
string st();
char le();
string ci(){
	string ret=st();
	while(str[cur]&&str[cur]!=']'){
		ret+=st();
	//printf("ci %d: %s\n",cur,ret.c_str());
	}
	return ret;
}
string st(){
	if(str[cur]=='['){
		cur++;
		string tmp=ci();
		cur++;
		reverse(tmp.begin(),tmp.end());
		return tmp;
	}
	char res=le();
	//printf("st %d: %c\n",cur,res);
	char r[2];
	r[0]=res;r[1]=0;
	string q=r;
	return q;
}
char le(){
	if(str[cur]=='+'){
		cur++;
		char res=le();
		if(res=='Z')res='A';
		else res++;
		return res;
	}
	if(str[cur]=='-'){
		cur++;
		char res=le();
		if(res=='A')res='Z';
		else res--;
		return res;
	}
	cur++;
	return str[cur-1];
}
void solve(){
	bool p=false;
	for(int i=0;str[i];i++)if(str[i]=='?'){
		p=true;
		for(int j=0;j<26;j++){
			str[i]='A'+j;
			solve();
		}
		str[i]='?';
		return ;
	}
	cur=0;
	string res=ci();
	ans=min(ans,res);
}
int main(){
	while(1){
		scanf("%s",str);
		//printf("%s\n",str);
		if(str[0]=='.')return 0;
		ans="ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";
		solve();
		printf("%s\n",ans.c_str());
	}
}

Measured memory_bytes: 1048