akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, m, n) for (int i = m; i < n; ++i)

bool solve() {
    string S;
    int x, y;
    cin >> S >> x >> y;
    vector<vector<int>> C(2);
    int cnt = 0;
    rep(l, 0, S.size()) {
        int r = l;
        while(r < S.size() && S[r] == 'F') r++;
        C[(cnt++) % 2].push_back(r - l);
        l = r;
    }
    int N = C[0].size();
    int M = C[1].size();
    vector<vector<int>> dp(N + 1, vector<int>(16001));
    vector<vector<int>> ep(M + 1, vector<int>(16001));
    int g = 8000;
    dp[1][C[0][0] + g] = 1;
    rep(i, 1, N) rep(j, -8000, 8001) {
        if(dp[i][j + g] == 0) continue;
        dp[i + 1][j + C[0][i] + g] = 1;
        dp[i + 1][j - C[0][i] + g] = 1;
    }
    ep[0][g] = 1;
    rep(i, 0, M) rep(j, -8000, 8001) {
        if(ep[i][j + g] == 0) continue;
        ep[i + 1][j + C[1][i] + g] = 1;
        ep[i + 1][j - C[1][i] + g] = 1;
    }
    return dp[N][x + g] && ep[M][y + g];
}

int main() {
    cout << (solve() ? "Yes" : "No") << '\n';
    return 0;
}


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

int main(){
    string s;
    cin >> s;

    long long int ans = 0;
    queue<int> q;

    for(int i=0; i<(int)s.length(); i++){
        if(s[i] == 'A') q.push(0);
        else if(i+1<(int)s.length() && s[i] == 'B' && s[i+1] == 'C'){ q.push(1); i += 1; }
        else{
            int a = 0;
            while(q.empty() == false){
                if(q.front() == 0) a += 1;
                if(q.front() == 1) ans += a;
                q.pop();
            }
        }
    }
    int a = 0;
    while(q.empty() == false){
        //cout << q.front() << " ";
        if(q.front() == 0) a += 1;
        if(q.front() == 1) ans += a;
        q.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4208
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD=1e9+7;
int n;
ll ans,a[200005],sum;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)  
     {
     	cin>>a[i];
     	ans=ans+a[i];
        ans=ans%MOD;
     }
    for(int i=1;i<=n;i++)
    {
    	ans-=a[i];
        if(ans<0) ans+=MOD;
        sum+=ans*a[i]%MOD;
        sum=sum%MOD;
    }
    cout<<sum;
	return 0;
}


Measured memory_bytes: 5156
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_A&lang=ja
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int dp[50001];
int main() {
  memset(dp, 1, sizeof(dp));
  int n, m;
  cin >> n >> m;
  vector<int> c(n);
  rep(i, m) cin >> c[i];

  dp[0] = 0;
  rep(i, m) rep(j, n + 1) {
    if (j + c[i] > n)
      break;//dp[i + 1][j] = dp[i][j];
    else
      dp[j + c[i]] = min(dp[j] + 1, dp[j + c[i]]);
  }

  cout << dp[n] << endl;
  return 0;
}


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

using namespace std;

int main(void){
    long long n;
    cin >> n;
    
    long long ans = 0;
    
    for (long long i = 1; i <=n; i++){
        if (i % 3 != 0 && i % 5 != 0) ans += i;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>

using namespace std;

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

  vector <int> possible(n + 1, 0);

  bool valid = false;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;

    if (a == 1) {
      possible[b] |= 1;
      if (possible[b] == 3)
	valid = true;
    }

    if (b == n) {
      possible[a] |= 2;
      if (possible[a] == 3)
	valid = true;
    }

  }

  cout << (valid? "POSSIBLE": "IMPOSSIBLE") << endl;
}


Measured memory_bytes: 1024
"use strict";

const main = arg => {
  const input = arg.trim().split("\n");
  const N = parseInt(input[0]);
  const S = input[1]
  if (S.length > N) {
    console.log(S.substring(0, N) + "...");
  } else {
    console.log(S);
  } 
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29628
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 200005
#define ll long long
using namespace std;
int n;
ll a[maxn];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    ll sum=0;
    for(int i=1;i<=n;i++)
        sum+=a[i];
       ll res=0;
        int i;
    for( i=1;i<=n;i++)
    {
        res+=a[i];
        if(res>=sum/2)
            break;
    }
    if(res==sum/2)
        printf("0\n");
    else
    {

            ll ans1=(res-(sum-res));

            ll ans2=(sum-res+a[i])-(res-a[i]);

            printf("%lld\n",min(ans1,ans2));


    }
    return 0;

}


Measured memory_bytes: 1792
#include <iostream>
    #include <cmath>
    #include <iomanip>
    #include <vector>
    #include <algorithm>
     
    using namespace std;
     
    int main()
    {
     
        int N, K;
     
        vector<int> count;
     
        cin >> N >> K;
     
        count.push_back(max(0, N - K));
     
        for(int i = min(N, K); i > 0; --i){
            int f = (int)ceill(log2l((long double)K / i));
            while(count.size() <= f){
                count.push_back(0);
            }
            count.back() += 1;
        }
     
        long double r = 0;
        for(int i = 0; i < count.size(); i++){
            r += (long double)count[i] / N / powl(2, i);
        }
        cout << setprecision(10) << r << endl;
     
        return 0;
    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    string s;
    cin >> s;
    cout << s;
    if (s.back() == 's') {
        cout << "es" << endl;
    } else {
        cout << "s" << endl;
    }
    return 0;
}


