akhauriyash/Code-Regression huggingface dataset:
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
string moji(int a){
	string ret="";string r="";int amari;
	//if(a==0) return "0";if(a<0) return "-"+moji(-a);
	rep(i,3){
		amari=a%10;r+=(amari+'0');a/=10;
	}
	for(int i=0;i<r.size();i++) ret+=r[r.size()-(i+1)];
	return ret;
}
int n;string s;
bool cal(string a){
	int it=0;
	rep(i,n){
		if(it<3 && a[it]==s[i]) it++;
	}
	return it>2;
}
int main()
{
	int out=0;cin>>n;cin>>s;
	rep(i,1000){
		if(cal(moji(i))) out++;
	}
	cout<<out<<endl;
}
	

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


using namespace std;

int main(){

  string N;
  int sum=0;


   cin>>N;
   int nlen=N.length();

   for(int i=0; i<nlen; i++){
     sum+=(int)(N[i]-'0');
   }

  if(sum%9==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

  return 0;

}


Measured memory_bytes: 3708
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
int a[105];

long long cal(long long int a,int b)
{
    int i;
    long long ans = 1;

    for(i = 1;i <= b;i++)
    {
        ans *= a;
    }
    return ans;
}

int main()
{
    int n,p;
    int i;
    int x,y;
    long long int ans;

    while(scanf("%d%d",&n,&p) != EOF)
    {
        x=0,y=0;
        for(i = 0;i < n;i++)
        {
            scanf("%d",&a[i]);
            if(a[i]%2) y++;
        }
        x = n-y;
        if(p%2 == 0)
        {
            if(y == 0) ans = cal(2,x);
            else ans = cal(2,n-1);
        }
        else
        {
            if(y == 0) ans = 0;
            else
            {
                ans = cal(2,n-1);
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int x, y , a, b, c;
    cin >> x >> y  >> a >> b >> c;
    vector<ll> p, q, r;
    ll num;
    rep(i, a){
        cin >> num;
        p.push_back(num);        
    }
    rep(i, b)
    {
        cin >> num;
        q.push_back(num);
    }
    rep(i, c)
    {
        cin >> num;
        r.push_back(num);
    }
    sort(p.begin(), p.end(), greater<ll>());
    sort(q.begin(), q.end(), greater<ll>());
    p.resize(x);
    q.resize(y);
    priority_queue<ll> pq;
    rep(i, x){
        pq.push(p[i]);
    }
    rep(i, y){
        pq.push(q[i]);
    }
    rep(i, c){
        pq.push(r[i]);
    }
    ll ans=0;
    rep(i, x+y){
        ans += pq.top();
        pq.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8176
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
      
      int a[] = new int[N];
      
      int count = 0;
      int max = 0;
      for(int i=0; i<N; i++){
      a[i] = sc.nextInt();
      }
       for(int i=1; i<N; i++){
        if(a[i-1]>=a[i]){
        count++;
        }
         else{
         max = Math.max(max,count);//maxにcount++されたものが入っていく,どんどん更新されていき最大値のcount++のものが残る
           count =0;//一旦リセットして,for文をまわして新しいcount++を更新していく
         }
       }
      max = Math.max(max,count);
         System.out.println(max);
    }
}

Measured memory_bytes: 61000
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s="ACL";
    int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cout<<s;
  }
  return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long w,h,x,y;
	cin>>w>>h>>x>>y;
	double m=(double)w*h/2.0;
	printf("%.12lf ",m);
	if(x*2==w&&y*2==h)
		puts("1");
	else puts("0");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using i64 = long long;

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

    std::vector<i64> a { 1 };
    std::set<i64> s { 1 };
    for (int i = 1; i <= n; i++) {
        i64 x = a.back();
        bool ok = false;
        while (!ok) {
            x++;
            while (s.count(x)) x++;
            ok = true;
            for (int j = 0; j < i; j++) {
                if (s.count(a[j] + x)) {
                    ok = false;
                    break;
                }
            }
        }
        s.insert(x);
        for (int j = 0; j < i; j++) {
            s.insert(a[j] + x);
        }
        a.push_back(x);
    }

    // for (int i = 0; i < a.size(); i++) std::cout << a[i] << std::endl;
    std::vector<std::vector<i64>> ret(n, std::vector<i64>(n));

    i64 m = 0;
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < i; j++) {
            ret[i][j] = ret[j][i] = (m + 1) * a[j];
        }

        std::vector<int> p;
        for (int j = 0; j <= i; j++) p.push_back(j);
        do {
            i64 k = 0;
            for (int j = 0; j < i; j++) k += ret[p[j]][p[j + 1]];
            m = std::max(m, k);
        } while (std::next_permutation(p.begin(), p.end()));
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) std::cout << ret[i][j] << " ";
        std::cout << std::endl;
    }

    return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string a, b;
    cin >> a >> b;
    int n = 0;
    for (int i = 0; i < a.length(); i++) {
        if (a.at(i) != b.at(i)) {
            n+=1;
        }
    }
    cout << n;
}


