akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#include<cstring>
#define  For(a,b)    for(int a=0;a<b;a++)
#define  si(a)       scanf("%d",&a);
#define  sl(a)       scanf("%lld",&a);
#define  sii(a,b)    scanf("%d%d",&a,&b)
#define  sll(a,b)    scanf("%lld%lld",&a,&b);
#define  queues      priority_queue
#define mod 9983
#define mem(a)  memset(a,-1,sizeof(a))
typedef long long ll;
const int INF=0x3f3f3f3f;
//queues<int,vector<int >,greater<int > >q;
// nth_element()
using namespace std;
int s[300003];
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
  if(b+c>a)
  {
      cout<<min(b,c)<<" "<<b+c-a<<endl;
  }
  else {

    cout<<min(b,c)<<" "<<0<<endl;
  }
}

/******************************************
**        **             ********       **
**       ** **           **             **
**      **   **          **             **
**     **     **         **             **
**    ***********        **             **
**   **         **       ********       **
******************************************/


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
const int maxn=15;
const int maxq=55;
int n,m,q,a[maxq],b[maxq],c[maxq],d[maxq],ans,all[maxn];
void solve(int cur)
{
    if(cur==n+1)
    {
        int res=0;
        for(int i=1;i<=q;i++)
            res+=((all[b[i]]-all[a[i]])==c[i])*d[i];
        ans=max(ans,res);
        return;
    }
    for(int i=all[cur-1];i<=m;i++)
    {
        all[cur]=i;
        solve(cur+1);
    }
    return;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n>>m>>q;
    for(int i=1;i<=q;i++)
        cin>>a[i]>>b[i]>>c[i]>>d[i];
    all[0]=1;
    solve(1);
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 3652
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        boolean[][] g = new boolean[h][w];

        int x = 0;
        int y = 0;
        for(int i=0; i<h; i++) {
            char[] c = sc.next().toCharArray();
            for(int j=0; j<w; j++) {
                g[i][j] = c[j] == '.';
                if(g[i][j]) {
                    x = i;
                    y = j;
                }
            }
        }
        int n = h * w;
        int[][] d = new int[n][n];
        for(int i=0; i<n; i++) {
            Arrays.fill(d[i], 1000);
            d[i][i] = 0;
        }
        for(int i=0; i<h; i++) {
            for(int j=0; j<w; j++) {
                if(j<w-1) {
                    if(g[i][j] && g[i][j+1]) {
                        d[toi(w, i, j)][toi(w, i, j+1)] = 1;
                        d[toi(w, i, j+1)][toi(w, i, j)] = 1;
                    }
                }
                if(i<h-1) {
                    if(g[i][j] && g[i+1][j]) {
                        d[toi(w, i, j)][toi(w, i+1, j)] = 1;
                        d[toi(w, i+1, j)][toi(w, i, j)] = 1;
                    }
                }
            }
        }
        for(int k=0; k<n; k++) {
            for(int i=0; i<n; i++) {
                for(int j=0; j<n; j++) {
                    d[i][j] = Math.min(d[i][j], d[i][k]+d[k][j]);
                }
            }
        }
        int res = 0;
        for(int i=0; i<n; i++) {
            for(int j=0; j<n; j++) {
                if(d[i][j]<1000) {
                    res = Math.max(res, d[i][j]);
                }
            }
        }
        System.out.println(res);


    }

    static int toi(int w, int x, int y) {
        return w * x + y;
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/device/file_descriptor.hpp>

using namespace std;
typedef long long int lli;
typedef vector<int> iv;
typedef vector<bool> bv;
typedef vector<string> sv;
typedef vector<long long int> llv;
typedef vector<double> dv;

#define sor_(vec) sort(vec.begin(),vec.end())
#define rev_(vec) reverse(vec.begin(),vec.end())
#define rep(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define reps(i,n,s) for(int i=static_cast<int>(s);i<static_cast<int>(n);i++)
#define isposi(num) if(num>0)
const long long mod = 1000000007;

template<typename TypeInt>
std::string Itoa(const TypeInt v, int base)
{
    static const char table[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string ret;
    static numeric_limits<TypeInt> t;
    TypeInt n = v;
    if (t.is_signed) {
        if (v < 0) n *= -1;
    }

    while (n >= base) {
        ret += table[n%base];
        n /= base;
    }
    ret += table[n];
    if (t.is_signed) {
        if (v < 0 && base == 10) ret += '-';
    }
    std::reverse(ret.begin(), ret.end());

    return ret;
}

int upf(double num){
    if(num-(int)num>0)return (int)num+1;
    else return num;
}

void printm(char const *format,...){
    va_list arguments;
    va_start(arguments,format);
    unsigned index=0;
    while (format[index]!='\0') {
        if(format[index]=='%'){
            index++;
            if(format[index]=='d')printf("%d",va_arg(arguments, int));
            else if(format[index]=='c')printf("%c",va_arg(arguments, int));
            else if(format[index]=='x')printf("%x",va_arg(arguments,int));
            else if(format[index]=='o')printf("%o",va_arg(arguments,int));
            else if(format[index]=='f')printf("%f",va_arg(arguments, double));
            else if(format[index]=='s')printf("%s",va_arg(arguments, char const *));
            else if(format[index]=='p')printf("%p",va_arg(arguments,void*));
            else if(format[index]=='y')printf("Yes");
            else if(format[index]=='n')printf("No");
            else if(format[index]=='%')printf("%%");
            else assert(!"Unknown format with %.");
        }
        else printf("%c",format[index]);
        index++;
    }
    va_end(arguments);
    return;
}

struct Chara{
    int hp;
    int sp;
};

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    size_t n,k,hm;
    int dummy;
    set<int> ss;
    cin>>n>>k;
    for(size_t i=0;i<k;i++){
        cin>>hm;
        for(size_t l=0;l<hm;l++){
            cin>>dummy;
            ss.insert(dummy);
        }
    }
    cout<<n-ss.size();
    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline void read(T &x){
	short f=1;x=0;char c=getchar();
	while(!isdigit(c)){ if(c=='-')f=-1;c=getchar(); }
	while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
	x*=f;
}
template<typename T>inline void write(T x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)write(x/10);
	putchar(x%10+'0');
}
template<typename T>inline void writeln(T x){
	write(x);putchar('\n');
}
int a,b,c,x,ans=0;
int main(){
	read(a),read(b),read(c),read(x);
    for(int i=0;i<=a&&500*i<=x;i++)
        for(int j=0;j<=b&&100*j+500*i<=x;j++)
            for(int k=0;k<=c&&50*k+100*j+500*i<=x;k++)
                if(500*i+100*j+50*k==x)ans++;
    writeln(ans);
	return 0;
}

Measured memory_bytes: 384
n = int(input())
s = str(input())
cnt = 0
a = [c for c in s]
for i in range(n):
    if a[i]=='R':
        cnt += 1
cnt_r = 0
for i in range(cnt):
    if a[i]=='R':
        cnt_r += 1
print(cnt - cnt_r)

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

int main() {
  int N;
  cin >> N;
  vector<string> vec(N);
  for (int i = 0; i < N; i++) cin >> vec.at(i);

  for (int i = 0; i < N; i++) {
    if (vec.at(i) == "Y") {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}

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

int main()
{
	int n, A[100][100];
	cin>>n;


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

		for(int j=0;j<n;++j){
			A[i][j]=0;
		}

		int m,k; //k=number of adj
		cin>>m>>k;
		assert(m==i+1);

		for(int j=0;j<k;++j){
			int adj;
			cin>>adj;
			if(adj){
				A[i][adj-1]=1;
			}
		}
	}

	for(int i=0;i<n;++i){
		for(int j=0;j<n-1;++j){
			cout<<A[i][j]<<" ";
		}
		cout<<A[i][n-1]<<endl;
	}

	return 0;
}

Measured memory_bytes: 3104
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
		    String s=sc.next();char ch[]=s.toCharArray();int n=s.length(),a[]=new int[n],i;
		    for(i=0;i<n;i++)
		       a[i]=1;
		    for(i=0;i<n;i++){
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    }
		     for(i=0;i<n;i++)
		       System.out.print(ch[i]);
		      System.out.println();
	}
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             }
            return str19;
        }
      }    
}