Measured memory_bytes: 3644
"use strict";
// import bigInt from 'big-integer'

const Main = input => {
  input = input.trim().split("\n");
  const musicCount = input.shift();
  const lastListenedMusic = input.pop();
  let startSleep = false;
  let totalSleepTime = 0;
  for (let i = 0; i < input.length; i++) {
    const musicData = input[i].split(" ");
    const title = musicData[0];
    const sec = parseInt(musicData[1], 10);
    if (!startSleep) {
      if (title === lastListenedMusic) {
        startSleep = true;
      }
      continue;
    }

    totalSleepTime += sec;
  }

  console.log(totalSleepTime);
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



void _main() {
        int n; cin >> n;
        vector<ll> a(n); cin >> a;
        vector<ll> b(n);
        for (int i = 0; i < n; i++) {
                if (i % 2 == 0) b[0] += 2 * a[i];
                else b[0] -= 2 * a[i];
        }
        b[0] /= 2;
        for (int i = 1; i < n; i++) b[i] = 2*  a[i - 1] - b[i - 1];
        cout << b;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 4728
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        Map<Integer, Long> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            map.put(a[i], map.getOrDefault(a[i], 0l) + 1);
        }
        long sum = 0;
        for (Integer key : map.keySet()) {
            long val = map.get(key);
            sum += (val * (val - 1)) / 2;
        }
        for (int i = 0; i < n; i++) {
            System.out.println(sum - map.get(a[i]) + 1);
        }
    }

}


Measured memory_bytes: 108560
#include<iostream>
#include <cstdio>
#include<cstring>
#include<string>
#include <cstdlib>  
#include<cmath>   
#include <cctype>
#include<string>
#include<set>
#include <iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<list>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility>
#define LEN 100005
using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
ll LGCD(ll x, ll y) {if (x % y == 0) return y;else return LGCD(y, x % y);}
ll LLCM(ll x, ll y) {return x * y / LGCD(x, y);}

int GCD(int x, int y) {if (x % y == 0) return y;else return GCD(y, x % y);}
int LCM(int x, int y) {return x * y / GCD(x, y);}
ll dpc[10000][10000];
ll combination(ll n, ll r) {
	if (n == r) { return dpc[n][n] = 1; }
	else if (r == 0) { return dpc[n][0] = 1; }
	else if (r == 1) { return dpc[n][1] = n; }
	else if (dpc[n][r]) { return dpc[n][r]; }
	else {return dpc[n][r]=combination(n - 1, r - 1)  + combination(n - 1, r);}}


ll nCr(ll n, ll r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}

bool chsK(string s) {
	int n = s.length();
	if (n % 2 == 0) {
		for (int i = 0;i <= n / 2;i++) {
			if (s[i] != s[n - i-1])return false;
		}
	}
	else {
		for (int i = 0;i <= n / 2;i++) {
			if (s[i] != s[n - i-1])return false;
		}
	}
	return true;
}

int main() {
	ll x;
	cin >> x;
	ll y = 0;
	y = y + (x / 500) * 1000;
	y = y + ((x % 500) / 5) * 5;
	cout << y << endl;

	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define ll long long
#define P pair<int, int>

using namespace std;

int H, W, N;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);

  cin >> H >> W >> N;
  vector<int> a(N);
  rep(i, N) {
    cin >> a.at(i);
  }
  int ans[H][W];
  int pos = 0;
  rep(i, H) {
    rep(j, W) {
      if (a.at(pos) > 0) {
        a.at(pos)--;
      }
      if (i%2 == 0) {
        ans[i][j] = pos+1;
      } else {
        ans[i][W-1-j] = pos+1;
      }
      if (a.at(pos) == 0) {
        pos++;
      }
    }
  }

  rep(i, H) {
    rep(j, W) {
      cout << ans[i][j] << ' ';
    }
    cout << '\n';
  }
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using Pint = pair<int, int>;
const ll mod = 1e9+7;