Measured memory_bytes: 3780
n = int(input())
s = list(input().replace("B","0").replace("W","1"))
s = list(map(int,s))
mod = 10**9+7
stock = 0
ans = 1
for x in s:
    if x != stock%2:
        if stock == 0:
            print(0)
            exit()
        ans *= stock
        ans %= mod
        stock -= 1
    else:
        stock += 1
if stock:
    print(0)
    exit()
ta = 1
for i in range(1,n+1):
    ta = ta*i%mod
print(ta*ans%mod)

Measured memory_bytes: 6556
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  string s;
  cin >> s;
  ll ans = s.length() / 2;

  rep(i, s.length()) {
    if(s[i] == 'p') --ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
open System

let N,X=stdin.ReadLine().Split()|>Array.map int|>fun c -> int c.[0],int c.[1]
let L =stdin.ReadLine().Split()|>Array.map int
[<EntryPoint>]
let main argv =
    let D=Array.zeroCreate (N+1)
    for i in [0..N-1] do D.[i+1] <- D.[i]+L.[i]
    D
    |>Seq.sumBy(fun c -> if c<=X then 1 else 0)
    |>stdout.WriteLine
    0

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    for (int i = 0; i < S.length() - 1; i++) {
        if (S.substr(i, 2) == "AC") {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
//#pragma GCC optimize("Ofast")  //デバッグ時にoptimized-outされて邪魔だった
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  invar(int, N); invar(int, K);
  vi h(N);
  int ct = 0;
  rep(i, N) {
    cin >> h[i];
    if(h[i] >= K) ct++;
  }
  
  fin(ct);

}

Measured memory_bytes: 640
#include <stdio.h>
#include <array>

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

using lli = long long int;
constexpr int N = 2e5;
std::array<int, N> A;
   
int main(void){
    int n; scanf("%d", &n);
    REP(i, n) scanf("%d", &A[i]);
    lli res = 0;
    int l = 0, r = 0, allOR = 0;

    while(l < n){
        while(r < n and (allOR & A[r]) == 0){allOR |= A[r]; r++;}
        res += r - l;
        allOR ^= A[l++];
        if(l > r) r++;
    }
    printf("%lld\n", res);
    return 0;
}

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

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

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

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

fn main() {
    let nm: Vec<usize> = read_vec();
    let n = nm[0];
    let m = nm[1];
    let mut py: Vec<Vec<u32>> = read_vec2(m);

    for i in 0..m {
        py[i].push(i as u32);
    }

    py.sort_by(|x, y| {
        if x[0] == y[0] {
            x[1].partial_cmp(&y[1]).unwrap()
        } else {
            x[0].partial_cmp(&y[0]).unwrap()
        }
    });

    let mut ans: Vec<String> = vec![String::from(""); 100000];

    let mut p: u32 = py[0][0];
    let mut tmp: u32 = 1;
    ans[py[0][2] as usize] = format!("{:>06}{:>06}", p, tmp);
    for i in 1..m {
        if py[i][0] == p {
            tmp += 1;
            ans[py[i][2] as usize] = format!("{:>06}{:>06}", p, tmp);
        } else {
            p = py[i][0];
            tmp = 1;
            ans[py[i][2] as usize] = format!("{:>06}{:>06}", p, tmp);
        }
    }

    for i in 0..m {
        println!("{}", ans[i]);
    }
}


Measured memory_bytes: 15868
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		solver.readA(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		A = new long[N];
	}

	long[] A;

	public boolean hasNext() {
		return cnt < N;
	}

	public void readA(String str) {
		// System.out.println(str);
		String[] strArr = str.split("\\s+");
		long L = 0;
		for (int i = 0; i < N; i++) {
			A[i] = Long.parseLong(strArr[i]);
			L += A[i];
		}
		long ans = Long.MAX_VALUE;
		long left = A[0];
		for (int i = 1; i < N; i++) {
			long pad;
			long right = L - left;
			long a = Math.abs(right - left);
			// System.out.println(left + " " + right + " " + a);
			if (a < ans)
				ans = a;
			left += A[i];
		}
		System.out.println(ans);
	}

	public void readBody(String str) {
		// System.out.println(str);
	}

	public void solve() {
	}
}


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

namespace AtCoder.DP
{
    class EDPC_E
    {
        public static void Main()
        {
            var nw = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

            var n = nw[0];
            var maxWeight = nw[1];

            var weights = new long[n];
            var values = new int[n];

            int maxValue = 0;

            for (int i = 0; i < n; i++)
            {
                var wv = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                weights[i] = wv[0];
                values[i] = wv[1];
                maxValue += wv[1];
            }

            var dp = Enumerable.Repeat(long.MaxValue, maxValue + 1).ToArray();
            dp[0] = 0;

            for (int i = 1; i <= n; i++)
            {
                for (long j = maxValue; j >= values[i - 1]; j--)
                {
                    if (dp[j - values[i - 1]] != long.MaxValue && dp[j - values[i - 1]] + weights[i - 1] <= maxWeight)
                        dp[j] = Math.Min(dp[j], dp[j - values[i - 1]] + weights[i - 1]);
                }
            }

            int max = 0;
            for (int i = 0; i <= maxValue; i++)
                if (dp[i] != long.MaxValue)
                    max = i;

            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 15712
N = int(input())
li = []
A =[]
B=[]
for i in range(N):
    li = list(input().split())
    A.append(float(li[0]))
    B.append(li[1])
# print(li)
# print(A)
# print(B)
i = 0
res=0
for i in range(N):
    if(B[i]=="JPY"):
        res+=A[i]
    else:
        res+=380000*A[i]

print(res)


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

Measured memory_bytes: 596
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

int gcd(int x, int y) {
  int a = std::max(x,y), b = std::min(x,y);
  int r = a % b;
  while(r!=0){ a = b; b = r; r = a % b; }
  return b;
}

int main(void) {
  int N, x;
  scanf("%d %d", &N, &x);
  std::vector<int> a;
  for (int i = 0; i < N; ++i) {
    int b;
    scanf("%d", &b);
    a.push_back(b);
  }
  std::sort(a.begin(), a.end());
  int cnt = 0;
  for (int i = 0; i < N; ++i) {
    if (a.at(i) > x) break;
    x -= a.at(i);
    ++cnt;
  }
  if (cnt == N && x > 0) --cnt;
  printf("%d\n", cnt);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

ll digits(ll n) {
  ll cnt = 0;
  while (n > 0) {
    n /= 10;
    cnt++;
  }
  return cnt;
}

ll F(ll a, ll b) {
  ll na = digits(a), nb = digits(b);
  return max(na,nb);
}

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

  ll ans = INFLL;
  for (ll i = 1; i*i <= n; i++) {
    if (n%i==0) {
      ll j = n/i;
      ans = min(ans,F(i,j));
    }
  }

  cout << ans << endl;
}

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

using namespace std;

#define endl '\n'

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

const int N = 1 << 26;
const int oo = 1e9;

int dp[N];
int n;
char s[N];

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

	fill(dp , dp + N, oo);

	cin >> s + 1;
	n = strlen(s + 1);

	dp[0] = 1;
	int mask = 0;
	for( int i = 1; i <= n; i++ ){
		int c  = s[i] - 'a';
		mask ^= (1 << c);
		int cnt = __builtin_popcount(mask);
		if(cnt <= 1){
			dp[mask] = 1;
		}
		else
		{
			for( int i = 0; i < 26; i++ ){
				int new_mask = mask ^ (1 << i);
				dp[mask] = min(dp[mask] , dp[new_mask]+1);
			}
		}
	}

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



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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, 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--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

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

	ll N, Q;
	string S;
	cin >> N >> Q >> S;

	ll cnt = 0;
	ll sum[100001] = { 0 };
	rep(i, S.size() - 1) {
		if (S[i] == 'A' && S[i + 1] == 'C') {
			cnt++;
			sum[i + 1] = cnt;
		}
		else {
			sum[i + 1] = sum[i];
		}
	}

	ll l, r;
	rep(i, Q) {
		cin >> l >> r;

		cout << sum[r-1] - sum[l-1] << "\n";
	}

	return 0;
}

Measured memory_bytes: 1872
#include <iostream>
#include <map>
using namespace std;
//問題文は英語だけど、N個の整数が与えられるから、過半数を占める値があるなら出力せよという問題
int main(){
	int n,tmp,ans;
	while(cin>>n,n){
		map<int,int>Cou;
		for(int i=0;i<n;i++){
			cin>>tmp;
			Cou[tmp]++;
		}
		ans=-1;
		for(map<int,int>::iterator it = Cou.begin() ; it != Cou.end() ; ++it )if( it->second > n/2 )ans = it->first;
		if(ans==-1)cout<<"NO COLOR"<<endl;
		else cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 2732
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : x)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int a, b;
    cin >> a >> b;
    int n = 1;
    int ans = 0;
    while(n < b) {
        n -= 1;
        n += a;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
  vector<string> S;
  string Sdot,Schanged,T;cin>>Sdot>>T;bool check=true;
  for(int i=Sdot.size()-T.size();i>-1;i--)
  {
    check=true;
    for(int j=0;j<T.size();j++)
    {
      if(Sdot[i+j]!=T[j]&&Sdot[i+j]!='?'){check=false;break;}
    }
    Schanged=Sdot;
    if(check)
    {
      for(int j=0;j<T.size();j++)Schanged[i+j]=T[j];
      for(int i=Sdot.size();i>-1;i--)if(Schanged[i]=='?')Schanged[i]='a';
      S.push_back(Schanged);
    }
  }
  if(S.size()==0){printf("UNRESTORABLE\n");return 0;}
  else sort(S.begin(),S.end());
  cout<<S[0]<<endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

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

    if ( n == 1 ) {
        cout << 1 << endl;
        return 0;
    }

    vector<pair<ll, ll>> xl(n);

    for ( int i = 0; i < n; i++ ) {
        ll tmp_x, tmp_l;
        cin >> tmp_x >> tmp_l;
        xl[i] = make_pair(tmp_x+tmp_l, tmp_x-tmp_l);
    }

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

    vector<bool> ok_flg(n, true);

    for ( int i = 0; i < n; i++ ) {
        ok_flg[i] = true;
    }

    int judge_num = 0;
    for ( int i = 1; i < n; i++ ) {
        if ( xl[i-1-judge_num].first > xl[i].second ) {
            if ( ok_flg[i-1-judge_num] ) {
                ok_flg[i] = false;
                judge_num++;
            }
        }
        else {
            judge_num = 0;
        }
    }

    int ans = 0;
    for ( int i = 0; i < n; i++ ) {
        if ( ok_flg[i] ) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int a[5];

int main() {
    for(int i=0; i<3; i++)
        scanf("%d", &a[i]);
    sort(a, a+3);
    if(a[0]==a[1] && a[1]!=a[2])
        printf("Yes\n");
    else if(a[0]!=a[1] && a[1]==a[2])
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
char a[111],b[111];
int main()
{
	int n;
	scanf("%d",&n);
	scanf("%s",a);
	scanf("%s",b);
	for(int i=n;i>=0;i--)
		if(strncmp(a+n-i,b,i)==0)
		{
			printf("%d",n*2-i);
			return 0;
		}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
int a,b,c,K;
int ans;
int main(){
    std::cin>>a>>b>>c>>K;
    int m=std::max({a,b,c});
    ans=a+b+c-m;
    for(int i=0;i<K;i++){
        m*=2;
    }
    std::cout<<ans+m<<std::endl;
    return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")
int table[365][26];
int main()
{
	int D;
	cin >> D;
	vec(C);
	vec(Las);
	fx(26) {
		vecp(C);
		Las.push_back(0);
	}

	fx(D) {
		fy(26) {
			cin >> table[x][y];
		}
	}
	ll ans = 0;
	fx(D) {
		ll sum = 0;
		ll res = 0, index = 0;
		fy(26) {
			sum += table[x][y];
			fz(26) {
				if (y == z) { continue; }
				sum -= C[y] *(x + 1 - Las[y]);
			}
			if (sum>res) {
				res = sum;
				index = y;
			}
		}
		Las[index] = x + 1;
		ce(index+1)
	}
	
    return 0;
}



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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
	int n, k;
	string s;
	cin >> n >> k >> s;

	int ans=0, l=1;
	for(int i=1; i<n; i++){
		if(s[i]==s[i-1]) ans++;
		else l++;
	}
	if(l==2) ans+=min(1, k);
	else{
		if((l+1)/2<k+1) ans+=l-1;
		else ans+=2*k;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    string s;
    cin >> s;
    map<int, int> v;
    v[0] = 0;
    int k = 0, ans = 0;
    for (int i = 0; i < s.size(); ++i) {
        k ^= (1 << (s[i]-'a'));
        int p = INF<int>;
        if(v.count(k)){
            p = min(p, v[k]+1);
        }
        for (int j = 0; j < 26; ++j) {
            int k2 = k ^ (1 << j);
            if(v.count(k2)){
                p = min(p, v[k2]+1);
            }
        }
        if(v.count(k)) v[k] = min(v[k], p);
        else v[k] = p;
        if(i+1 == s.size()){
            ans = p;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 9860
/* Eat a live frog first thing in the morning,
   and nothing worse will happen to you the rest of the day */

/* You can't connect the dots looking forward 
   you can only connect them looking backwards. */

/* Nothing is impossible; impossible itself says "I'm possible" */

#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed;
#define dbset(x) for(int i=0 ; i<x.size(); i++) cerr << x[i] << " "; cerr << endl;
#define inf 1000000007
#define INF 1000000000000000000LL
#define PI 3.14159265358979323846
#define mod 1000000007
#define mod1 1000696969
#define flusz fflush(stdout);
#define VI vector<int>
#define VPI vector < pair<int,int> >
#define PII pair<int, int>
#define BIT bitset<N>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define REP(x, y) for(int x = 0; x < (y); ++x)
#define FOR(x, y, z) for(int x = y; x <= (z); ++x)
#define FORR(x, y, z) for(int x = y; x >= (z); --x)
using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)

#define int long long
#define N 500007

int test;

int n;

int t[N];

int res=INF;

void solve()
{
	cin >> n;

	FOR(i,1,n)
	{
		cin >> t[i];
	}

	int cur=0;
	int res1=0;

	FOR(i,1,n)
	{
		cur+=t[i];

		if (i%2==1 && cur<=0)
		{
			res1+=abs(cur)+1;
			cur=1;
		}

		if (i%2==0 && cur>=0)
		{
			res1+=cur+1;
			cur=-1;
		}
	}

	res=min(res,res1);

	cur=res1=0;

	FOR(i,1,n)
	{
		cur+=t[i];

		if (i%2==0 && cur<=0)
		{
			res1+=abs(cur)+1;
			cur=1;
		}

		if (i%2==1 && cur>=0)
		{
			res1+=cur+1;
			cur=-1;
		}
	}

	res=min(res,res1);

	cout << res;

       return;
}

int32_t main()
{
    boost

    test=1;

    while(test--)
    {
         solve();
    }

  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

#define debug(x) cout << #x << ": " << x << endl;
#define ll long long
#define mod 1000000007

int freq[1<<20], cfreq[1<<20], N, num;
ll csum[1<<20], M;

ll count_pairs(int X) {
  ll ans = 0;
  for(int i = 1;i <= 100000;i++) {
    ans += 1LL*freq[i]*cfreq[max(0, X-i)];
  }
  return ans;
}

ll count_pairs_sum(int X) {
  ll ans = 0;
  for(int i = 1;i <= 100000;i++) {
    ans += (csum[max(0, X-i)] + 1LL*cfreq[max(0, X-i)]*i)*freq[i];
  }
  return ans;
}

int main() {
//  freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);

  cin >> N >> M;
  for (size_t i = 0; i < N; i++) {
    cin >> num;
    freq[num]++;
  }

  for(int i = 100000;i >= 0;i--) {
    cfreq[i] = cfreq[i+1] + freq[i];
    csum[i] = csum[i+1] + i*freq[i];
  }

  int lo = 2, hi = 200000, mid, ans;
  while(lo <= hi) {
    mid = (lo + hi) >> 1;
    if(count_pairs(mid) >= M) {
      ans = mid;
      lo = mid + 1;
    } else {
      hi = mid-1;
    }
  }

  // debug(ans);
  // debug(count_pairs(ans));
  ll answer = (M - count_pairs(ans+1))*ans;
  cout << answer + count_pairs_sum(ans+1) << endl;

  return 0;
}


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

int a, b;
int main(){
    while(scanf("%d %d", &a, &b) == 2){
        if(a >= 13)
            printf("%d\n", b);
        else if(a >= 6 && a <= 12)
            printf("%d\n", b / 2);
        else if(a < 6)
            printf("%d\n", 0);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define VIEW(x) do {cerr << #x << ": "; for(auto i : x) cerr << i << " "; cerr << endl;} while(0)

signed main() {
  ll n,k; cin >> n >> k;
  vector<ll> p(n), c(n);
  rep(i,n) {cin >> p[i]; p[i]--;}
  rep(i,n) cin >> c[i];

  vector<int> loopsize(n);
  vector<ll> loopvalue(n);
  vector<vector<ll>> a(n, vector<ll>(n, 0));

  rep(i,n) {
    ll current = i;
    ll ss = 0;
    ll val = 0;
    rep(j,n) {
      ss++;
      ll pnext = p[current];
      val += c[pnext];
      current = pnext;
      if(current==i) {
        loopsize[i] = ss;
        loopvalue[i] = val;
        break;
      }
    }
  }

  rep(i,n) {
    ll current = i;
    rep(j,n) {
      ll pnext = p[current];
      a[i][j] = c[pnext] + (j>0 ? a[i][j-1] : 0);
      current = pnext;
      //if(current==i) break;
    }
  }

  ll ans = -1000000000;
  rep(i,n) {
    if(loopvalue[i] <= 0) {
      rep(j,loopsize[i]) ans = max(ans, a[i][j]);
    }
    else {
      ll loops = k / loopsize[i];

      ll base = loops * loopvalue[i];
      ans = max(ans, base);
      rep(j,k%loopsize[i]) ans = max(ans, base+a[i][j]);

      ll base2 = (loops-1) * loopvalue[i];
      //rep(j,n) ans = max(ans, base2+a[i][j]);
      rep(j,loopsize[i]) ans = max(ans, base2+a[i][j]);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 198820
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};

int h,w,k;
int sx,sy,gx,gy;


int main(){
    cin >> h >> w >> k;
    cin >> sx >> sy >> gx >> gy;
    sx--,sy--,gx--,gy--;
    vector<string> s(h);
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }
    vector<vector<bool>> dp(h + 1, vector<bool> (w + 1, 0));
    vector<vector<vector<bool>>> dpp(h + 1, vector<vector<bool>> (w + 1, vector<bool>(4, 0)));
    int ans = 0;
    set<P> st;
    st.insert({sx, sy});
    dp[sx][sy] = 0;
    while(not st.empty()){
        set<P> ns;
        for (int i = 0; i < 4; i++) {
            for(auto p:st){
                int x = p.fs, y = p.sc;
                if(gx == x && gy == y){
                    cout << ans << endl;
                    return 0;
                }
                for (int j = 0; j < k; j++) {
                    int nx = x + dx[i], ny = y + dy[i];
                    if(0<=nx&&nx<h&&0<=ny&&ny<w&&s[nx][ny] != '@'){
                        if(not dp[nx][ny]){
                            ns.insert({nx,ny});
                            dp[nx][ny] = true;
                        }
                        if(dpp[nx][ny][i]) break;
                        dpp[nx][ny][i] = true;
                    }
                    else{
                        break;
                    }
                    x = nx, y = ny;
                }
            }
        }
        for(auto t:ns){
            for (int i = 0; i < 4; i++) {
                dpp[t.fs][t.sc][i] = true;
            }
        }
        st = ns;
        ans++;
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 215316
s = input()
s += " "
ans = 0
acgt = ""
for i in range(len(s)):
    # print(s[i], s[i] == "A" or s[i] == "B" or s[i] == "C" or s[i] == "D")
    if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] == "T":
        acgt += s[i]
    else:
        if ans < len(acgt):
            ans = len(acgt)
        acgt = ""
print(ans)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    ll N, M;
    cin >> N >> M;
    ll ans = 0;
    for(ll i = 1; i * i <= M; i++){
        if(M % i)continue;
        ll a = M / i;
        ll b = i;
        if(N <= a)ans = max(ans, b);
        if(N <= b)ans = max(ans, a);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) {
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int N; cin>>N;
  map<string, int> cnt;
  REP(i,N) {
    string S; cin>>S;
    cnt[S]++;
  }
  cout << "AC x " << cnt["AC"] << endl;
  cout << "WA x " << cnt["WA"] << endl;
  cout << "TLE x " << cnt["TLE"] << endl;
  cout << "RE x " << cnt["RE"] << endl;
  return 0;
}


Measured memory_bytes: 3232
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
using namespace std;
#define INF 1LL << 61
#define MAX 1LL << 30
#define MOD 1000000007
typedef long long ll;
//typedef pair<ll,ll> P;
//typedef pair<pair<int,int>,int> p;
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)
struct edge{ll to,cost,val;};
template<class T,class U>bool chmin(T&a,const U&b){if(a<=b)return false;a=b;return true;}
template<class T,class U>bool chmax(T&a,const U&b){if(a>=b)return false;a=b;return true;}
//__builtin_popcount(S);
//C.erase(unique(C.begin(),C.end()),C.end());
//#define int ll
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};

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


    while(true){
        int N,P;
        cin>>N>>P;
        if(N==P && N==0){
            return 0;
        }
        int C[51];
        for(int i=0;i<51;i++) C[i]=0;
        bool flag=true;
        int p=P;
        while(flag){
            for(int i=0;i<N;i++){
                if(P>0){
                    C[i]++;
                    P--;
                }else{
                    P=C[i];
                    C[i]=0;
                }
                if(p==C[i]){
                    flag=false;
                    cout<<i<<endl;
                    break;
                }
            }
        }
    }
}



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

int main() {
  int N, M, A = 0;
  cin >> N;
  vector<string> blue(N);
  for (int i = 0; i < N; i++) {
    cin >> blue.at(i);
  }
  cin >> M;
  vector<string> red(M);
  for (int i = 0; i < M; i++) {
    cin >> red.at(i);
  }
  
  for (int i = 0; i < N; i++) {
    int count = 0;
    string X = blue.at(i);
    for (int j = 0; j < N; j++) {
      if (blue.at(j) == X) {
        count++;
      }
    }
    for (int j = 0; j < M; j++) {
      if (red.at(j) == X) {
        count--;
      }
    }
    if (count > A) {
      A = count;
    }
  }
  cout << A;
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
	mod            = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	t, a := nextInts(n), nextInts(n)

	topt, topa := make([]bool, n), make([]bool, n)
	topt[0], topa[n-1] = true, true
	for i := 1; i < n; i++ {
		topt[i] = t[i] > t[i-1]
	}
	for i := n - 2; i >= 0; i-- {
		topa[i] = a[i] > a[i+1]
	}

	ans := 1
	for i := 0; i < n; i++ {
		if topt[i] && topa[i] {
			if t[i] != a[i] {
				ans = 0
				break
			}
		} else if topt[i] {
			if t[i] > a[i] {
				ans = 0
				break
			}
		} else if topa[i] {
			if t[i] < a[i] {
				ans = 0
				break
			}
		} else {
			ans *= min(t[i], a[i])
			ans %= mod
		}
	}

	puts(ans)
}


Measured memory_bytes: 6064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>0;(i)--)
#define INF (1ll<<60)
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;

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

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}


int main(){
  lint N,M,S;
  string s;
  cin>>N>>M>>S;
if(N+M+S>21)cout<<"bust";
  else cout<<"win";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

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

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

        int cnt = 0;


        for (int i = 0; i < N; i++) {
            int sum = C;
            for (int j = 0; j < M; j++) {
                sum += A[i][j] * B[j];
            }
            if (sum > 0) {
                cnt++;
            }
        }

        System.out.println(cnt);

    }
}


Measured memory_bytes: 24404
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
int main(){
    int a[3][3];
    rep(i, 3) rep(j, 3) cin >> a[i][j];
    int n;
    cin >> n;
    bool open[3][3];
    rep(i, 3) rep(j, 3) open[i][j] = false;
    rep(i, n){
        int b;
        cin >> b;
        rep(i, 3) rep(j, 3) if (a[i][j]==b) open[i][j] = true;
    }

    bool ans = false;
    rep(i, 3) if (open[i][0]==true && open[i][1]==true && open[i][2]==true) ans = true;
    rep(j, 3) if (open[0][j]==true && open[1][j]==true && open[2][j]==true) ans = true;
    if (open[0][0]==true && open[1][1]==true && open[2][2]==true) ans = true;
    if (open[0][2]==true && open[1][1]==true && open[2][0]==true) ans = true;
    if (ans == true) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop(idx, N) for (auto idx(0); idx < N; ++idx)
using namespace std;


int main()
{
  int w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << (static_cast<double>(w) * static_cast<double>(h)) / 2.0 << " " << (((x+x) == w)&&((y+y) == h)) << endl;
  return 0;
}


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

int main() {
	string s;
	cin >> s;
	size_t a = count(s.begin(),s.end(), 'a');
	size_t b = count(s.begin(),s.end(), 'b');
	size_t c = count(s.begin(),s.end(), 'c');
	if (a == 1 && b == 1 && c == 1) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import itertools
N=int(input())
l=[]
for i in range(N):
    s=str(input())
    l.append(s[0])
m=0
a=0
r=0
c=0
h=0
for i in range(N):
    if l[i]=='M':
        m+=1
    elif l[i]=='A':
        a+=1
    elif l[i]=='R':
        r+=1
    elif l[i]=='C':
        c+=1
    elif l[i]=='H':
        h+=1
D=[0]*5
for i in range(5):
    D[0]=m
    D[1]=a
    D[2]=r
    D[3]=c
    D[4]=h

seq=[0,1,2,3,4]
l=list(itertools.combinations(seq,3))
ans=0
for i in range(len(l)):
    a=l[i][0]
    b=l[i][1]
    c=l[i][2]
    ans+=D[a]*D[b]*D[c]
print(ans)

Measured memory_bytes: 4024
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")

#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (int)(b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define f first
#define s second

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
ll n, m;
priority_queue<ll, vector<ll>> pq;
int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    F0R(i, n)
    {
        ll x;
        cin >> x;
        pq.push(x);
    }
    F0R(i, m)
    {
        ll cur = pq.top();
        cur/=2;
        pq.pop();
        pq.push(cur);
    }
    ll ans = 0;
    while(!pq.empty())
    {
        ans += pq.top();
        pq.pop();
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1400
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
char m[100][100];
int main()
{
	int mx, my, num;
	scanf("%d%d%d", &mx, &my, &num);
	int lx = 0, ux = mx, ly = 0, uy = my;
	for (int i = 0; i < num; i++)
	{
		int x, y, t;
		scanf("%d%d%d", &x, &y, &t);
		if (t == 1)lx = max(lx, x);
		if (t == 2)ux = min(ux, x);
		if (t == 3)ly = max(ly, y);
		if (t == 4)uy = min(uy, y);
	}
	printf("%d\n", max(0, ux - lx)*max(0, uy - ly));
}

Measured memory_bytes: 256
/**
 * Created by hiramekun at 20:39 on 2020-05-10.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n, m, x;
    cin >> n >> m >> x;

    vl c(n);
    vvl a(n, vl(m));
    rep(i, n) {
        cin >> c[i];
        rep(j, m) {
            cin >> a[i][j];
        }
    }

    ll ans = ll_inf;
    rep(i, pow(2, n)) {
        ll tmp = 0;
        vl rikai(m);
        rep(j, n) {
            if (((i >> j) & 1) == 1) {
                // j番目を読む
                tmp += c[j];
                rep(l, m) {
                    rikai[l] += a[j][l];
                }
            }
        }
        bool b = false;
        rep(j, m) {
            if (rikai[j] < x) {
                b = true;
                break;
            }
        }
        if (!b) ans = min(ans, tmp);
    }
    if (ans == ll_inf) cout << -1 << '\n';
    else cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 4112