Measured memory_bytes: 23124
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
#define diup(a, b) (a % b == 0 ? a / b : a / b + 1)
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b) * h / 2;
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


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(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
    int n; cin >> n;
    vector<int> h(n);

    REP(i, n) cin >> h[i];

    vector<int> c(n, 0);

    for (int i = n - 2; i >= 0; i--) {
        if (h[i] >= h[i + 1]) {
            c[i] = c[i + 1] + 1;
        }
    }

    cout << *max_element(c.begin(), c.end()) << endl;

    return 0;
}


Measured memory_bytes: 1024
///in the name of Allah the most beneficent the most merciful.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case #%lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FILE   freopen("input.txt", "r", stdin);  freopen("out.txt", "w", stdout);
#define out(x) cout << #x << " -> " << x << endl;
using namespace std;
const ll N = 300010, M = 2000005;
ll x, res;
int solve()
{
	for(int i=1;i<=5;i++)
	{
		in1(x);
		if(x==0) res=i;
	}
	printf("%lld\n", res);
	return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int ret = solve();
	return 0;
}
/*

*/


Measured memory_bytes: 3760
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
d1 = 0
d2 = 0
for i in range(N):
    if A[i]>B[i]:
        d1 += (A[i]-B[i])
    else:
        d2 += (B[i]-A[i])//2
if d2>=d1:
    flag = 0
else:
    flag = 1
if flag==0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 40560
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<30)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