int main()
{
  int a,b;
  cin>>a>>b;
  cout<<(a^b)<<endl;

  return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 7;
const int mod = 1e9 + 7;

int main(){
	int n,k;
	cin >> n >> k; 
	int ans = 0;
	while(n){
		n /= k;
		ans++; 
	} 
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
def MI():
    return map(int,input().split())
    
def LI():
    return list(MI())


x,k,d=MI()

if x==0:
    if k%2==0:
        ans=0
    else:
        ans=abs(d)
    print(ans)
    exit()

if x<0 and x+k*d<0:
    ans=x+k*d
    ans=abs(ans)
    print(ans)
    exit()
if x>0 and x-k*d>0:
    ans=x-k*d
    print(ans)
    exit()
    
ans=x%(2*d)
if k%2==1:
    ans=min(abs(ans-d),abs(ans+d))
    print(ans)
    exit()
else:
    ans=min(abs(ans-2*d),abs(ans),abs(ans+2*d))
    print(ans)
    exit()


Measured memory_bytes: 9228
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

bool sum_binsearch(int target, int index, vector<int>& A) {
	if(target==A[index]) {
		return true;
	} else if( target < A[index] || index>=(int)A.size()) {
		return false;
	} else {
		return (sum_binsearch(target,index+1,A) || sum_binsearch(target-A[index],index+1,A));
	}
}

int main() {
	int i;
	int m,n,q;
	vector<int> A;
	scanf("%d",&n);
	A.resize(n);
	for(i=0;i<n;++i) {
		scanf("%d",&A[i]);
	}
	sort(A.begin(),A.end()); // ?????????
	scanf("%d",&q);
	for(i=0; i<q; ++i) {
		scanf("%d",&m);
		if(sum_binsearch(m,0,A)) {
			printf("yes\n");
		} else {
			printf("no\n");
		}
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
template<class T,class Y>T LCM(T a,Y b){return (a*b)/GCD(a,b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

using vi=vector<int>;
using vii=vector<vi>;

#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define rv reverse
#define ALL(a) (a).begin(),(a).end()
#define decimal(x) fixed<<setprecision(x)

using Graph=vii;

int main(){
    int X,Y,A,B,C;
    cin>>X>>Y>>A>>B>>C;
    vector<ll> p(A),q(B),r(C);
    rep(i,A)cin>>p[i];
    rep(i,B)cin>>q[i];
    rep(i,C)cin>>r[i];
    priority_queue<ll> pue;
    sort(ALL(p),greater<ll>());
    sort(ALL(q),greater<ll>());
    rep(i,X)pue.push(p[i]);
    rep(i,Y)pue.push(q[i]);
    rep(i,C)pue.push(r[i]);
    ll sum=0;
    rep(i,X+Y){
        sum+=pue.top();
        //cout<<pue.top()<<" ";
        pue.pop();
    }
    cout<<sum<<endl;
    return 0;
}

//a=97,z=122

Measured memory_bytes: 8816
#include <cstdio>

const int MN = 305, MM = 305;

int N, M, A[MN][MM], cho[MM], p[MN], buk[MM], Ans;

int main() {
	scanf("%d%d", &N, &M), Ans = N;
	for (int i = 1; i <= N; ++i)
		for (int j = 1; j <= M; ++j)
			scanf("%d", &A[i][j]);
	for (int j = 1; j <= M; ++j) cho[j] = 1;
	for (int i = 1; i <= N; ++i) p[i] = 1;
	for (int k = 1; k <= M; ++k) {
		for (int j = 1; j <= M; ++j) buk[j] = 0;
		for (int i = 1; i <= N; ++i) {
			while (!cho[A[i][p[i]]]) ++p[i];
			++buk[A[i][p[i]]];
		}
		int mxi = 0;
		for (int j = 1; j <= M; ++j)
			if (buk[mxi] < buk[j]) mxi = j;
		if (Ans > buk[mxi]) Ans = buk[mxi];
		cho[mxi] = 0;
	}
	printf("%d\n", Ans);
	return 0;
}

Measured memory_bytes: 2100
use std::io::{stdin, stdout, BufWriter, Read, StdinLock, Write};
use std::str::FromStr;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read_<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .cin
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read_().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let n: i32 = sc.read();
    let mut array: Vec<i32> = vec![];
    for _ in 0..n {
        array.push(sc.read());
    }

    let mut max = 0;
    let mut max_i = 0;
    for i in 0..n {
        if array[i as usize] > max {
            max = array[i as usize];
            max_i = i;
        }
    }

    let mut max_2 = 0;
    for i in 0..n {
        if i == max_i {
            continue;
        }

        if max_2 < array[i as usize] {
            max_2 = array[i as usize];
        }
    }

    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    for i in 0..n {
        if max_i == i {
            writeln!(out, "{}", max_2).unwrap();
        } else {
            writeln!(out, "{}", max).unwrap();
        }
    }
}

Measured memory_bytes: 5628
#include <cstdio>
#include <algorithm>
#include <vector>
#include <numeric>
#include <functional>
using namespace std;
int main(){
    int n, k;
    scanf("%d%d", &n, &k);
    vector<int> a;
    a.reserve(n);
    for(int i = 0; i < n; ++i){
        int t;
        scanf("%d", &t);
        a.push_back(t);
    }
    partial_sort(a.begin(), a.begin() + k, a.end(), greater<int>());
    printf("%d\n", accumulate(a.begin(), a.begin() + k, 0));
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int d = sc.nextInt();
        int x = sc.nextInt();
        
        for (int i = 1; i <= 10 ; i++){
            int temp = r * x - d;
            x = temp;
            System.out.println(x);
        } 
    }
}


Measured memory_bytes: 35616
text=input().split()
N=int(text[0])
M=int(text[1])
a=input().split()
A=[]
for item in a:
    A.append(int(item))

sm=[]
dic={}
answer=0

sm.append(A[0]%M)
if sm[0]==0:
    answer+=1

dic[sm[0]]=1

for i in range(1,len(A)):
    if (A[i]+sm[i-1])%M==0:
        answer+=1
    sm.append((A[i]+sm[i-1])%M)
    try:
        dic[sm[i]]+=1
    except:
        dic[sm[i]]=1

for i in dic:
    temp=0
    for j in range(0,dic[i]):
        temp+=j
    answer+=temp
print(answer)


Measured memory_bytes: 20320
#include<stdio.h>
int main(void){
	int a, b, c;
	scanf("%d%d%d", &a,& b,& c);
	if (a <= b &&b<= c){
		printf("%d %d %d\n", a, b, c);}
	else if (b <= c&&c <= a){
		printf("%d %d %d\n", b, c, a);}
	else if (a <= c&&c <= b){
		printf("%d %d %d\n", a, c, b);}
	else if (b <= a&&a <= c){
		printf("%d %d %d\n", b, a, c);}
	else if (c <= a&&a <= b){
		printf("%d %d %d\n", c, a, b);}
	else { printf("%d %d %d\n", c, b, a); }
	return 0;
}

Measured memory_bytes: 596
#from collections import deque,defaultdict
from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
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 = 10**18
R = 10**9 + 7

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

alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', \
  'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
s = ins()
if s[0] in alpha:
    print('a')
else:
    print('A')


Measured memory_bytes: 61780
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  double a,b;
  cin>>a>>b;
  double k=b*10;
  for(double i=0;i<10;i++){
    if((int)((k+i)*0.08)==a){
      COUT(k+i);
      return 0;
    }
  }
  COUT(-1);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  long long a,b,n;
  cin>>n>>a>>b;
  long long direct = n/(a+b);
  long long partial = n%(a+b);
  long long answer=direct*a;
  if(partial<=a)
    answer+=partial;
  else
    answer+=a;
  cout<<answer;
  return 0;
}


Measured memory_bytes: 256
/*5_3 hightierra*/
#include <stdio.h>
#define LIMIT 100

int main(void){
    int row,col,i,j,rowjudge[LIMIT]={0},coljudge[LIMIT]={0};
  	char matrix[LIMIT][LIMIT];
    scanf("%d %d",&row,&col);

    // 初期化
    for(i=0; i<LIMIT; i++){
        for(j=0; j<LIMIT; j++){
            matrix[i][j]=0;
        }
    }

    // 入力
    for(i=0; i<row; i++){
        for(j=0; j<col; j++){
            scanf(" %c",&matrix[i][j]);
        }
    }

    // 各行、各列に黒が１つでもあるかを判別
    for(i=0; i<row; i++){
        for(j=0; j<col; j++){
            if(matrix[i][j]=='#'){
                rowjudge[i]=1;
            }
        }
    }
    for(j=0; j<col; j++){
        for(i=0; i<row; i++){
            if(matrix[i][j]=='#'){
                coljudge[j]=1;
            }
        }
    }

    // 黒が１つでもある行と列の重なる要素のみを出力
    for(i=0; i<row; i++){
        for(j=0; j<col; j++){
            if(rowjudge[i]==1 && coljudge[j]==1){
                printf("%c",matrix[i][j]);
            }
        }
        if(rowjudge[i]==1){
            printf("\n");
        }
    }
    return 0;
}

Measured memory_bytes: 128
// C++11
#define LOCAL
#define _DEBUG
#define _DEBUG2
#define _DEBUG3
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include "bits/stdc++.h"
#include <sys/time.h>
#include <emmintrin.h>
#include <string>
#include <bitset>

using namespace std;

inline long long GetTSC() {
  long long lo, hi;
  asm volatile ("rdtsc": "=a"(lo), "=d"(hi));
  return lo + (hi << 32);
}
inline double GetSeconds() {
  return GetTSC() / 2.8e9;
}

struct XorShift {
  uint64_t x = 88172645463325252ULL;
  double nl[65536];
  XorShift() { init(); }
  void setSeed(uint64_t seed) { x = seed; init(); }
  void init() {
    double eps = 1.0 / 65536*2;
    for(int i=0; i<65536; i++) nl[i] = log(i / 65536.0 + eps);
  }

  uint64_t next() {
    x ^= x << 13; x ^= x >> 7; x ^= x << 17;
    return x;
  }

  int nextInt(int n) {
    uint64_t upper = 0xFFFFFFFFFFFFFFFFULL / n * n;
    uint64_t v = next();
    while (v >= upper) v = next();
    return v % n;
  }

  double nextDouble() {
    uint64_t v = next() >> 11; // 53bit
    return (double)v / (1ULL << 53);
  }

  double nextLog() {
    return nl[nextInt(65536)];
  }
};


XorShift xs;
const double TO = 1.8;

double starttime, gt;
int ttt,ctt;

struct State {
  int x = 0, y = 0;
  double k = 0;
  State() {}
  State(int _x, int _y, double _k) : x(_x), y(_y), k(_k) {}

  bool operator<(const State &a) const{
    return k > a.k;
  }
};

const int M = 100;
int N;
int X[M];
int Y[M];

void init(){
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> X[i] >> Y[i];
  }
}

double solve_(){
  for(int i=N-1; i>0; i--){
    int ri = xs.nextInt(i+1);
    swap(X[ri], X[i]);
    swap(Y[ri], Y[i]);
  }

  vector<State> q;
  q.emplace_back();
  for(int i=0; i<N; i++){
    vector<State> nq;
    int qm = int(q.size());
    int qc = 0;
    for(int qi=0; qi<qm; qi++){
      auto s = q[qi];
      // cerr << s.x << " " << s.y << " " << s.k << endl;
      nq.emplace_back(s.x, s.y, s.k);
      int nx = s.x + X[i];
      int ny = s.y + Y[i];
      double nk = pow(nx, 2) + pow(ny, 2);
      nq.emplace_back(nx, ny, nk);
      qc++;
      if(qc > 10000) break;
    }
    q = nq;
    sort(q.begin(), q.end());
  }
  return q[0].k;
}

void solve(){
  double ms = solve_();
  while(1){
    gt = GetSeconds() - starttime;
    if(gt >= TO) break;
    double ts = solve_();
    if(ms < ts) ms = ts;
  }
  cout << setprecision(11) << sqrt(ms) << endl;;
}

void output(){
}

int main() {
  starttime = GetSeconds();
  init();
  solve();
  output();
}


Measured memory_bytes: 2084
def listint():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

n = listint()[0]
a = listint()
able = True
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            able = False
if able == True:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3064
<?php
list($n) = ints();
$ans = 0;
for ($i = 0; $i < $n; ++$i) {
    list($l, $r) = ints();
    $ans += $r - $l + 1;
}
echo $ans;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 4604
#include <iostream>
#include <string>
#include <cstdio>
using namespace	std;
int main(){

  int a[26]={};
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++) a[s[i]-'a']=1;
  for(int i=0;i<26;i++){
    if(a[i]==0){
      printf("%c\n",'a'+i);
      return 0;
    }
  }
  cout<<"None"<<endl;
  return 0;

}



Measured memory_bytes: 512
function main()
  n = parse.(split(readline()))
  k = parse(readline())
  s = 0
  t = 0
  for i in 1:3
    if s < n[i]
      s = n[i]
      t = i
    end
  end
  print(n[1]+n[2]+n[3]+s*2^k-s)
end

main()

Measured memory_bytes: 163988
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 5010;
int n,mod,s,dp[N],a[N];

inline void upd(int &x,int y){
	x+=y;
	if (x>=mod) x-=mod;
}

int main(){
	n=read(),mod=read();
	int m=n+1>>1;
	For(i,1,m) a[i]=-1;
	For(i,m+1+(n%2==0),n) a[i]=1;
	dp[0]=1,s=1;
	Dow(i,n,2){
		s+=a[i];
		For(j,s,n) upd(dp[j],dp[j-s]);
	}
	int ans=0;
	For(i,0,n) ans=(ans+1ll*dp[i]*(n-i))%mod;
	printf("%d\n",ans);
}

Measured memory_bytes: 3796
#include <iostream>
#include <string>

using namespace std;

bool alfa[26];

void func ( string s )
{
  for ( int i = 0; i < 26; ++i ) alfa[i] = false;
  for ( int i = 0, q = s.size(); i < q; ++i ) {
    alfa[s[i]-'a'] = true;
  }

}

int main()
{
  string s;
  char c = '\0';

  cin >> s;
  func(s);

  for ( int i = 0; i < 26; ++i ) {
    if ( alfa[i] == false ) {
      c = 'a' + i;
      break;
    }
  }

  if ( c == '\0' ) cout << "None\n";
  else cout << c << "\n";
}


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

int main() {
	int n;
	int a[1001];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = n-1; i >= 0; i--) {
		if (i != 0) {
			cout << a[i] << " ";
		}
		else {
			cout << a[i];
		}
		
	}
  cout<<endl;
}


