akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N,ans; cin >> N;
  vector<ll> vv(N),cv(N),dv(N);
  for (ll i = 0; i < N; ++i) cin >> vv[i];
  for (ll i = 0; i < N; ++i) cin >> cv[i];
  for (ll i = 0; i < N; ++i) dv[i] = vv[i] - cv[i];
  sort(dv.begin(), dv.end());
  if (dv[N-1] <= 0) cout << 0 << endl;
  else {
    ll i = N-1;
    while(dv[i] > 0 && i >= 0) {
      ans += dv[i]; i-=1;
    }
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define int long long
#define vi vector<int>
#define vii vector<pair<int,int>>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define endl '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
int mod=1e9+7;
int max(int a,int b){if(a>b) return a; else return b;}
int max3(int a, int b, int c){ if(a>b){if(a>c) return a; else return c;}else{if(b>c)return b;else return c;}}
int power(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
signed main()
{
	IOS;
    int t;
    //cin>>t;
	t=1;
    while(t--)
    {
		string s;
		cin>>s;
		for(auto it: s)
		{
			if(it=='7')
			{
				cout<<"Yes";
				return 0;
			}
		}
		
		cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 3636
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>

class BPalindromePhilia {
public:
	void solve(std::istream& cin, std::ostream& cout) {
	    std::string s;
	    cin >> s;
	    int count = 0;
	    for(int i =0;i<s.length()/2;i++){
	        if(s[i] != s[s.length() - 1 - i]){
	            count++;
	        }
	    }
	    cout << count;
	}
};


int main() {
	BPalindromePhilia solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;
int Ans[2010];


int main()
{
    int n,x,y;  cin >> n >> x >> y;
    for(int i = 1;i<=n;i++){
        for(int j = i + 1;j<=n;j++){
            int idx;
            if(i >= x && j <= y)  idx = min(j - i , (i - x) + 1 + (y - j));
            else if(i < x && j > y)
                idx = (x - i) + 1 + (j - y);
            else if(i < x && j <= y)
                idx = x - i + min(j - x , 1 + (y - j));
            else
                idx = j - y + min(y - i , 1 + (i - x));
            Ans[idx]++;
        }
    }
    for(int i = 1;i<n;i++)  cout << Ans[i] << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define INF 0x3f3f3f3f
#define mod 1000000009
#define e  2.718281828459045
#define eps 1.0e18
#define PI acos(-1)
#define lowbit(x) (x&(-x))
#define memset(x,y) memset(x,y,sizeof(x))
#define lson i << 1,l,m
#define rson i << 1 | 1,m + 1,r
#define ll long long
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int n;
	int a[1005];
	cin>>n;
	int f=1;
	while(n--){
		int x;
		cin>>x;
		if(x%2==0){
			if(x%3 && x%5){
				f=0;
			}
		}
	}
	if(!f) cout<<"DENIED"<<endl;
	else cout<<"APPROVED"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int s,n;
    cin>>s>>n;
    vector<int> l;
    int temp;
    while(s--){
        cin>>temp;
        l.push_back(temp);
    }
    sort(l.begin(),l.end());
    int su=0;
    for(int i=0;i<n;i++)su+=l[i];
    cout<<su<<'\n';
    return 0;
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int n,k,x[100000];
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>x[i];
    int ans=1e9;
    for(int i=0;i<=n-k;i++)
        ans=min({ans,abs(x[i])+abs(x[i+k-1]-x[i]),abs(x[i+k-1])+abs(x[i]-x[i+k-1])});
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <limits>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
	string S; cin >> S;
	cout << S.substr(0, 3) << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,m;
  cin >> n >> m;
  vector<int> a(n);
  ll sum = 0;
  unordered_map<int, ll> mp;
  mp[0]++;
  REP(i,n){
    cin >> a[i];
    sum += a[i];
    mp[sum%m]++;
  }
  ll ans = 0;
  for(auto itr: mp){
    if(itr.second<2) continue;
    ans += itr.second * (itr.second-1) / 2;
  }
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

int N;
int A[2][3];

signed main()
{
  cin >> N;
  REP(n,2) {
    REP(m,3) {
      cin >> A[n][m];
    }
  }

  vector<int> mvec;
  REP(m,3) {
    if(A[0][m] < A[1][m]) {
      mvec.push_back(m);
    }
  }

  if(mvec.size() == 0) {

  } else if(mvec.size() == 1) {
    N = N%A[0][mvec[0]] + N/A[0][mvec[0]]*A[1][mvec[0]];
  } else if(mvec.size() == 2) {
    int ans = N;
    REP(n,N+1) {
      int tmp = (N-n)%A[0][mvec[0]] + (N-n)/A[0][mvec[0]]*A[1][mvec[0]] +
                n%A[0][mvec[1]] + n/A[0][mvec[1]]*A[1][mvec[1]];
      ans = max(ans, tmp);
    }
    N = ans;
  } else {
    int ans = N;
    REP(n1,N+1) {
      for(int n2 = 0; n2 + n1 <= N; n2++) {
        int n3 = N - n1 - n2;
        int tmp = n1%A[0][mvec[0]] + n1/A[0][mvec[0]]*A[1][mvec[0]] +
                  n2%A[0][mvec[1]] + n2/A[0][mvec[1]]*A[1][mvec[1]] +
                  n3%A[0][mvec[2]] + n3/A[0][mvec[2]]*A[1][mvec[2]];
        ans = max(ans, tmp);     
      }
    }
    N = ans;
  }

  mvec.clear();

  REP(m,3) {
    if(A[0][m] > A[1][m]) {
      mvec.push_back(m);
    }
  }

  if(mvec.size() == 0) {

  } else if(mvec.size() == 1) {
    N = N%A[1][mvec[0]] + N/A[1][mvec[0]]*A[0][mvec[0]];
  } else if(mvec.size() == 2) {
    int ans = N;
    REP(n,N+1) {
      int tmp = (N-n)%A[1][mvec[0]] + (N-n)/A[1][mvec[0]]*A[0][mvec[0]] +
                n%A[1][mvec[1]] + n/A[1][mvec[1]]*A[0][mvec[1]];
      ans = max(ans, tmp);
    }
    N = ans;
  } else {
    int ans = N;
    REP(n1,N+1) {
      for(int n2 = 0; n2 + n1 <= N; n2++) {
        int n3 = N - n1 - n2;
        int tmp = n1%A[1][mvec[0]] + n1/A[1][mvec[0]]*A[0][mvec[0]] +
                  n2%A[1][mvec[1]] + n2/A[1][mvec[1]]*A[0][mvec[1]] +
                  n3%A[1][mvec[2]] + n3/A[1][mvec[2]]*A[0][mvec[2]];
        ans = max(ans, tmp);     
      }
    }
    N = ans;
  }

  cout << N << endl;

  return 0;
}

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

int main()
{
    int x1, y1, x2, y2, x3, y3, x4, y4;
    
    cin >> x1 >> y1 >> x2 >> y2;
    
    int dist1, dist2;
    
    dist1 = x2 - x1;
    dist2 = y2 - y1;
    
    y3 = y2 + dist1;
    x3 = x2 - dist2;
    
    y4 = y1 + dist1;
    x4 = x1 - dist2;
    
    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
    return 0;
}

Measured memory_bytes: 256
const UNIT_DEF = {
  hon: [2, 4, 5, 7, 9],
  pon: [0, 1, 6, 8],
  bon: [3]
};

process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on("data", input => {
  if (input > 1000 || isNaN(input)) {
    return;
  }
  const ichinokurai = input % 10;
  const result = Object.keys(UNIT_DEF).find(key =>
    UNIT_DEF[key].includes(ichinokurai)
  );
  console.log(result);
});


Measured memory_bytes: 29928
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <stack>

using namespace std;


int main(){

	int coin[6] ={ 500,100,50,10,5,1 },sum,price;

	while(true){
		scanf("%d",&price);
		if(price == 0)break;

		sum = 0;

		price = 1000 - price;

		for(int i = 0; i <= 5; i++){
			while(price >= coin[i]){
				price -= coin[i];
				sum++;
			}
		}

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

    return 0;
}



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

int main() {
    const int MAX_N = 10000;
    int n = 0, x;
    // std::vector<int> ds(MAX_N, 0);

    for (int i = 0; i < MAX_N; i++) {
        std::cin >> x;
        if (x == 0) {
            break;
        } else {
            std::cout << "Case " << i + 1 << ": " << x << std::endl;
        }
        // if (ds[i] == 0) {
        //     n = i;
        //     break;
        // }
    }
    
    // for (int i = 0; i < n; i++) {
        
    // }
    return 0;
}


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

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

  int n;
  cin >> n;

  map<string,int> mp;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;

    ++mp[s];
  }

  cout << "AC x " << mp["AC"] << '\n';
  cout << "WA x " << mp["WA"] << '\n';
  cout << "TLE x " << mp["TLE"] << '\n';
  cout << "RE x " << mp["RE"] << '\n';

  return (0);
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++) cin >> h[i];
    vector<int> dp(n, INF);
    dp[0] = 0;
    for (int i = 0; i < n; i++){
        for (int j = i + 1; j <= i + k; j++){
            if (j < n)
                dp[j] = min (dp[j], dp[i] + abs(h[i] - h[j]));
        }
    }
    cout << dp[n - 1];
}


Measured memory_bytes: 1024
package main

import "fmt"

func main() {
	var n int
	fmt.Scanln(&n)
	l, r, max := 0, 63, 0
	for l <= r {
		m := (l + r) / 2
		pow2 := 1 << uint(m)
		if pow2 <= n {
			l = m + 1
			if pow2 > max {
				max = pow2
			}
		} else {
			r = m - 1
		}
	}
	fmt.Println(max)
}


Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[])
{
  char s[101];
  scanf("%s",s);
  if(s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I'){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
	int i,a,t=0,h=0;
	char A[201],B[201];
	scanf("%d",&a);
	for(i=0;i<a;i++){
		scanf("%s %s",A,B);
		if(strcmp(A,B)>0)t=t+3;
		else if(strcmp(A,B)<0)h=h+3;
		else{
			t++;
			h++;
		}
	}
	printf("%d %d\n",t,h);
	return 0;
}




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

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

int main(){

  while(true){
    int n, l; cin>> n>> l;
    if(n==0 and l==0) break;
    vector<int> rtun(l+1, -1);
    vector<int> ltun(l+1, -1);
    rep(i, n){
      char dir; int pos; cin>> dir>> pos;
      if(dir=='R') rtun[pos]=i+1;
      if(dir=='L') ltun[pos]=i+1;
    }

    int rem=n, t=0;
    while(true){
      t++;
      // 右向きのアリを動かす
      for(int i=l-1; i>=1; i--){
        const auto idx=rtun[i];
        if(idx>=0){
          if(i+1==l){
            if((--rem)==0){
              cout<< t<< " "<< idx<< endl;
              goto heaven;
            }
          }else{
            rtun[i+1]=idx;
          }
          rtun[i]=-1;
        }
      }
      // 左向きのアリを動かす
      for(int i=1; i<l; i++){
        const auto idx=ltun[i];
        if(idx>=0){
          if(i==1){
            if((--rem)==0){
              cout<< t<< " "<< idx<< endl;
              goto heaven;
            }
          }else{
            ltun[i-1]=idx;
          }
          ltun[i]=-1;
        }
      }
      // 反転
      rep(i, l){
        const auto lidx=ltun[i], ridx=rtun[i];
        if(lidx>=0 and ridx>=0){
          swap(ltun[i], rtun[i]);
        }
      }
    }
    heaven:;
  }

  return 0;
}


Measured memory_bytes: 2992
#include <iostream>
#include <cstring>
using namespace std;
int N;
long long L;
char Str[100005];
int len;
long long cnt;
struct Trie{
int ap;
Trie * next[2];
Trie()
{
    ap = 0;
    next[0] = NULL;
    next[1] = NULL;
}
};
Trie * Root = new Trie;
void insert(Trie * node, int pos)
{
    if(pos == len + 1)
    {
        node -> ap = 1;
        return;
    }
    int dig = Str[pos] - '0';
    if(node -> next[dig] == NULL)
    {
        node -> next[dig] = new Trie;
    }
    insert(node -> next[dig], pos + 1);
}

void Count(Trie * node, int lv)
{
    if(node -> next[0] == NULL && node -> next[1] == NULL)
        return;
    for(int i = 0; i < 2; i++)
    {

        if(node -> next[i] == NULL)
        {
            long long nb = L - lv;
            int aux = 0;
            while(nb % 2 == 0)
            {
                aux++;
                nb /= 2;
            }
            cnt ^= (1LL << aux);
        }
        else
            Count(node -> next[i], lv + 1);
    }
}

void Read()
{
    cin >> N >> L;
    cin.get();
    for(int i = 1; i <= N; i++)
    {
        cin.getline(Str + 1, 100005);
        len = strlen(Str + 1);
        insert(Root, 1);

    }
}
int main()
{
    Read();
    Count(Root, 0);
    if(cnt == 0)
    {
        cout << "Bob\n";
    }
    else
        cout << "Alice\n";
    return 0;
}


Measured memory_bytes: 8192
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (Q, H, S, D): (i64, i64, i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let N: i64 = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().parse().unwrap()
    };

    let c = vec![8 * Q, 4 * H, 2 * S, D];
    let m = (0..4).min_by_key(|&i| c[i]).unwrap();

    let ans = if m == 0 {
        4 * Q * N
    } else if m == 1 {
        2 * H * N
    } else if m == 2 {
        S * N
    } else {
        let x = *vec![4 * Q, 2 * H, S].iter().min().unwrap();
        (N / 2) * D + (N % 2) * x
    };

    println!("{}", ans);
}


Measured memory_bytes: 4352
def main():
    N = input()

    for h in range(1, 3501):
        for n in range(1, 3501):
            r1 = h * n * N
            r2 = 4 * h * n - h * N - n * N
            if r2 > 0 and r1 % r2 == 0:
                print "%d %d %d" % (h, n, r1 / r2)
                return

main()


Measured memory_bytes: 2948
use std::io::BufRead;

fn main() {
    let stdin = std::io::stdin();
    let mut size = String::new();
    stdin.lock().read_line(&mut size).unwrap();

    let mut nums = String::new();
    stdin.lock().read_line(&mut nums).unwrap();
    let mut v: Vec<i32> = nums.split_whitespace().map(|s| s.parse().unwrap()).collect();

    let mut c = 0;
    'outer: loop {
        for el in &v {
            if el % 2 != 0 {
                break 'outer
            }
        }
        v = v.iter_mut().map(|el| *el / 2).collect();
        c += 1;
    }
    println!("{}", c);
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] k = sc.next().toCharArray();
		int d = sc.nextInt();
		sc.close();

		int n = k.length;
		int mod = 1000000007;
		long[][] dp0 = new long[n + 1][d];
		long[][] dp1 = new long[n + 1][d];
		dp0[0][0] = 1;
		for (int i = 0; i < n; i++) {
			int c = k[i] - '0';
			for (int j = 0; j < d; j++) {
				for (int j2 = 0; j2 < c; j2++) {
					dp1[i + 1][(j + j2) % d] += dp0[i][j];
				}
				dp0[i + 1][(j + c) % d] += dp0[i][j];
				for (int j2 = 0; j2 < 10; j2++) {
					dp1[i + 1][(j + j2) % d] += dp1[i][j];
				}
			}
			for (int j = 0; j < d; j++) {
				dp0[i + 1][j] %= mod;
				dp1[i + 1][j] %= mod;
			}
		}
		long ans = dp0[n][0] + dp1[n][0] - 1 + mod;
		ans %= mod;
		System.out.println(ans);
	}
}


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