ll n, m, color[100005];
vector<int> g[100005];

bool check(int v, int c) {
    color[v] = c;
    rep(i, 0, g[v].size()) {
        if (color[g[v][i]] == c) return false;
        if (color[g[v][i]] == 0 && !(check(g[v][i], -c))) return false;
    } 
    return true;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> m;
    rep(i, 0, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].pb(b); g[b].pb(a);
    }
    if (!check(0, 1)) {
        cout << n * (n-1) / 2 - m << endl;
        return 0;
    }
    ll b = 0, w = 0;
    rep(i, 0, n) {
        if (color[i] == 1) w++;
    } 
    b = n - w;
    cout << w * b - m << endl;
    return 0;
}


Measured memory_bytes: 6912
#include"stdio.h"
#include"ctype.h"

int main()
{
	char a[10], b[10], c[10];
	scanf("%s%s%s", a, b, c);
	char d, e, f;
	d = toupper(a[0]);
	e = toupper(b[0]);
	f = toupper(c[0]);
	printf("%c%c%c\n",d,e,f);
    return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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; }


int main(){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    
    int N, K;
    string S;
    cin >> N >> K >> S;

    if(S[K-1] == 'A'){
        S[K-1] = 'a';
    }else if(S[K-1] == 'B'){
        S[K-1] = 'b';
    }else{
        S[K-1] = 'c';
    }

    cout << S << endl;

    return 0;
}


Measured memory_bytes: 256
/// Bismillahir Rahmanir Rahim
//Author: Tanvir Hussain
//ICE,NSTU
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
const long long MOD = 1000000007;
#define SET(x) memset(x, 0, sizeof(x))
#define SET2d(x,m,n) memset(x, 0, sizeof(x[0][0]) * m * n)
#define SETBOOL(x) memset(x,false,sizeof(x))
#define CLR(x) memset(x, -1, sizeof(x))
#define CLR2d(x,m,n) memset(x, -1, sizeof(x[0][0]) * m * n)
#define mp make_pair
#define PII pair<int, int>
#define pf printf
#define sf scanf
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define no1 __builtin_popcount
#define BOUNDARY(i, j) ((i >= 0 && i < row) && (j >= 0 && j < column))
#define uniq(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define sz(a) int(a.size())
#define ff first
#define ss second
#define endl "\n"
#define forch(it,s) for(auto it:s)
#define each(it,s) for(auto it = s.begin(); it != s.end(); ++it)
#define rep(i,a) for(int i=0; i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define bits(n) __builtin_popcount(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >


int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a);}
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}
double sq(double x) {return x*x;}
ll po(ll b,ll p){
    ll res=1;
    while(p){
        res*=b;
        p--;
    }
    return res;
}
ll lg2(ll x){
    ll res=0;
    while(x>1){
        res++;
        x/=2ll;
    }
    return res;
}
void solve(){
    char a;
    cin>>a;
    if(a>='A' and a<='Z') cout<<"A"<<endl;
    else cout<<"a"<<endl;
}

signed main()

{
    IOS;
    /*#ifndef ONLINE_JUDGE
        freopen ("data.in","r",stdin);
        freopen ("data.out","w",stdout);
    #endif*/
    int t;
    t=1;
    while(t--){
        solve();
    }

     return 0;

}
///Alhamdulillah




Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int five = 0;
        int seven = 0;
        int a = sc.nextInt();
        if(a == 5) five++;
        if(a == 7) seven++;
        int b = sc.nextInt();
        if(b == 5) five++;
        if(b == 7) seven++;
        int c = sc.nextInt();
        if(c == 5) five++;
        if(c == 7) seven++;
        if(five == 2 && seven == 1) System.out.println("YES");
        else System.out.println("NO");
    }
}

Measured memory_bytes: 35692
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    long long s1 = 0, s2 = 0;
    for (int i = 0; i < n; ++i) {
		long long cur = b[i] - a[i];
        s1 += cur;

        if (cur <= 0) s2 += -cur;
        else if (cur % 2) s2 += 1;
    }

    if (s1 >= s2) printf("Yes\n");
    else printf("No\n");
}


Measured memory_bytes: 384
#include <stdio.h>
#define N 101
#define M 11

int stringJudge(char s[],char t[]){
  int i;
  for(i=0;;i++){
    if(s[i]!=t[i])
      return 0;
    if(s[i]==0 || t[i]==0)
      return 1;
  }
}

void stringCopy(char s[],char t[]){
  int i;
  for(i=0;;i++){
    s[i]=t[i];
    if(t[i]==0)
      break;
  }
}