Measured memory_bytes: 3112
#include<iostream>
using namespace std;
int main(){
  int n,m,k;
  cin>>n>>m>>k;
  int a[n],b[m];
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<m;i++) cin>>b[i];
  long long t=0;
  for(int i=0;i<m;i++) t+=b[i];
  int j=m;
  int ans=0;
  for(int i=0;i<n+1;i++){
    while(j>0&&t>k){
      --j;
      t-=b[j];
    }
    if(t>k) break;
    ans=max(ans,i+j);
    if(i==n) break;
    t+=a[i];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 5188
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //------------------------------
    string s;cin>>s;
    int q;cin>>q;
    string left="";
    string right="";
    bool now=1;
    while(q--){
        int T;cin>>T;
        if(T==1){
            now=1-now;
        }
        else{
            int F;cin>>F;
            char c;cin>>c;
            if(F==1){
                if(now==1){
                    left+=c;
                }
                else{
                    right+=c;
                }
            }
            else{
                if(now==1){
                    right+=c;
                }
                else{
                    left+=c;
                }
            }
        }
    }
    if(now==1){
        reverse(all(left));
        left+=s;
        left+=right;
        cout<<left<<endl;
    }
    else{
        reverse(all(right));
        reverse(all(s));
        right+=s;
        right+=left;
        cout<<right<<endl;
        
    }
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------

/*
ll n;cin>>n;
vector<ll>a(n);
for(ll i=0;i<n;i++)
    cin>>a[i];
 
ll n;cin>>s;
string s;cin>>s;

ll n,m;cin>>n>>m;
vector<ll>a(n),b(m);
for(ll i=0;i<n;i++){
    cin>>a[i];
}
for(ll i=0;i<m;i++){
    cin>>b[i];
}

ll n;cin>>n;
vector<Pll>xy;
for(ll i=0;i<n;i++){
    ll x,y;cin>>x>>y;
    xy.pb({x,y});
}
*/


Measured memory_bytes: 1300
#include <iostream>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;

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

int main()
{
    int s,w;
    cin>>s>>w;
    if(w>=s)
        cout<<"unsafe";
    else
        cout<<"safe";
    return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <random>
#include <functional>

#include <fstream>
#include <vector>
#include <algorithm>

#define ll long long int

using namespace std;

bool isPrime(ll n)
{
    if(n == 1)
    {
        return false;
    }
    for(ll i = 2; i*i <= n; i++)
    {
        if(n % i == 0)
        {
            return false;
        }
    }
    
    return true;
}

int main(void)
{

    
    ll a;
    
    cin >> a;
    
    while(a > 1000)
    {
        a -= 1000;
    }
    
    cout << 1000 -a;
    
    return 0;
}

Measured memory_bytes: 3648
X,Y=input().split()
X=int(X)
Y=int(Y)
a=(Y-2*X)*5 
b=(4*X-Y)*5 
a1=a%10
b1=b%10
if a>=0 and b>=0:
  if a1==0 and b1==0:
    print("Yes")
  else:
    print("No")
else:
  print("No")



Measured memory_bytes: 9172
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
#include <cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9+7;
class RollHash
{
	public:
	ull base=1e9+7;
	RollHash(){}
	RollHash(ull b)
	{
		base=b;
	}
	//sの[l,r)におけるハッシュ値を計算する
	ull calchash(string &s,int l,int r)
	{
		ull ret=0;
		for(int i=l;i<min(r,(int)s.size());i++)
			ret=ret*base+s[i];
		return ret;
	}
	//aはbに含まれているか？
	//含まれていれば最初に一致した場所の先頭のindex
	//含まれていなければ-1
	int contain(string &a,string &b)
	{
		int al=a.size();int bl=b.size();
		if(al>bl)
			return false;
		ull t=1;
		for(int i=0;i<al;i++)
			t*=base;
		ull ah=0;ull bh=0;
		for(int i=0;i<ah;i++)
			ah=ah*base+a[i];
		for(int i=0;i<ah;i++)
			bh=bh*base+b[i];
		if(ah==bh)
			return 0;
		for(int i=0;i+al<bl;i++)
		{
			bh=bh*base+b[i+al]-b[i]-t;
			if(ah==bh)
				return i;
		}
		return -1;
	}
	//aの末尾とbの先頭を何文字重ねることができるか
	int overlap(string &a,string &b)
	{
		int al=a.size();int bl=b.size();
		int ret=0;
		ull ah=0;ull bh=0; ull t=1;
		for(int i=1;i<=min(al,bl);i++)
		{
			ah=ah+a[al-i]*t;
			bh=bh*base+b[i-1];
			if(ah==bh)
				ret=i;
			t*=base;
		}
		return ret;
	}
};
ull shash[5001];
ull t[5001];
int main()
{
	int n;
	string s;
	RollHash h=RollHash();
	cin>>n>>s;
	shash[0]=0;
	for(int i=1;i<n+1;i++)
		shash[i]=shash[i-1]*h.base+s[i-1];
	t[0]=1;
	for(int i=1;i<5001;i++)
		t[i]=t[i-1]*h.base;
	//順番に調べる
	ull l,r;
	//midは長さ
	int ok=0;
	int ng=n/2+1;
	while(ng-ok>1)
	{
		int mid=(ok+ng)/2;
		bool f=false;
		for(int i=0;i<n;i++)
		{
			if(mid+i>n)
				break;
			//cerr<<k<<" "<<i<<endl;
			l=shash[mid+i]-t[mid]*shash[i];
			assert(h.calchash(s,i,mid+i)==l);
			for(int j=mid+i;j+mid<=n;j++)
			{
				r=shash[j+mid]-t[mid]*shash[j];
				if(l==r)
				{
					ok=mid;
					f=true;
					break;
				}
			}
			if(f)
				break;
		}
		if(!f)
			ng=mid;
	}
	cout<<ok<<endl;
	return 0;
}

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

using namespace std;
int H,W,h,w;
int ans[501][501];

int main() {
  cin >> H >> W >> h >> w;

  if(H % h == 0 && W % w == 0) {
    cout << "No" <<endl;
    return 0;
  }

  for(int i = h-1; i < H; i += h) {
    for(int j = w-1; j < W; j+= w) {
      ans[i][j] = -(h*w-1) * 500 - 1;
    }
  }
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      if(ans[i][j] == 0) ans[i][j] = 500;
    }
  }

  int sum = 0;
  cout <<"Yes"<<endl;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
        cout << ans[i][j]<<' ';
      // sum += ans[i][j];
    }
  
    cout << endl;
  }
  // cout <<"sum = "<<sum<<endl;
}
  


Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>
#define MAX_N 123456 * 2
using namespace std;