signed main() {
  int N;
  cin >> N;
  
  int total = 0;
  int A = 0;
  for( int i = 1; i <= N; i++ ){
    total += i;
    if( total >= N ){
      A = i;
      break;
    }
  }
  
  for( int i = 1; i <= A; i++ ){
    if( total-N != i ) cout << i << endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
using namespace std;

int main()
{
    int N;
    scanf("%d", &N);
    vector<int> T(N), A(N);
    long long t, a;
    REP(i, N) {
        scanf("%d%d", &T[i], &A[i]);
    }
    t = T[0]; a = A[0];
    long long int k, l;
    for(int i = 1; i < N; i++) {
        k = t / T[i];
        l = a / A[i];
        if (t % T[i] != 0) k++;
        if (a % A[i] != 0) l++;
        k = max(k, l);
        t = T[i] * k;
        a = A[i] * k;
        //printf("i = %dのあとt = %lld, a = %lld\n", i, t, a);
    }
    printf("%lld\n", t + a);
}

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

using namespace std;

int main(){
    int n, k;
    scanf("%d %d", &n, &k);

    vector<int> len(n);
    for(int i = 0; i < n; i++){
        scanf("%d", &len[i]);
    }

    sort(len.begin(), len.end());

    int ans = 0;

    for(int i = n - 1; i >= n - k; i--){
        ans += len[i];
    }

    printf("%d", ans);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
using namespace std;
int main(){
    int N,K;
    cin >> N >> K;
    string s;
    cin >> s;
    for(int i=0;i<N;i++){
        if(i+1==K){
            if(s[i]=='A'){
                s[i] = 'a';
            }else if(s[i]=='B'){
                s[i] = 'b';
            }else{
                s[i] = 'c';
            }
        }
    }
    cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

	long long int l[87];
	l[0]=2;
	l[1]=1;
	
	int n;
	cin>>n;
	
	for(int i=2; i<=n; i++)
	{
		l[i]=l[i-1]+l[i-2];
	}
	
	cout<< l[n];

	return 0;
}

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

int main() {
  int n, x;
  cin >> n >> x ;
  vector <int> c(n);
  int sum =0 ;
  int ans =0 ;
  for (int i=0 ; i<n ;i++){
    cin >> c.at(i);
    sum += c.at(i);
  }
  sort ( c.begin(), c.end()) ;
  ans = n+(x-sum)/c.at(0) ;
  cout << ans << endl;
}

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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;

typedef long long ll;


int main(){

    int n,r;
    cin >> n >> r;

    if(n >= 10){
        cout << r << endl;
    }else{
        cout << r + 100 * (10 - n) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n,x,a,b,c,d;
	while(1){
		d=0;
		scanf("%d %d",&n,&x);
		if(n==0&&x==0){
			break;
		}
		for(a=1;a<=n-2;a++){
			for(b=a+1;b<=n-1;b++){
				for(c=b+1;c<=n;c++){
					if(a+b+c==x){
						d=d+1;
					}
				}
			}
		}
		printf("%d\n",d);
	}
	return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <iostream>
#include <map>
#include <string>

int main(int argc, char* argv[]) {
  int64_t N, M;
  std::cin >> N >> M;
  std::map<int64_t, int64_t> m;
  int64_t A, B;
  for (int j = 0; j < N; j++) {
    std::cin >> A >> B;
    if (m.find(A) == m.end()) {
      m[A] = B;
    } else {
      m[A] += B;
    }
  }
  int64_t val_sum = 0;
  int64_t cnt_sum = 0;
  for (auto&& e : m) {
    int64_t n = std::min(M - cnt_sum, e.second);
    cnt_sum += n;
    val_sum += e.first * n;
    if (n == 0) {
      break;
    }
  }
  std::cout << val_sum << std::endl;
  return 0;
}


Measured memory_bytes: 6528
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	int b = sc.nextInt();
	int c = sc.nextInt();
	int d = 0;
	
	for(int i=a; i <= b;i++) {
		if(c%i==0) {
			d++;
		}
	}
	System.out.println(d);
 }
}



Measured memory_bytes: 26324
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        k: i64, x: i64,
    }
    let mut first = true;
    for i in x - k + 1..x + k {
        if first {
            print!("{}", i);
        } else {
            print!(" {}", i)
        }
        first = false;
    }
    println!("");
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>

using namespace std;


int main() {

    int N;
    cin >> N;

    long long l = 1000000000000000000;
    vector<long long> vs;
    for (int i = 0; i < N; ++i) {
        long long A;
        cin >> A;
        vs.push_back(A);

    }
    sort(vs.begin(), vs.end());

    long long s = vs[0];

    for (int i = 1; i < N; ++i) {
        if (s  > (l / vs[i])) {
            s = -1;
            break;
        } else {
            s = s * vs[i];
        }
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 4252
N,M=map(int,input().split());mod=998244353;B=[]
for i in range(N):
    s=int(input().replace(" ",""),2)
    for b in B:s=min(s,s^b)
    if s!=0:B.append(s)
print((pow(2,N+M-1,mod)*(1-pow(2,mod-1-len(B),mod)))%mod)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;


int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int MAX=max({a, b, c});
  cout << a+b+c-MAX+MAX*pow(2,k) << endl;
  return 0;
    
  
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

# import numpy as np

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


H, W, K = MI()
c = [list(S()) for _ in range(H)]
# c = np.array(sys.stdin.read().split())
# c = sys.stdin.read().split()

ans = 0
for h in range(1 << H):
    for w in range(1 << W):
        count = 0
        for j in range(H):
            for i in range(W):
                if not ((h >> j) & 1) and not ((w >> i) & 1) and c[j][i] == "#":
                    count += 1
        if count == K:
            ans += 1

print(ans)


Measured memory_bytes: 9208
import java.util.Arrays;
import java.util.Scanner;

class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int a = sc.nextInt(), b = sc.nextInt();
        if (a <= 8 && b <= 8) {
            System.out.println("Yay!");
        } else {
            System.out.println(":(");
        }
    }
}

Measured memory_bytes: 21844
#ifndef _WIN32
#include<iostream>
#endif
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
using namespace std;
typedef long long LL;
#define FOR(i,bg,ed) for(int (i)=(bg);(i)<(ed);(i)++)
#define REP(i,n) FOR(i,0,n)
struct cww {
	cww() {
		ios::sync_with_stdio(false);
		cin.tie(0);
	}
};
template<typename T>
inline bool chmax(T& l, T r) {
	bool res = l < r;
	if (res)l = r;
	return res;
}
template<typename T>
inline bool chmin(T& l, T r) {
	bool res = l > r;
	if (res)l = r;
	return res;
}

typedef vector<LL> V;
typedef vector<V> VV;
const LL INF = 1e15;
int main() {
	LL L;
	int n;
	cin >> L >> n;
	vector<LL> a(n), b(n), c(n);
	map<LL, int> z;
	z[L] = 0;
	z[0] = 0;
	REP(i, n) {
		cin >> a[i] >> b[i] >> c[i];
		b[i] += a[i];
		z[a[i]] = 0;
		z[b[i]] = 0;

	}
	int k = 0;
	for (auto &it : z)it.second = k++;
	vector<LL> d(k);
	k = 0;
	for (auto &it : z)d[k++] = it.first;
	vector<LL> dp(k, INF);
	dp[0] = 0;
	REP(i, k) {
		REP(j, n) {
			if(d[i]==a[j]){
				chmin(dp[z[b[j]]], dp[i] + c[j]);

			}
		}
		FOR(j, i + 1, k) {
			chmin(dp[j], dp[i] + d[j] - d[i]);
		}

	}
	cout << dp.back() << endl;
}


Measured memory_bytes: 3288
#include<iostream>
#include<vector>
#include<cmath>

int main(){
	int numPrime= 100000;
	std::vector<int> primeCumSum(numPrime, 0);
	std::vector<bool> isPrime(numPrime, true);
	isPrime[0]= false;
	primeCumSum[0]= 0;

	int q;
	std::cin>>q;

	std::vector<int> leftList(q);
	std::vector<int> rightList(q);

	for(int i=0; i<q; i++){
		std::cin>>leftList[i];
		std::cin>>rightList[i];
	}

	for(int i=2; i<= sqrt(numPrime); i++){
		if(!isPrime[i-1])
			continue;

		int prod=i;
		while(prod+i <=numPrime){
			prod+= i;
			isPrime[prod-1]= false;
		}
	}

	for(int i=3; i<= numPrime; i+=2){
		int i_ = (i+1)/2;
		primeCumSum[i-1]= primeCumSum[i-3];

		if(isPrime[i-1] && isPrime[i_-1])
			primeCumSum[i-1] += 1;	
	}


	for(int i=0; i< q; i++){
		int right= rightList[i]-1;
		int left= leftList[i]-3;

		if(left>=0)
			std::cout<< primeCumSum[right] - primeCumSum[left] <<std::endl;
		else
			std::cout<< primeCumSum[right]<< std::endl;
	}

	return 0;
}

Measured memory_bytes: 1792
import math
a, b, x = map(int, input().split())
vs = a*a*b
rem = vs - x
if rem > x:
    y = 2*x/(a*b)
    theta = math.degrees(math.atan2(b, y))
    print(theta)
else:
    y = 2*rem/(a*a)
    theta = math.degrees(math.atan2(y, a))
    print(theta)

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

bool is_kaibun(string& s)
{
    bool ret = true;
    rep (i, s.size() / 2)
    {
        if (s[i] != s[s.size() - i - 1]) ret = false;
    }
    return ret;
}

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

    string s;
    cin >> s;

    vs64 cnt(26, 0);
    s64 n = s.size();
    rep (i, n)
    {
        ++cnt[s[i] - 'a'];
    }

    s64 ans = 0;
    rep (i, 26)
    {
        ans += cnt[i] * (cnt[i] - 1) / 2;
    }

    cout << n * (n - 1) / 2 + 1 - ans << "\n";
    return 0;
}



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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

int main(){
    int n, m, ans = 0;
    cin >> n >> m;
    vector<int> a(m);
    for(int i = 0; i < m; i++){
        cin >> a[i];
    }
    ans = max(-1, n - accumulate(begin(a), end(a), 0));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3668
//#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 1000001
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"Yes\n";
#define N cout<<"No\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;

int main()
{
    fast
    lli x,n;
    cin>>x>>n;
    map<lli,lli> mpp;
    for(lli i=1;i<=n;i++)
    {
        lli c;
        cin>>c;
        mpp[c]=1;
    }
    lli diff=INT_MAX;
    lli ans=-1;
    for(lli i=0;i<=1000;i++)
    {
        if(mpp[i]==0)
        {
            if(abs(x-i)<diff)
            {
                diff=abs(x-i);
                ans=i;
            }
        }
    }
    cout<<ans;
}
//a+b=a⊕b+2∗(a&b)
//__builtin_popcount(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";




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

using namespace std;

int main()
{
	int n;
	scanf("%d",&n);
	long double a[10000];
	for(int i=1;i<=n;++i){
		scanf("%Lf",&a[i]);
	}
	sort(a+1,a+n+1);
	long double pre=a[1];
	for(int i=2;i<=n;++i){ 
		pre=(a[i]+pre)/2.0;
	}
	printf("%.10Lf",pre);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll          long long
#define ld          long double
#define pb          push_back
#define pf          push_front
#define mp          make_pair
#define pll         pair<ll,ll>
#define vl          vector<ll>
#define sl          set<ll> 
#define vll         vector<pll>
#define ml          map<ll,ll>
#define mll         map<pll,ll>
#define all(a)      a.begin(),a.end()
#define x           first
#define y           second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define mod         (ll)1000000007
#define lp(i,a,b)   for(ll i=a;i<b;++i)
#define lpr(i,a,b)  for(ll i=a;i>=b;i--)
#define lpd(i,x)    for(auto i:x)
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll inf = (ll)1e18;
ld pi = 3.141592653589;
using namespace std;

ll bpow(ll x, ll v) {	
	if (v == 0)
		return 1 % mod;
	if (v % 2 == 1)
		return (x * bpow(x, v - 1)) % mod;
	ll r = bpow(x, v / 2);
	return (r * r) % mod;	
}

ll lcm(ll a,ll b)
{
	ll ret=(a*b)/__gcd(a,b);
	return ret;
} 

ll solve(){ 
	ll n; cin>>n;
	string s; cin>>s;
	auto ip = unique(s.begin(), s.end());
	cout<<sz(string(s.begin(), ip)); 
}
int main(){
    ios
    ll t=1; 
    //cin>>t;
    while(t--){
    	solve();
    }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
// #include <atcoder/all>

using namespace std;
// using namespace atcoder;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N, X, M;
    cin >> N >> X >> M;
    ll a0 = X % M;
    vector<ll> A;
    set<ll> used;
    A.push_back(X);
    ll last = -1;
    ll ans = 0;
    ans += X;
    rep(i, N-1) {
        ll a = A.back();
        ll v = (a * a) % M;
        if (used.count(v)) {
            last = v;
            break;
        } else {
            ans += v;
            A.push_back(v);
            used.insert(v);
        }
        if (i == N - 2) {
            cout << ans << '\n';
            return;
        }
    }
//    print(A);
//    print(A.back());
//    print((ll) A.size());

    ll idx = -1;
    rep(i, A.size()) {
        if (A[i] == last) {
            idx = i;
            break;
        }
    }
    ll v = 0;
    rep2(i, idx, A.size()) {
        v += A[i];
    }
    ll cnt = A.size() - idx;
    ll R = N - A.size();
    ll r = R / cnt;
    ans += r * v;
    rep(i, R - (cnt * r )) {
        ans += A[idx + i];
    }
    cout << ans << '\n';
    // 492443256176507
    // 492443256042188
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 5896
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <utility>
using namespace std;
using ll = long long int;

int main() {

	int N;
	cin >> N;

	int k = 0;
	for (int i = 1; i < 451; i++) {
		if (i*(i + 1) / 2 != N) {
			continue;
		}
		else {
			cout << "Yes" << endl;
			cout << i+1 << endl;
			k = i;
			break;
		}
	}
	if (!k) { cout << "No"; return 0; }

	vector<pair<int,int>> phase(N+1);
	vector<int> ness(k + 1);
	for (int i = 1; i <= k; i++) {
		ness[i] = ness[i - 1] + k + 1 - i;
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= k; j++) {
			if (i <= ness[j]) {
				phase[i] = make_pair(j,i-ness[j-1]);
				break;
			}
		}
	}
	for (int i = 0; i <= k; i++) {
		cout << k;
		for (int j = 1; j <= N; j++) {
			int flag = 0;

			//at Si, j cout?
			if (i == phase[j].first - 1)flag++;
			if (i == phase[j].first - 1 + phase[j].second)flag++;

			if (flag) {
				cout << " " << j;
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define vb __int128
#define ll long long
#define ld long double
#define full(a) a.begin(),a.end()
#define stoink stack<ll>
#define vec vector <ll>
#define vg vector<vector<ll> >
#define vgw vector<vector<pair<ll,ll> >
#define pa pair<ll,ll>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define prec 0.00000000000000000001
#define inf (ll)1e18
#define mod 998244353
ll dp[401][401];
vec arr;
vec pre;
ll n;
ll func(ll l,ll r) {
	if(l == r)
		return 0;
	if(dp[l][r] != -1)
		return dp[l][r];
	ll res = inf,i;
	for(i = l ; i <= r - 1 ; i++) {
		res = min(res,func(l,i) + func(i+1,r) + pre[r] - pre[l-1]);
	}
	return dp[l][r] = res;
}
int main()
{	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n;
	arr.resize(n+1);
	pre.resize(n+1,0);
	ll i;
	ll counti = n;
	for(i = 0 ; i <= n ; i++)
		for(int j = 0 ; j <= n ; j++)
			dp[i][j] = -1;
	ll cost = 0;
	for(i = 1 ; i <= n ; i++) {
		cin >> arr[i];
		pre[i] = arr[i] + pre[i - 1];
	}
	cout << func(1,n);
	return 0;
}

Measured memory_bytes: 4904
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define MAX 100005
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

bool judge(string s){
    string t=s;
    reverse(t.begin(),t.end());
    return s == t;
}
int main(){
    string s;
    cin >>s;
    bool ans=true;
    if(!judge(s))ans=false;
    if(!judge(s.substr(0,s.size()/2)))ans=false;
    cout<<(ans? "Yes":"No")<<endl;

}

Measured memory_bytes: 256
def inv(a,m=10**9+7):
    b=m
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return lastx % m

mod=10**9+7
n,k=map(int,input().split())
k=min(k,n-1)
frac=[1]
for i in range(1,n+1):
    frac.append(frac[-1]*i%mod)

ans=0
for i in range(k+1):
    tmp=inv(frac[i]**2%mod*frac[n-i]*frac[n-1-i]%mod)
    ans+=tmp
    ans%=mod
ans=ans*frac[n]*frac[n-1]%mod
print(ans)

Measured memory_bytes: 52720
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>

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

using namespace std;

int main(){
    int n, S;
    while(cin >> n >> S, n|S){
        vector<int> v(n);
        rep(i, n) cin >> v[i];
        sort(v.begin(), v.end());
        int ans = 0;
        for(int i = 1; i <= v[n-1]; i++){
            int inum = upper_bound(v.begin(), v.end(), i) - lower_bound(v.begin(), v.end(), i);
            int larger = upper_bound(v.begin(), v.end(), 100) - lower_bound(v.begin(), v.end(), max(i+1, S-i+1));
            if(i*2 > S) ans += inum*(inum-1)/2;  
            ans += inum*larger;
        }
        cout << ans << endl;
    }

    return 0;
}

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

int p[100000];
string S[100000];
int f[100000+1];

int main() {

  int n, m; cin >> n >> m;
  for(int i=0; i<m; ++i) cin >> p[i] >> S[i];
  int ac_cnt = 0, wa_cnt = 0;

  for(int i=0; i<m; ++i) {
    if(S[i]=="AC") {
      if(f[p[i]]!=-1) {
        wa_cnt += f[p[i]];
        f[p[i]] = -1;
        ++ac_cnt;
      }
    }else {
      if(f[p[i]]!=-1) ++f[p[i]];
    }
  }

  cout << ac_cnt << " " << wa_cnt << endl;

  return 0;
}


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

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

int main(){

    int64_t N, K;
    cin>>N>>K;
    vector<int64_t> H(N);
    int64_t Min = 0;

    rep(i,N){
        cin >> H.at(i);
    }
    sort(H.begin(), H.end());
    rep(i,N-K){
        Min += H.at(i);
    }

    cout << Min << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
using namespace std;

int gcd(int a, int b){
	if( b > a ) swap(a,b);
	if( fmod(a,b)==0 )	return (b);
	else	return(gcd(b,fmod(a,b)));
}

int main(){
	int k;	cin>>k;
	int total=0;
	for(int a=1; a<=k; a++ ){
		for( int b=1; b<=k; b++ ){
			for( int c=1; c<=k; c++ ){
				total+=gcd(gcd(a,b),gcd(b,c));
			}
		}
	}
	cout << total << endl;
	return 0;
}
	


Measured memory_bytes: 3260
#119-A
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
s=input().split("/")
s=s[0]+s[1]+s[2]
s=int(s)
if s<=20190430:
    print("Heisei")
else:
    print("TBD")

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
struct segment_tree{
    long n = 1;
    vector<long long> data;
    segment_tree(int a){
        while(n<a) n*=2;
        data.push_back(0);
        for(int i = 1;i<2*n;i++) data.push_back(0);
    }
    //segment treeの大きさ取得
    long nreturn(){
        return n;
    }
    //0-indexでk番目の値をaに変更
    void change(long k,long long a){
        k+=n;
        data[k] = a;
        while(k>1){
            k/=2;
            data[k] = data[2*k]+data[2*k+1];
        }
        return;
    }
    //区間[a,b)の総和:呼ぶときはrsq(a,b,1,0,n)
    long long rsq(long long a,long long b,long long k,long long l,long long r){
        if(a>=r || b<=l) return 0;
        if(a<=l && b>=r) return data[k];
        long long teml = rsq(a,b,2*k,l,(l+r)/2);
        long long temr = rsq(a,b,2*k+1,(l+r)/2,r);
        return teml+temr;
    }
};
int main(){
    long n;
    long long k;
    cin >> n >> k;
    long long a[n];
    set<long long> tmpst;
    tmpst.insert(0);
    rep(i,n){
        cin >> a[i];
        a[i]-=k;
    }
    long long csum[n+1];
    csum[0] = 0;
    rep(i,n){
        csum[i+1]=csum[i]+a[i];
        tmpst.insert(csum[i+1]);
        //cout << csum[i+1] << endl;
    }
    map<long long,int> mp;
    long cnt = 0;
    for(auto itr = tmpst.begin();itr!=tmpst.end();itr++){
        mp[*itr] = cnt;
        cnt++;
        //cout << *itr << endl;
    }
    segment_tree tree(tmpst.size());
    long long ans = 0;
    long long tmp;
    tree.change(mp[0],1);
    //cout << mp[0] << endl;
    rep(i,n){
        tmp = mp[csum[i+1]];
        ans+=tree.rsq(0,tmp+1,1,0,tree.n);
        //cout << "csum: "<< csum[i+1] << " tmp: " << tmp << " ans: "<< ans << endl;
        tree.change(tmp,tree.data[tree.n+tmp]+1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 31344
#include<stdio.h>
int main(void) {
    int n,a[100],i;
    double d;
    scanf("%d",&n);
    for(i = 0; i < n; i++) {
        scanf("%d",&a[i]);
    }
    d = (double)(1/(double)a[0]);
    for( i = 1; i < n; i++) {
        d += (double)(1/(double)a[i]);
    }
    printf("%lf\n", (1/d));
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'

using namespace std;

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

template<class T> bool uin(T &a, T b) {return (a < b ? false : (a = b, true));}
template<class T> bool uax(T &a, T b) {return (a > b ? false : (a = b, true));}

//ifstream f(".in");
//ofstream g(".out");

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL_DEFINE
  freopen(".in", "r", stdin);
#endif

  int n;
  cin >> n;
  vector<int> h(n + 2);
  for (int i = 1; i <= n; ++i) {
    cin >> h[i];
  }
  const long long INF = 1e18L + 5;
  vector<long long> dp(n + 2, INF);
  dp[1] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= 2 && i + j <= n; ++j) {
      uin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
    }
  }

  cout << dp[n] << '\n';

#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
#define MAX_NM 202

struct M{
  int r, h;
};

bool ascending_M_r(const M& l, const M& r){
  return l.r < r.r;
}
bool ascending_M_h(const M& l, const M& r){
  return l.h < r.h;
}

int main(void){
  int n, m, dp[MAX_NM];
  M a[MAX_NM];

  while(cin >> n, n){
    for(int i = 0; i < n; i++){
      cin >> a[i].h >> a[i].r;
    }
    cin >> m;
    for(int i = 0; i < m; i++){
      cin >> a[n+i].h >> a[n+i].r;
    }

    int lis_r = 0, lis_h = 0;
    sort(a, a + n + m, ascending_M_r);

    dp[0] = 1;
    for(int i = 1; i < n + m; i++){
      dp[i] = 1;
      for(int j = 0; j < i; j++){
        if(a[j].r < a[i].r && a[j].h < a[i].h){
          dp[i] = max(dp[i], dp[j] + 1);
        }
      }
    }
    lis_r = dp[n+m-1];

    sort(a, a + n + m, ascending_M_h);

    dp[0] = 1;
    for(int i = 1; i < n + m; i++){
      dp[i] = 1;
      for(int j = 0; j < i; j++){
        if(a[j].r < a[i].r && a[j].h < a[i].h){
          dp[i] = max(dp[i], dp[j] + 1);
        }
      }
    }
    lis_h = dp[n+m-1];

    printf("%d\n", max(lis_h, lis_r));
  }
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <utility>
#include <cmath>
#include <iomanip>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;
typedef pair<int,int> P;

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

int main()
{

    int N;
    cin >> N;

    int W[110];
    REP(i,N) cin >> W[i];


    int min = 1000000;

    FOR(i,1,N){
    	int S1=0;
    	int S2=0;

    	FOR(j,0,i){
    		S1+=W[j];
    	}
    	FOR(j,i,N){
    		S2+=W[j];
    	}
    	if(min>abs(S1-S2)) min = abs(S1-S2);
    	//cout << min << endl;
    }


    cout << min << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    cout << ((s[0] == '+') + (s[1] == '+') + (s[2] == '+') + (s[3] == '+')) * 2 - 4;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll k, a, b;
  cin >> k >> a >> b;

  string ans = "NG";
  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      ans = "OK";
      break;
    }
  }

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

#define ll long long
#define ull unsigned long long


int main() {

	int N,x;
	cin >> N >> x;

	vector<ll> a(N);

	for (int i = 0; i < N; i++) {

		cin >> a[i];
	}

	sort(a.begin(), a.end());

	int ans=0;

	for (int i = 0; i < N; i++) {
		if (x >= a[i]) {
			ans++;
			x -= a[i];
		}
		else {
			break;
		}
	}
	if (ans == N && x!=0) ans--;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

char recode(int n, int a, int b){
  int i;
  for(i=0;i<26;i++){
    if( (a*i+b)%26 == n )return (char)(i+'a');
  }

  return 26;
}

int main(void){
  int c,i,j,a,b;
  char str[258];
  char num[258];
  int n;
  int flag;
  int len;

  scanf("%d ",&n);
  
  for(c=0;c<n;c++){
    fgets(str,258,stdin);

    len = strlen(str);

    for(i=0;i<len;i++){
      num[i] = str[i] - 'a';
    }
    
    for(i=0;i<len;i++){
      flag = 0;
      if(num[i]>0 && num[i]<26){
	j=i+1;
	while(num[j]>=0 && num[j]<26)j++;
	if(j-i==4){
	  for(a=1;a<26;a+=2){
	    for(b=0;b<26;b++){
	      if(a != 13){
		if( (a*19+b)%26 == num[i] && (a*7+b)%26 == num[i+1] ){
		  if( b%26 == num[i+2] && num[i] == num[i+3]){
		    flag = 1;
		  }else if( (a*8+b)%26 == num[i+2] && (a*18+b)%26 == num[i+3]){
		    flag = 1;
		  }
		}
	      }
	      if(flag)break;
	    }
	    if(flag)break;
	  }
	}else{
	  i=j;
	}
      }
      if(flag)break;
    }

    for(i=0;i<len;i++){
      if(num[i]>=0 && num[i]<26){
	printf("%c",recode(num[i],a,b) );
      }else{
	printf("%c",str[i]);
      }
    }
  } 
  return 0;
}

Measured memory_bytes: 0