int main(){
  int i,j,n,m,max=0,tem=0;
  char s[N][M]={},t[N][M]={},said[M]={};
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",s[i]);
  }
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%s",t[i]);
  }
  for(j=0;j<n+m;j++){
    if(j<n)
      stringCopy(said,s[j]);
    else
      stringCopy(said,t[j]);
    for(i=0;i<n;i++){
      if(stringJudge(said,s[i])){
        tem++;
      }
    }
    for(i=0;i<m;i++){
      if(stringJudge(said,t[i])){
        tem--;
      }
    }
    if(tem>max){
      max=tem;
    }
    tem=0;
  }
  if(max<0){
    max=0;
  }
  printf("%d\n",max);
  return 0;
}


Measured memory_bytes: 128
n, k = gets.chomp.split(' ').map{|x| x.to_i}
s = gets.chomp

a = s.split(/(0+)/).map{|x| x.length} + (s[-1] == '0' ? [0] : [])

t = a[0, 2*k+1].inject(:+)
m = t
i = 2
while i+2*k < a.length
  t = t - a[i-1] - a[i-2] + a[i+2*k-1] + a[i+2*k]
  if t >= m
    m = t
  end
  i += 2
end

puts m


Measured memory_bytes: 8444
#include<iostream>
#include<string>
using namespace std;
int main(){
  string key;
  while(getline(cin,key)){
    if(key.size() > 80){
      break;
    }
    for(int j=0; j<26; j++){
      for(int i=0; i<key.size(); i++){
	if(key[i] >= 'a' && key[i] <= 'z'){
	  if(key[i] == 'z')
	    key[i] = 'a';
	  else
	    key[i] += 1;
	}
      }
      if(key.find("the") != string::npos || key.find("this") != string::npos || key.find("that") != string::npos){
	cout << key << endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		char[] az1 = new char[26];
		char[] az2 = new char[26];
		boolean b = true;
		for (int i = 0; i < 26; i++) {
			az1[i] = 'A';
			az2[i] = 'A';
		}
		for (int i = 0; i < s.length; i++) {
			if (az1[t[i] - 'a'] != 'A') {
				if (az1[t[i] - 'a'] != s[i]) {
					b = false;
					break;
				}
			} else {
				az1[t[i] - 'a'] = s[i];
			}

			if (az2[s[i] - 'a'] != 'A') {
				if (az2[s[i] - 'a'] != t[i]) {
					b = false;
					break;
				}
			} else {
				az2[s[i] - 'a'] = t[i];
			}
		}
		if (b) {
			sb.append("Yes");
		} else {
			sb.append("No");
		}
		System.out.println(sb);
	}
}


Measured memory_bytes: 30848
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
    int A, B, K;
    cin >> A >> B >> K;
    int n = 0;  //AとBの公約数の個数

    for(int i = 1; i <= min(A, B); i++) {
        if(A % i == 0 && B % i == 0) {
            n++;
        }
    }

    int a[n];   //AとBの公約数の配列

    int i = 0;
    for(int j = 1; j <= min(A, B); j++) {
        if(A % j == 0 && B % j == 0) {
            a[i] = j;
            i++;
        }
    }

    cout << a[n-K];
    
    cout << endl;
    return 0;
}

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

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

  int n;
  cin>>n;

  if(n==0) cout<<"1"<<endl;

  else cout<<"0"<<endl;
     
     return 0;
}

Measured memory_bytes: 3560
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];
        for(int i = 0;i < n;++i) a[i] = sc.nextInt();
        StringBuilder sb = new StringBuilder().append(a[n - 1]);
        for(int i = n - 2;i >= 0;--i) sb.append(' ').append(a[i]);
        System.out.println(sb);
    }

}

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

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

int main() {
  int a, b;
  rep(i, 10000) {
    cin >> a >> b;
    if (a == 0 && b == 0) break;
    cout << min(a, b) << ' ' << max(a, b) << endl;
  }
  return 0;
}



Measured memory_bytes: 3004
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    int x[100001];
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>x[i];
    }
    sort(x,x+m);
    int y[100001]={};
    for(int i=1;i<m;i++){
        y[i]=x[i]-x[i-1];
    }
    sort(y,y+m);
    //for(int i=0;i<m;i++) cout<<y[i]<<endl;
    int ans=0;
    for(int i=1;i<m-n+1;i++) ans+=y[i];
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 1024
def main():
    N = int(input())
    AC = 0
    WA = 0
    TLE = 0
    RE = 0
    for _  in range(N):
        t = input()
        if t == 'AC':
            AC += 1
        elif t == 'WA':
            WA += 1
        elif t == 'TLE':
            TLE += 1
        elif t == 'RE':
            RE += 1
    print(f"AC x {AC}")
    print(f"WA x {WA}")
    print(f"TLE x {TLE}")
    print(f"RE x {RE}")

if __name__ == '__main__':
    main()


Measured memory_bytes: 9152
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
ll a[200010];
int main(){
    int n;
    while(cin>>n){
        ll ans=0, tmp=0;
        for(int i=0; i<n; ++i){
            scanf("%lld",a+i);
            tmp^=a[i];
        }
        for(int i=0; i<n; ++i){
        	ans=a[i]^tmp;
        	printf("%lld ",ans);
        }
       printf("\n");
    }
  return 0;
}