bool t[MAX_N];
int n;

bool isPrime(int x) {
  if(x == 2) return true;
  if(x < 2 || x % 2 == 0) return false;
  int i = 3;
  while(i * i <= x) {
    if(x % i == 0) return false;
    i += 2;
  }
  return true;
}

void table() {
  for(int i = 0; i < MAX_N; ++i) {
    if (isPrime(i)) t[i] = 1;
  }
}

void solve() {
  int sum = 0;
  for(int i = n + 1; i <= n * 2; ++i) {
    if(t[i]) sum++;
  }
  cout << sum << endl;
}

int main() {
  table();
  while(cin >> n && n) {
    solve();
  }
  return 0;
}



Measured memory_bytes: 3352
import math

a, b, h, m = list(map(int, input().split()))

a_angle = 30 * h + 30 * m / 60
b_angle = 6 * m

angle = abs(a_angle - b_angle)
angle = min(360 - angle, angle)

c = a**2 + b**2 - 2 * a * b * math.cos(math.radians(angle))
print(c**0.5)

Measured memory_bytes: 9520
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

int main(){

	int n, q;
	cin >> n;
	vector<int> A(n);
	for (int i = 0; i < n; i++) cin >> A[i];
	cin >> q;
	vector<int> m(q);
	for (int i = 0; i < q; i++) cin >> m[i];

	vector<int> C(1 << n, 0);
	for (int i = 1; i < (1 << n) + 1; i++){
		for (int j = 0; j < n; j++) C[i - 1] += A[j] * ((i & (1 << j)) == (1 << j));
	}
	bool isRepresentable;
	for (int i = 0; i < q; i++){
		isRepresentable = false;
		for (int j = 0; j < (1 << n); j++){
			if (m[i] == C[j]){
				cout << "yes" << endl;
				isRepresentable = true;
				break;
			}
		}
		if (!isRepresentable) cout << "no" << endl;
	}

	return 0;
}


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

const int MAXN = 1000000 + 10;
const int MOD = 1e9 + 7;
int n, m;
int a[MAXN];

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin >> n >> m;

    if (abs(n-m) > 1) {
        cout << "0\n"; return 0;
    }

    int res = 1;
    for (int i = 1; i <= n; i++)
        res = res * i % MOD;
    for (int i = 1; i <= m; i++)
        res = res * i % MOD;

    if (n==m) res = 2*res % MOD;

    cout << res << "\n";


    return 0;
}


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

vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};

void bfs(vector<vector<int>> &x, vector<vector<int>> &d) {
  int h2 = x.size(), w2 = x.at(0).size();
  queue<pair<int, int>> q;
  q.push({0, 0});
  d.at(0).at(0) = 0;
  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop();
    for (int i = 0; i < 4; i++) {
      int nr = p.first + dx[i], nc = p.second + dy[i];
      if (0 <= nr && nr < h2 && 0 <= nc && nc < w2) {
        if (x.at(nr).at(nc) == 0 && d.at(nr).at(nc) == -1) {
          d.at(nr).at(nc) = d.at(p.first).at(p.second) + 1;
          q.push({nr, nc});
        }
      }
    }
  }
  return;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  while (true) {
    int w, h;
    cin >> w >> h;
    if (w + h == 0) break;
    
    vector<vector<int>> x(2 * h - 1, vector<int>(2 * w - 1, 0));
    for (int i = 0; i < 2 * h - 1; i++) {
      for (int j = 0; j < 2 * w - 1; j++) {
        if (i % 2 == 1 && j % 2 == 1) x.at(i).at(j) = 1;
      }
    }
    
    for (int i = 0; i < 2 * h - 1; i++) {
      for (int j = 0; j < (i % 2 == 0 ? w - 1 : w); j++) {
        if (i % 2 == 0) {
          cin >> x.at(i).at(2 * j + 1);
        }
        else {
          cin >> x.at(i).at(2 * j);
        }
      }
    }
    
    vector<vector<int>> d(2 * h - 1, vector<int>(2 * w - 1, -1));
    bfs(x, d);
    
    if (d.at(2 * h - 2).at(2 * w - 2) == -1) cout << "0\n";
    else cout << d.at(2 * h - 2).at(2 * w - 2) / 2 + 1 << '\n';
  }
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    array<int, 5> a;
    rep(i, 0, 5) cin >> a[i];
    int k;
    cin >> k;
    rep(i, 0, 5)
    {
        rep(j, i + 1, 5)
        {
            if (a[j] - a[i] > k)
            {
                cout << ":(" << endl;
                return;
            }
        }
    }
    cout << "Yay!" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size() 
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)