Measured memory_bytes: 5156
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String S = sc.next();

		int[] s = new int[S.length()];
		for(int i=0;i<S.length();i++) {
			if(S.charAt(i) == '0') {
				s[i] = 0;
			}else {
				s[i] = 1;
			}
		}

		int a = 0;

		int ans0=0;
		int ans1=0;
		for(int i=0;i<s.length;i++) {
			if(s[i] == a) {
				ans1++;
			}else {
				ans0++;
			}

			a ^= 1;

		}

		out.println(Math.min(ans0, ans1));

		sc.close();

	}

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

}


Measured memory_bytes: 27236
from collections import deque

S = input()
Q = int(input())
S = deque(S)

cnt_reverse = 0

for q in range(Q):
  _ = input()
  if _[0] == '1':
    cnt_reverse += 1
  else:
    _T, _F, _C = _.split()
    ## リバース回数が奇数偶数のいずれかをチェック
    if _F == '1':
      if cnt_reverse % 2 == 0:
        S.appendleft(_C)
      else:
        S.append(_C)
    else:
      if cnt_reverse % 2 == 0:
        S.append(_C)
      else:
        S.appendleft(_C)

S = list(S)
# reverseの部分を対応
if cnt_reverse % 2 == 1:
  S.reverse()

print(''.join(S))

Measured memory_bytes: 8436
#include <iostream>

using namespace std;

int K;
long long int A[100005];

int main(void) {

	cin >> K;

	for (int i = 1; i <= K; i++) {
		cin >> A[i];
	}

	long long int n, m;

	n = 2; m = 2;

	long long int x, y;

	for (int i = K; i >= 1; i--) {
		x = (n + A[i] - 1) / A[i];
		y = m / A[i];
		n = A[i] * x;
		m = A[i] * y + (A[i] - 1);
		if (m < n) { cout << -1 << endl; return 0; }
	}

	cout << n << " " << m << endl;

	return 0;
}

Measured memory_bytes: 1024
/*
 * Author: Anmol Choudhary
 */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nextl cout<<"\n"
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<"["<<#x<<"="<<x<<"] , ["<<#y<<"="<<y<<"]"<<"\n"
const ll mod = 1000000007;
const ll maxn = 1000005;
const ll mm = 1e+18;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
ll fact[maxn];
ll ncr(ll n,ll k){
    if(n<k) return 0;
    ll way=fact[n];
    way=(way*power(fact[k],mod-2))%mod;
    way=(way*power(fact[n-k],mod-2))%mod;
    return way;
}
void solve()
{
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    rep0(i,n) cin>>arr[i];
    sort(arr,arr+n);
    ll an=0;
    for(ll i=0;i<n;i++){
        ll nmx=ncr(i,k-1);
        ll nmi=ncr(n-i-1,k-1);
        ll tot=nmx-nmi;
        //deb(tot);
        tot+=mod;
        tot%=mod;
        arr[i]+=mod;
        arr[i]%=mod;
        an=(an+(tot*arr[i])%mod)%mod;
    }
    pr(an);
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    fact[0]=1;
    for(ll i=1;i<maxn;i++){
        fact[i]=(i*fact[i-1])%mod;
    }
    //cin>>t;
    while(t--){
        solve();
        //nextl;
    }
    return 0;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define dbg(x) cout<<"( "<<#x<<" -> "<<x<<" )"<<endl;
using namespace std;
int main()
{
    ll x,k,d;
    scanf("%lld%lld%lld",&x,&k,&d);
    ll val=(abs(x)/d);
    //if (val==k)
    //printf("%lld\n",abs(x-val*d));
    if (val>=k)
    {
        if (x>=0)
        printf("%lld\n",abs(x-k*d));
        else
        printf("%lld\n",abs(x+k*d));
    }
    else//val<k
    {
        ll cnt=(abs(k-val))%2LL;
        if (cnt==0)
        {
            if (x>=0)
            printf("%lld\n",abs(x-val*d));
            else
            printf("%lld\n",abs(x+val*d));
        }
        else
        {
            if (x>=0)
            printf("%lld\n",abs(x-(val+1)*d));
            else
            printf("%lld\n",abs(x+(val+1)*d));
        }
    }
    return 0;
}

Measured memory_bytes: 3780
#include <iostream>
#include <set>
#include <tuple>
#include <string>

using namespace std;
int main()
{
	int n,pts;
	string city;
	cin >> n;
	multiset<tuple<string, int, int>> data;
	multiset<tuple<string, int, int>>::iterator p;
	for (int i = 1; i <= n; i++)
	{
		cin >> city >> pts;
		data.insert(make_tuple(city, -1*pts, i));
	}
	cout << endl;

	for (p=data.begin(); p!=data.end(); p++)
	{
		int i;
		tie(city, pts, i) = *p;
		cout << i << " " << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;

ll gcd(ll a,ll b){
    if (b==0)return a;
    return gcd(b,a%b);
}

ll deg(int i){
  ll ret = 1;
  while(i != 0){
    if(i/10 == 0){
      break;
    }
    i/=10;
  }
  return i;
}

void solve(){
  ll n,m;cin >> n >> m;
  ll a=0;
  for(int i = 0;i < m;i++) {
    ll t; cin>>t;
    a+=t;
  }
  cout << max(-1LL,n-a) << endl;
}


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


Measured memory_bytes: 3632
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.lang.Math.*;
public class Main {
    static ArrayList<Node>[][] matches;
    static int [][]count;
    static int [][] cost;
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int n = in.nextInt();
        count = new int[n+1][n+1];
        cost = new int[n+1][n+1];
        matches = new ArrayList[n+1][n+1];
        for(int i=0;i<=n;i++){
            for(int j=0;j<=n;j++)
                matches[i][j] = new ArrayList<Node>();
        }
        for(int i=1;i<=n;i++){
            int next = in.nextInt();
            int pmin = Math.min(i,next);
            int pmax = Math.max(i,next);
            for(int j=1;j<n-1;j++){
                next = in.nextInt();
                int mn = Math.min(i,next);
                int mx = Math.max(i,next);
                count[mn][mx] +=1;
                matches[pmin][pmax].add(new Node(mn,mx));
                pmin = mn;pmax=mx;
            }
        }
        LinkedList<Node> queue = new LinkedList<>();
        for(int i=1;i<n;i++){
            for(int j=i+1;j<=n;j++) {
                if(matches[i][j].size()>0 && count[i][j]==0){
                    queue.addLast(new Node(i,j));
                }
            }
        }
        while (queue.size()>0){
            Node next = queue.removeFirst();
            for(Node v:matches[next.l][next.h]){
                dfs(v,0);
            }
        }
        int day =0;
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                if(count[i][j]>0){
                    System.out.println(-1);
                    return;
                }
                day=Math.max(day,cost[i][j]);
            }
        }
        System.out.println(day+1);
    }
    static public class Node{
        int l;int h;
        public Node(int a,int b){
            l=a;h=b;
        }
    }
    static void dfs(Node vertice , int v){
        int curCost = 1+v;
        cost[vertice.l][vertice.h]= Math.max(curCost,cost[vertice.l][vertice.h]);
        count[vertice.l][vertice.h]--;
        if (count[vertice.l][vertice.h]==0){
            for(Node value:matches[vertice.l][vertice.h]){
                dfs(value,cost[vertice.l][vertice.h]);
            }
        }
    }

}