/****************************** CODE IS HERE ***********************************/

const int N = 1e6 + 9;

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

    int n; cin >> n;
    vector <int> A(N, 0);
    int gcd = 0;
    for (int i = 0, u; i < n; ++i) {
        cin >> u;
        A[u]++;
        gcd = __gcd(gcd, u);
    }

    bool ok = true;
    for (int i = 2; i < N; ++i) {
        int total = 0;
        for (int j = i; j < N; j += i) {
            total += A[j];
        }
        if (total > 1) ok = false;
    }

    if (ok) cout << "pairwise coprime";
    else if (gcd == 1) cout << "setwise coprime";
    else cout << "not coprime";


    return 0;
}


/*
 * Try to think these types of problem like graphs(DAG), like if A divides B, then put the edge from A to B.
  But keep graph simple, try to not make extra edges (or transitive edges), ex: A -> B, and B-> C, then it is obvious
  A->C also exists, but no need to show.


*/


Measured memory_bytes: 7144
if __name__=='__main__':
    n,m = map(int,input().split())
    h = [int(x) for x in input().split()]
    a = []
    b = []
    good_obs = [True for i in range(n)]
    for i in range(m):
        x,y = map(int,input().split())
        a.append(x)
        b.append(y)
        if h[x-1]<=h[y-1]:
            good_obs[x-1]=False
        if h[x-1]>=h[y-1]:
            good_obs[y-1]=False
    print(good_obs.count(True))

Measured memory_bytes: 23088
N, K = map(int, input().split())
S = input()

happy = 0
ncc = 1 # number of connected components
for i in range(N - 1):
    ncc += S[i] != S[i + 1]
if ncc >= 3:
    p = min(K, (ncc - 1) // 2)
    ncc -= 2 * p
    K -= p
if ncc == 2 and K > 0:
    ncc -= 1
print(N - ncc)

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

class Main {

	void solve() {
		
		int x = inint(), a = inint(), b = inint();
		int adif = Math.abs(x-a);
		int bdif = Math.abs(x-b);
		out.println(adif<bdif? "A" : "B");
		
	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}
	
	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}
	
	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

}

Measured memory_bytes: 21844
// ref: https://atcoder.jp/contests/abc054/submissions/8585283
#include <bits/stdc++.h>
using namespace std;

void search(int& sum, const vector<vector<int>>& mat, vector<int>& vecIsUsed, int r, int steps){
    if(steps == mat.size()-1){ ++sum; return; }
    
    for(int i=1; i<mat.size(); ++i){
        if(mat[r][i]==0 || vecIsUsed[i]==1){ continue; }
        vecIsUsed[i] = 1;
        search(sum, mat, vecIsUsed, i, steps+1);
        vecIsUsed[i] = 0;
    }
    return;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N, M;
    cin >> N >> M;
    vector<vector<int>> mat(N, vector<int>(N, 0));
    
    for(int i=0; i<M; ++i){
        int a; cin >> a; --a;
        int b; cin >> b; --b;
        mat[a][b] = 1;
        mat[b][a] = 1;
    }
    
    vector<int> vecIsUsed(N, 0);
    int sum=0;
    search(sum, mat, vecIsUsed, 0, 0);
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(dead_code)]
use proconio::input;
use proconio::marker::*;
use std::cmp::{min, max};
use std::collections::{HashSet, HashMap, BinaryHeap, VecDeque};

static MOD: i64 = 1e9 as i64 + 7;

fn main() {
    input! {
        n: usize,
        d: [(usize, usize); n],
    }
    let mut cnt = 0;
    let mut m = 0;
    for i in 0..n{
        if d[i].0 == d[i].1{
            cnt += 1;
        }else{
            cnt = 0;
        }
        m = max(m, cnt);
    }
    let ans = if m >= 3{ "Yes" }else{ "No" };
    println!("{}", ans);
}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define SET(a, b) memset((a), (b), sizeof(a))
template <class t>
bool ckmin(t& a, const t& b) {
    return a > b ? a = b, true : false;
}
template <class t>
bool ckmax(t& a, const t& b) {
    return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
    if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p);
template <class T>
struct IsC {
    template <class C>
    static char test(typename C::const_iterator*);
    template <class C>
    static int test(...);
    static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
    static const bool value = false;
};
template <class C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream& o,
                                                             const C& c) {
    o << '[';
    for (auto it = c.begin(); it != c.end();)
        o << *it << (++it != c.end() ? ", " : "");
    return o << ']';
}
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p) {
    return o << '(' << p.fi << ", " << p.se << ')';
}

void solve() {
    int n;
    cin >> n;
    vector<ll> as(n);
    string s;
    F0R (i, n) cin >> as[i];
    cin >> s;
    vector<ll> base;
    R0F (i, n - 1) {
        ll k = as[i];
        for (ll v : base) {
            ckmin(k, k ^ v);
        }
        if (k) {
            if (s[i] == '1') {
                cout << 1 << endl;
                return;
            } else {
                base.pb(k);
            }
        }
    }
    cout << 0 << endl;
}

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

    int tt = 1;
    cin >> tt;
    FOR (t, 1, tt + 1) {
	// cout << "Case #" << t << ": ";
	solve();
    }

    return 0;
}


Measured memory_bytes: 3580
input = $stdin.readlines
tmp1=input[0].chomp.split
n=tmp1[0].to_i
tt=tmp1[1].to_i
result=0
for a in 1..n do
    tmp2=input[a].chomp.split
    c=tmp2[0].to_i
    t=tmp2[1].to_i
    if t<=tt then 
        if result>c then
          result=c
        end
        if result==0 then
          result=c
        end
    end
end
case result
  when 0 then
    puts 'TLE'
  else
    p result
end

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

using namespace std;
typedef long long ll;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;
    


int main(){
    char a;
    cin>>a;
    if(a>='a'&&a<='z')cout<<'a';
    else cout<<'A';
}

Measured memory_bytes: 3588
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, a, b = list(map(int, input().rstrip('\n').split()))
    h = [int(input().rstrip('\n')) for _ in range(n)]

    cor_v = 10 ** 20
    inc_v = -1
    while cor_v - inc_v > 1:
        bin_v = (cor_v + inc_v) // 2
        cost = 0
        #条件を満たすcostを全検索
        for v in h:
            if v > bin_v * b:
                cost += (v - bin_v * b + (a - b) - 1) // (a - b)
        #costが制約を満たすか
        if cost <= bin_v:
            cor_v = bin_v
        else:
            inc_v = bin_v
    print(cor_v)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 44892