Measured memory_bytes: 273352
#include<iostream>
#include<vector>
#include<string.h>

using namespace std;
#define MAX 7368791
bool used[MAX];

int main(){
	while(1){
		int m,n;
		cin >> m >> n;
		if(m == 0) break;
		
		memset(used,0,sizeof(used));
		
		for(int i = m;;i++){
			if(used[i]){
				
			}else{
				if(n == 0){
					cout << i << endl;
					break;
				}else{
					n--;
					for(int j = i;j <= MAX;j+=i){
						used[j] = true;
					}
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 10288
#include <bits/stdc++.h>
using namespace std;
void err() {
  cout << -1 << endl;
  exit(0);
}
void dfs (int crr, int dpt, vector<vector<int>>& grh, long long& cnt) {
  cnt += dpt;
  for (int nxt : grh[crr]) {
    dfs(nxt, dpt + 1, grh, cnt);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> d(n);
  map<long long, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
    mp[d[i]] = i;
  }
  sort(d.begin(), d.end());
  vector<long long> sz(n, 1);
  vector<vector<int>> grh(n);
  vector<pair<int, int>> edg;
  for (auto it = d.rbegin(); next(it) != d.rend(); it++) {
    auto i = mp.rbegin()->second;
    long long wnt = *it - n + 2 * sz[i];
    if (mp.find(wnt) == mp.end()) err();
    auto p = mp[wnt];
    sz[p] += sz[i];
    grh[p].push_back(i);
    edg.emplace_back(i, p);
    mp.erase(--mp.end());
  }
  int rt = mp.begin()->second;
  long long cnt = 0;
  dfs(rt, 0, grh, cnt);
  if (d[0] != cnt) err();
  for (auto const& e : edg) {
    cout << e.first + 1 << ' ' << e.second + 1 << '\n';
  }
  return 0;
}


Measured memory_bytes: 14840
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline bool read(ll &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
string s;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>s;
for (;!s.empty();){
  string tmp=s.substr(s.size()-5,5);
  if (tmp=="erase"||tmp=="dream"){
    s.erase(s.size()-5,5);
    continue;
    }
  tmp=s.substr(s.size()-6,6);
  if (tmp=="eraser"){
    s.erase(s.size()-6,6);
    continue;
    }
  tmp=s.substr(s.size()-7,7);
  if (tmp=="dreamer"){
    s.erase(s.size()-7,7);
    continue;
    }
  return puts("NO"),0;
  }
puts("YES");
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
long long n,a[200010];
long long sum[200010];
int main(){
	cin>>n;
	long long ans=9223372036854775800;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum[i]=sum[i-1]+a[i];
	}
	for(int i=1;i<=n;i++){
		long long k=sum[n]-sum[i];
		long long x=sum[i]-k;
		if(x<0) x=-x;
		if(x<ans) ans=x;
	}
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3328
//#pragma GCC optimize("Ofast")
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <bitset>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <tr1/unordered_map>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define bql 2147483647
#define ll long long
#define ull unsigned long long
using namespace std::tr1;
using namespace std;
const int N=2e5+5;
const int mod=998244353;
const int fx[5]={0,-1,0,1,0};
const int fy[5]={0,0,-1,0,1};
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while (ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0' && ch<='9'){x=(x<<3)+(x<<1);x+=(ch-'0');ch=getchar();}
    return x*f;
}

void write(int x)
{
    if (x<0) putchar('-'),x=-x;
    if (x>10) write(x/10);
    putchar(x%10+'0');
}

bool cus(pair<string,int>p1,pair<string,int>p2)
{
	if(p1.second==p2.second)
	{
		return p1.first<p2.first;
	}
	return p1.second<p2.second;
}
int main()
{
	int n;cin>>n;
	string s; 
	map<string,int>mp;
	vector<pair<string,int> >vp;
	for(int i=0;i<n;i++)
	{
		cin>>s;
		mp[s]++;
		
	}
	for(auto x: mp)
	{
		vp.push_back({x.first,x.second});
	}
	sort(vp.rbegin(),vp.rend(),cus);
	int have=vp[0].second;
	vector<string>ans;
	for(auto x : vp)
	{
		if(x.second==have)
		{
			ans.push_back(x.first);
		}
	}
	sort(ans.begin(),ans.end());
	for (auto x : ans)
  {
    cout<<x<<endl;
  }
}

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

int main(){
    int i,j,k,l,sum,a,b;
    vector<int> vec(a);
    int ans = 0;
    
    for(i = 0; ;i++){
        ans = 0;
        cin >> a >> b;
        if(a == 0 && b == 0)break;
        for(j = 1;j <= a;j++){
            sum = 0;
            sum = j;
            for(k = 1; k <= a;k++){
                if(k <= j)continue;
                sum = j + k;
                for(l = 1; l <= a;l++){
                    if(l <= k)continue;
                    sum = j + k + l;
                    if(sum == b)ans += 1;
                }
                
            }
        }
        cout << ans << endl;   
    }
   
}


Measured memory_bytes: 19016
num,miti = map(int,input().split())     #num=4,miti=3
tenbou = {}
hight = input().split()
good = {}
bad = {}
c = 0


for i in range(num):
    tenbou[i+1] = int(hight[i])
#print(tenbou)

for j in range(miti):
    a,b = map(int,input().split())
    if tenbou[a] > tenbou[b]:
        if not a in bad:
            good[a] = tenbou[a]
        bad[b] = tenbou[b]
        if b in good:
            del good[b]
    elif tenbou[a] < tenbou[b]:
        if not b in bad:
            good[b] = tenbou[b]
        bad[a] = tenbou[a]
        if a in good:
            del good[a]
    elif tenbou[a] == tenbou[b]:
        bad[a] = tenbou[a]
        bad[b] = tenbou[b]
        if a in good:
            del good[a]
        if b in good:
            del good[b]
#print(good)
#print(bad)
goods = len(good)
bads = len(bad)

        
if num == (goods + bads):
    print(goods)
else:
    print(num - (goods + bads) + goods)

Measured memory_bytes: 36840
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = []
for i in range(N):
    A.append(list(map(int, input().split())))

ans = 0
for i in range(N):
    total = 0
    for j in range(M):
        total += A[i][j] * B[j]
    total += C
    if total > 0:
        ans += 1
print(ans)

Measured memory_bytes: 3064
A = int(input())
B = int(input())
C = int(input())
X = int(input())

k = 0
for a in range(min([A, X // 500]) + 1):
    Y = X - 500 * a
    for b in range(min([B, Y // 100]) + 1):
        k += (Y - 100 * b) // 50 <= C

print(k)


Measured memory_bytes: 8796
// 17D8104010B 宮本拓輝 10_c c++

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){
  int score[1001][1001];
  int n;
  cin>>n;
  int result[n];
  for(int s=0;s<n;s++){
    string x,y;
    cin>>x;
    cin>>y;

    for(int i=0;i<x.size();i++){
      for(int j=0;j<y.size();j++){
        if(x[i]==y[j]){
          score[i+1][j+1]=score[i][j]+1;
        }
        else{
          score[i+1][j+1]=max(score[i+1][j],score[i][j+1]);
        }
      }
    }
    //cout<<score[x.size()][y.size()]<<"\n";
    result[s]=score[x.size()][y.size()];

  }
  for(int i=0;i<n;i++){
    cout<<result[i]<<"\n";
  }

  return 0;
}



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

int main(void){
    int n;
    cin >> n;
    int a[n],A = 0;
    for(int i = 0;i < n;i++)cin >> a[i];
    for(int i = 0;i < n;i++)A = A^a[i];
    
    for(int i = 0;i < n;i++)cout << (int)(A^a[i]) << " ";
}


Measured memory_bytes: 4400
use std::cmp::*;
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let (_n, k) = i.read2::<usize, usize>();
    let s = i.read_line().as_bytes();
    writeln!(o, "{}", solve(s, k)).unwrap();
}
fn solve(s: &[u8], k: usize) -> usize {
    let mut cs = Vec::new();

    let mut i = 0;
    while s.get(i) == Some(&b'1') {
        i += 1;
    }
    cs.push(i);

    while i < s.len() {
        let i_begin = i;
        while s.get(i) == Some(&b'0') {
            i += 1;
        }
        cs.push(i - i_begin);

        let i_begin = i;
        while s.get(i) == Some(&b'1') {
            i += 1;
        }
        cs.push(i - i_begin);
    }

    let mut current = cs[0];
    let mut result = current;
    for i in 0..cs.len() / 2 {
        let j = i * 2 + 1;
        current += cs[j] + cs[j + 1];
        if i >= k {
            let j = (i - k) * 2 + 1;
            current -= cs[j - 1] + cs[j];
        }
        result = max(result, current);
    }
    result
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define pb push_back
#define fe first
#define se second
#define endl "\n"
#define pii pair<int, int>

#define PI 3.14159265358979323846
const int N = 3e3 + 10;

int n,m;


void solve() {
	  cin>>n;
	  //dp[i] -  probability of getting i head
	  
	  vector<double> dp(n+1);
	  
	
	  dp[0]=1;
	  double  ph;
	 for(int i=1;i<=n;i++) {
		    cin>>ph;
		    for(int j=i;j>=0;j-- ) {
				  dp[j] = (j==0 ? 0 : dp[j-1]*ph) + dp[j]*(1-ph);					  
				}		 
		 }
		 
		 double ans=0;
		 
	for(int i=0;i<=n;i++) {
		    int yo=n-i;
		    if(i>yo)
		     ans+=dp[i];		
		}
		
		cout<<fixed<<setprecision(10);
		cout<<ans;
		
}		

int main() {
  cool;
  int t = 1;
  while (t--)
    solve();

  return 0;
}


Measured memory_bytes: 256
L = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(L[int(input()) - 1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for(ll i=(ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
constexpr ll INF = 1LL<<60;

template<class T>
class csum2d {
    ll h, w;
    vector<vector<T>> rui;
public:
    csum2d(vector<vector<T>> v) : h(v.size()), w(v[0].size()), rui(v) {
        REP(i, h) REP(j, w) {
            if(!i && !j) {}
            else if(!i) rui[i][j] += rui[i][j-1];
            else if(!j) rui[i][j] += rui[i-1][j];
            else rui[i][j] += rui[i-1][j]+rui[i][j-1]-rui[i-1][j-1];
        }
    }
    T get(ll sx, ll sy, ll gx, ll gy) {
        if(!sx && !sy) return rui[gy][gx];
        if(!sx) return rui[gy][gx]-rui[sy-1][gx];
        if(!sy) return rui[gy][gx]-rui[gy][sx-1];
        return rui[gy][gx]-rui[sy-1][gx]-rui[gy][sx-1]+rui[sy-1][sx-1];
    };
};

int main() {
    ll h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    REP(i, h) cin >> s[i];

    vector<vector<ll>> vs(h, vector<ll>(w));
    REP(i, h) REP(j, w) vs[i][j] = s[i][j]-'0';
    csum2d<ll> cs(vs);

    ll ans = INF;
    REP(i, 1LL<<(h-1)) {
        vector<ll> v;
        v.push_back(0);
        REP(j, h-1) if(i&1LL<<j) v.push_back(j+1);
        v.push_back(h);

        bool flag = true;
        REP(j, w) FOR(a, 1, v.size()) if(cs.get(j, v[a-1], j, v[a]-1) > k) flag = false;
        if(!flag) continue;

        ll last = 0, ret = v.size()-2;
        REP(j, w) {
            FOR(a, 1, v.size()) {
                if(cs.get(last, v[a-1], j, v[a]-1) > k) {
                    last = j;
                    ret++;
                    break;
                }
            }
        }
        chmin(ans, ret);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512