akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ABC079D - Wall
  // 全ての数字を1に書き換える
  // 1までの最短経路
  // ワーシャルフロイド法
  int H, W; cin >> H >> W;
  vector<vector<int> > dp(10, vector<int>(10, 0));
  REP(i, 10) REP(j, 10) cin >> dp[i][j];
  
  // ワーシャルフロイド法
  REP(k, 10) REP(i, 10) REP(j, 10){
    if(dp[i][j] > dp[i][k] + dp[k][j]){
      dp[i][j] = dp[i][k] + dp[k][j];
    }
  }
  
  vector<int> A(10, 0);
  REP(i, H) REP(j, W){
    int tmp; cin >> tmp;
    if(tmp != -1)  A[tmp]++;
  }
  
  int ans = 0;
  REP(i, 10) ans += dp[i][1] * A[i];
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
main(){
    int i=0,n,x;
    vector<int>v;
    for(scanf("%d",&n);i<n;i++)scanf("%d",&x),v.push_back(x);
    make_heap(v.begin(),v.end());
    for(i=0;i<n;i++)printf(" %d",v[i]);
    puts("");
}

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

using namespace std;

string s;
int length;

int main () {
    cin >> s;
    length = s.length();
    for(int i = 0; i < length; i++){
        if(i % 2 == 0)
        {
            if (s.at(i) == 'R' || s.at(i) == 'U' || s.at(i) == 'D')
            {
                continue;
            }
        }
        else
        {
            if (s.at(i) == 'L' || s.at(i) == 'U' || s.at(i) == 'D')
            {
                continue;
            }
        }
        cout << "No" << endl;
        return 0;
    }
    
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    int L[M], R[M];
    for (int i = 0; i < M; ++i) {
        cin >> L[i] >> R[i];
    }
    int *L_max = max_element(L, L+M);
    int *R_max = min_element(R, R+M);
    if (*R_max < *L_max) {
        cout << 0 << endl;
    } else {
        cout << *R_max - *L_max + 1 << endl;
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int a,b;
	cin >> a >> b;
	if(a <= 0 && b >= 0) {cout << "Zero\n"; return 0;}
	if(a > 0) {cout << "Positive\n"; return 0;}
	if((a-b)%2 != 0) {cout << "Positive\n"; return 0;}
	cout << "Negative\n";
	return 0;}

// look at my code
// my code is amazing


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n, k;
    cin >> n >> k;

    vector<int> x(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }

    int r = 1 << 30;

    for (int l = 0; l < 2; l++) {
        int i0 = n;
        for (int i = 0; i < n; i++) {
            if (x[i] >= 0) {
                i0 = i;
                break;
            }
        }

        if (i0 < n) {
            for (int i = 1; i <= k; i++) {
                int i1 = i0 + i - 1;
                if (i1 >= n) continue;
                int j = k - i;
                if (j < 0) continue;
                int j1 = i0 - j;
                if (j1 < 0) continue;
                int t = x[i1] * 2 - x[j1];
                if (j == 0) t = x[i1];
                r = min(r, t);
            }
        }

        if (l == 0) {
            for (int i = 0; i < n; i++) {
                x[i] *= -1;
            }
            reverse(x.begin(), x.end());
        }
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a : u32 = read();

    println!("{}", a+a.pow(2)+a.pow(3));
}


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

int main() {
	int N, T;
	cin >> N >> T;

	int min = 1001;
	int cost, time;

	for (int i = 0; i < N; i++) {
		cin >> cost >> time;
		if (time <= T && cost <= min)
			min = cost;
	}

	if (min <= 1000)
		cout << min << endl;
	else
		cout << "TLE" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

int n,m;
vector<int> g[100010];
vector<bool> used(100010,false);
vector<int> vi(100010);

void dfs(int v){
    if(used[v]){
        return;
    }
    used[v]=true;
    for(auto itr:g[v]){
        if(!used[itr]){
            dfs(itr);
        }
    }
    vi.push_back(v);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>m;
    rep(i,m){
        int x,y;
        cin>>x>>y;
        g[x].push_back(y);
    }
    vector<int> dp(100010,0);
    FOR(i,1,n+1){
        if(!used[i]){
            dfs(i);
        }
    }
    int ans=0;
    for(auto itr:vi){
        for(auto itr2:g[itr]){
            dp[itr]=max(dp[itr],dp[itr2]+1);
        }
        ans=max(ans,dp[itr]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 8952
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template <class T>
ostream &operator<<(ostream &os, const set<T> &st) {
	for (const auto &e : st) os << e << " ";
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
	for (const auto &e : mp) os << e << " ";
	return os;
}

template< typename T >
vector< T > slide_min(const vector< T > &v, int k)
{
	deque< int > deq;
	vector< T > ret;
	for (int i = 0; i < v.size(); i++) {
		while (!deq.empty() && v[deq.back()] >= v[i]) {
			deq.pop_back();
		}
		deq.push_back(i);
		if (i - k + 1 >= 0) {
			ret.emplace_back(v[deq.front()]);
			if (deq.front() == i - k + 1) deq.pop_front();
		}
	}
	return ret;
}

template< typename T >
vector< T > operator-(const vector< T > &v) {
	vector< T > res(v.size());
	for (int i = 0; i < v.size(); i++) res[i] = -v[i];
	return res;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	vector<int> P(N);
	for (int i = 0; i < N; i++) {
		int p; cin >> p;
		P[i] = p;
	}

	auto smin = slide_min(P, K);
	auto smax = -slide_min(-P, K);
	DMP(smin, smax);

	int cnt1 = 0;
	for (int i = 0; i < N - K; i++) if (smin[i] == P[i] && smax[i + 1] == P[i + K]) cnt1++;

	int seq = 0, cnt2 = 0;
	for (int i = 0; i < N - 1; i++) {
		if (P[i] < P[i + 1]) seq++;
		else seq = 0;
		if (seq == K - 1) cnt2++;
	}

	DMP(N - K + 1, cnt1, cnt2);

	cout << N - K + 1 - cnt1 - max(cnt2 - 1, 0) << "\n";

	return 0;
}

Measured memory_bytes: 4344
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;int a[n],ans=0;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=1;i<n-1;i++)
    {
        if(a[i]>a[i-1]&&a[i]<a[i+1]||a[i]<a[i-1]&&a[i]>a[i+1])ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>     // [PRIMES]               1777 ~2^10.80  
using namespace std;                     //                       10333 ~2^13.33
using ll=long long;                      // seq 1 128 | factor   100333 ~2^16.61
using vl=vector<ll>;                     //   | grep -v ' .* '  1300111 ~2^20.31
using vvl=vector<vl>;                    //                    10300777 ~2^23.30
using vb=vector<bool>;                   //                   100400999 ~2^26.58
using vs=vector<string>;                 //                  1300400999 ~2^30.28
using pll=pair<ll,ll>;                   //                 10200500333 ~2^33.25
const ll oo =0x3f3f3f3f3f3f3f3fLL;       //                100200400777 ~2^36.54
const double eps=1e-9;                   //               1200300700111 ~2^40.13
#define sz(c) ll((c).size())             //              10200300500777 ~2^43.21
#define all(c) begin(c),end(c)           //             100200300400777 ~2^46.51
#define mp make_pair                     //            1200300400600999 ~2^50.09
#define mt make_tuple                    //           10200300400600111 ~2^53.18
#define pb push_back                     //          100200300400600333 ~2^56.48
#define eb emplace_back                  //         1200300400500800999 ~2^60.06
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

ll result[300005];
ll input[300005] = { 0 };
vector< ll > graph[300005];

void recurse(ll curr, ll before, ll counter) {
	ll tmp = counter += input[curr];
	result[curr] = tmp;
	for(auto neigh : graph[curr]) {
		if(neigh != before) {
			recurse(neigh, curr, tmp);
		}
	}
}


int main(){ 
	cin.sync_with_stdio(0);
	
	ll n, q;
	cin >> n >> q;

	FOR(i, 0, n - 1) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		graph[a].pb(b);
		graph[b].pb(a);
	}

	FOR(i, 0, q) {
		ll node, anz;
		cin >> node >> anz;
		node--;
		input[node] += anz;
	}
	
	recurse(0, -1, 0);	

	FOR(i, 0, n) {
		cout << result[i];	
		if (i != n - 1) cout << " ";
	}

	cout << endl;

	return 0;
	
	



} //cin.tie(0) bei schnellem Wechseln

Measured memory_bytes: 28928
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>

int main(){
    int N;
    std::cin >> N;
    std::vector<int> A(N),B;
    for(int i=0;i<N;i++){
        std::cin >> A[i];
    }
    int sum=0;
    for(int i=0;i<N+1;i++){
        if(i==0){
            sum+=std::abs(0-A[i]);
        }else if(i==N){
            sum+=std::abs(A[N-1]);
        }else{
            sum+=std::abs(A[i-1]-A[i]);
        }
    }
    B.push_back(sum-std::abs(A[0])-std::abs(A[0]-A[1])+std::abs(A[1]));
    for(int i=1;i<N-1;i++){
        
            B.push_back(sum-std::abs(A[i-1]-A[i])+std::abs(A[i-1]-A[i+1])-std::abs(A[i]-A[i+1]));
          
    }
    
    B.push_back(sum-std::abs(A[N-2]-A[N-1])-std::abs(A[N-1])+std::abs(A[N-2]));
    
    for(int i=0;i<N;i++){
        std::cout <<B[i] <<std::endl;
    }
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N);
	int S = 0;
	
	for(int i=0;i<N;i++){
		cin>>A[i];
		S += A[i];
	}
	
	
	bitset<4000001> B;
	B[0] = true;
	
	for(int i=0;i<N;i++){
		B |= (B<<A[i]);
	}
	
	int k = (S+1)/2;
	
	for(int i=k;true;k++){
		if(B[k]){
			cout<<k<<endl;
			return 0;
		}
	}

	return 0;
}

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

int main()
{
    string s;
    int sum=0;
    cin >> s;
    
    rep(i, s.size())
    {
        sum += s[i] - '0';
    }


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

Measured memory_bytes: 3712
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class Main {

    private static final int MOD = 998244353;

    static class Solver {
        long[] factorial;
        long[] facInverse;
        long[] inverse;

        void solve(int n, int m, int k) {
            init(n);
            int sum = 0;
            for (int i = 0; i <= k; i++) {
                final long edge = ncr(n - 1, i);
                sum = (int) ((sum + (edge * (m * modpow(m - 1, n - 1 - i) % MOD)) % MOD) % MOD);
            }
            System.out.println(sum);
        }

        void init(int n) {
            final int MAX = n + 2;
            factorial = new long[MAX];
            facInverse = new long[MAX];
            inverse = new long[MAX];
            factorial[0] = factorial[1] = 1;
            facInverse[0] = facInverse[1] = 1;
            inverse[1] = 1;
            for (int i = 2; i < MAX; i++) {
                factorial[i] = factorial[i - 1] * i % MOD;
                final long inv = inverse[i] = MOD - inverse[MOD % i] * (MOD / i) % MOD;
                facInverse[i] = facInverse[i - 1] * inv % MOD;
            }
        }

        long ncr(int n, int r) {
            if (n < r) { return 0; }
            if (n < 0 || r < 0) { return 0; }
            return factorial[n] * (facInverse[r] * facInverse[n - r] % MOD) % MOD;
        }

        long modpow(long a, long n) {
            long res = 1;
            while (n > 0) {
                if (n % 2 == 1) {
                    res = res * a % MOD;
                }
                a = a * a % MOD;
                n /= 2;
            }
            return res;
        }
    }

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int n = in.nextInt();
        final int m = in.nextInt();
        final int k = in.nextInt();
        in.nextLine();
        new Solver().solve(n, m, k);
    }
}


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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
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;
}

void solve(long long W, long long H, long long x, long long y) {
  int ans = -1;
  if( 2 * x == W && 2 * y == H ){
    ans = 1;
  }else{
    ans = 0;
  }
  printf("%.6lf %d\n", 1. * W * H / 2, ans);
}

int main() {
  long long W;
  scanf("%lld", &W);
  long long H;
  scanf("%lld", &H);
  long long x;
  scanf("%lld", &x);
  long long y;
  scanf("%lld", &y);
  solve(W, H, x, y);
  return 0;
}


Measured memory_bytes: 256
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int h, w;

bool isremoved(int x, int y) {
	if(x > h || y > w || x<=0 || y<=0) return true;
	return false;
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n, sr, sc;
	cin >> h >> w >> n;
	cin >> sr >> sc;
	string s, t;
	cin >> s >> t;
	bool wx = false; // removed
	int pr = sr, pc = sc;
	for(int i=0; i<n; i++) {
		if(s[i] == 'U') pr--;
		if( isremoved(pr, pc) ) {
			wx = true;
			break;
		}
		if( t[i] == 'D' && !isremoved(pr+1, pc) ) pr++;
	}
	if(wx) {
		cout << "NO\n";
		exit(0);
	}
	wx = false;
	pr = sr, pc = sc;
	for(int i=0; i<n; i++) {
		if(s[i] == 'D') pr++;
		if( isremoved(pr, pc) ) {
			wx = true;
			break;
		}
		if( t[i] == 'U' && !isremoved(pr-1, pc) ) pr--;
	}
	if(wx) {
		cout << "NO\n";
		exit(0);
	}

	wx = false;
	pr = sr, pc = sc;
	for(int i=0; i<n; i++) {
		if(s[i] == 'L') pc--;
		if( isremoved(pr, pc) ) {
			wx = true;
			break;
		}
		if( t[i] == 'R' && !isremoved(pr, pc+1) ) pc++;
	}
	if(wx) {
		cout << "NO\n";
		exit(0);
	}

	wx = false;
	pr = sr, pc = sc;
	for(int i=0; i<n; i++) {
		if(s[i] == 'R') pc++;
		if( isremoved(pr, pc) ) {
			wx = true;
			break;
		}
		if( t[i] == 'L' && !isremoved(pr, pc-1) ) pc--;
	}
	if(wx) {
		cout << "NO\n";
		exit(0);
	}
	cout << "YES\n";
	return 0;
}


Measured memory_bytes: 920
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String sFake = sc.next();
		String t = sc.next();
		String ans = "";
      boolean b = false;
		for(int i = sFake.length() - 1 ; i > t.length() - 2 ; i--) {
			String s = sFake.substring(i - t.length() + 1, i + 1);
			if(canReplace(s , t)) {
              b = true;
				for(int j = 0 ; j < sFake.length() ; j++) {
					if(j < i - t.length() + 1 || j > i) {
						ans += sFake.charAt(j) == '?' ? "a" : sFake.charAt(j);
					}
					else {
						ans += t.charAt(j - i + t.length() - 1);
					}
				}
				break;
			}
		}
      if(!b){
        System.out.println("UNRESTORABLE");
        return;
      }

		sc.close();
		System.out.println(ans);

	}
	public static boolean canReplace(String s , String t) {
		for(int i = 0 ; i < t.length() ; i++) {
			if(s.charAt(i) != '?') {
				if(s.charAt(i) != t.charAt(i))
					return false;
			}

		}
		return true;

	}
}



Measured memory_bytes: 40208
//初めての尺取り

#include<stdio.h>
#include<iostream>
using namespace std;

#define GOMAE (long long)50000
#define EPS (long long)4000
#define TO_OUTSIDE (long long)1500
#define IS_NOT_EVEN_HOBBY (long long)114
int N;
long long input;
long long A[300010];
long long ans;

//A[i]-A[st] >= A[ed]-A[i]となる最小のiを返す。
int seach1( int st, int ed, int i ){
	
	for( ; i < ed; i++ ){
		if( A[i]-A[st] >= A[ed]-A[i] )
			break;
	}
	return i;
}
//A[i]-A[st] >= Xとなる最小のiを返す。
int seach2( int st, int ed, long long X, int i ){
	
	for( ; i < ed; i++ ){
		if( A[i]-A[st] >= X )
			break;
	}
	return i;
}

int solve( long long X ){
	int i,j=0,k=0;
	
	if( X >= (A[N]>>1) )
		return 0;
	for( i = 0; i < N; i++ ){
		//大きさがX以上になるように切る
		for( ; j < N+i; j++ ){
			if( A[j]-A[i] >= X )
				break;
		}
		//できるだけ真ん中で切る
		for( ; k < N+i; k++ ){
			if( A[k]-A[j] >= A[N+i]-A[k] )
				break;
		}
		if( min( A[j]-A[i], min( A[k]-A[j], A[i+N]-A[k] ) ) >= X )
			break;
		k--;
		if( min( A[j]-A[i], min( A[k]-A[j], A[i+N]-A[k] ) ) >= X )
			break;
	}
	if( i < N )
		return 1;
	return 0;
}
				
int main(){
	int i,j,k;
	long long s = 0, e = GOMAE * EPS * TO_OUTSIDE * IS_NOT_EVEN_HOBBY * EPS;
	scanf("%d",&N);
	if( N > 100000 )
		return 0;
		
	for( i = 1; i < N+1; i++ ){
		scanf("%d",&input);
		A[i] = A[i-1]+input;
	}
	for( i = N+1; i < 3*N+1; i++ ){
		A[i] = A[i-N] + A[N];
	}
	
	//printf("%lld %lld\n",s,e);
	while( s <= e ){
		ans = (s+e)>>1;
		if( solve(ans) ){
			if( solve(ans+1) )
				s = ans+1;
			else
				break;
		}
		else{
			e = ans-1;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3536
from sys import stdin


n, *s = (x.rstrip() for x in stdin.readlines())

ac = s.count('AC')
wa = s.count('WA')
tle = s.count('TLE')
re = s.count('RE')

print(f'AC x {ac}')
print(f'WA x {wa}')
print(f'TLE x {tle}')
print(f'RE x {re}')


Measured memory_bytes: 23128
(* 素集合データ構造 *)
module UnionFind : sig
  type t

  (* 1要素だけを含む集合を作る *)
  val make : unit -> t
  (* 与えられた集合同士が同一かどうか判定する *)
  val equal : t -> t -> bool
  (* 与えられた集合同士を合併する *)
  val unite : t -> t -> unit
  (* 与えられた集合に属する要素の数を求める *)
  val cardinal : t -> int
end = struct
  (* type t = node ref
     and node = Either int t
     みたいなのがやりたくて，OCamlの実行時表現はintとそれ以外を区別できるので
     省メモリのためにこうしている *)
  type t = Obj.t ref

  let make () = ref (Obj.repr 1)

  let rec find uf =
    if Obj.is_int !uf
    then uf
    else begin
      let root = find (Obj.magic !uf) in
      uf := Obj.repr root; root
    end

  let equal uf uf' = find uf == find uf'

  let unite uf uf' =
    let root = find uf in
    let root' = find uf' in
    if root != root' then begin
      let card : int = Obj.magic !root in
      let card' : int = Obj.magic !root' in
      let root, root' =
        if card <= card'
        then root, root'
        else root', root in
      root := Obj.repr (card + card');
      root' := Obj.repr root
    end

  let cardinal uf = Obj.magic @@ ( ! ) @@ find uf
end

let () = Scanf.scanf "%d %d\n" @@ fun n m ->
  let abs = Array.init m @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun a b -> a - 1, b - 1 in
  let uf = Array.init n @@ fun _ -> UnionFind.make () in
  let ans = Array.make (m + 1) (n * (n - 1) / 2) in
  for i = m - 1 downto 0 do
    let (a, b) = abs.(i) in
    ans.(i) <- ans.(i + 1) -
      if UnionFind.equal uf.(a) uf.(b)
      then 0
      else begin
        let n = UnionFind.cardinal uf.(a) in
        let m = UnionFind.cardinal uf.(b) in
        UnionFind.unite uf.(a) uf.(b); n * m
      end
  done;
  for i = 1 to m do
    Printf.printf "%d\n" ans.(i)
  done



Measured memory_bytes: 10880
while true
  n,m = gets.split(" ").map{|str| str.to_i}
  break if n==0&&m==0

  taro = Array.new(n){gets.to_i}
  hanako = Array.new(m){gets.to_i}
  sumt = taro.inject(:+)
  sumh = hanako.inject(:+)

  #?????????????????????t,??±??????????????????h??¨????????? sumt-t+h = sumh+t-h??¨?????£????¬???????
  min = -1
  anst = 0
  ansh = 0
  for i in 0..n-1
    t = taro[i]
    for j in 0..m-1
      h = hanako[j]
      if sumt-sumh == 2*(t-h)
        if min==-1 || t+h <min
          min = t+h
          anst,ansh = t,h
        end
      end
    end
  end
  puts(min<0 ? -1 : "#{anst} #{ansh}") 
end

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

int main()
{
  int n;
  cin>>n;
  int b[n-1],i,sum;
  for(i=0;i<n-1;i++){
    cin>>b[i];
  }
  sum=b[0];
  for(i=1;i<n-1;i++){
    if(b[i]>b[i-1]) sum+=b[i-1];
    else sum+=b[i];
  }
  sum+=b[n-2];
  cout<<sum<<endl;  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 <class T, class U>ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >>p.second ;
	return is;
}
template <class T>istream& operator>>(istream& is,  vector<T>& v) {
	rep(i, v.size()) {
		is >> v[i];
	}
	return is;
}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	ll ans=0LL;
	cin >>n;
	VPi a(n);
	rep(i, n) { cin >> a[i].F;
		a[i].S = i;
	}
	sort(all(a));
	int ns = 0;
	rep(i,n){
		if((i%2)!= (a[i].S%2)){
			ns++;
		}
	}

	cout<<ns/2<<endl;
}

Measured memory_bytes: 4004
import numpy as np

def resolve():
    x1, y1, x2, y2 = map(int, input().split())
    p1 = np.array([x1, y1])
    p2 = np.array([x2, y2])

    rot_matrix = np.array([[0, -1], [1, 0]])
    p3 = p2 + np.dot(rot_matrix, p2 - p1)
    p4 = p3 + np.dot(rot_matrix, p3 - p2)

    print(p3[0], p3[1], p4[0], p4[1])
    
resolve()

Measured memory_bytes: 27008
import re


n, k = map(int, input().split())
s = input()
s_re = re.split(r'(0+)', s)
srl = len(s_re)
m = [0] * srl
if srl // 2 <= k:
    ans = n
else:
    for i, w in enumerate(s_re):
        m[i] = len(w)
    tmp = sum(m[:k * 2 + 1])
    ans = tmp
    for i in range(0, srl, 2):
        ie = i + k * 2 + 1
        if ie < srl:
            tmp = tmp - m[i] - m[i+1] + m[ie] + m[ie+1]
            ans = max(ans, tmp)
        else:
            break
print(ans)

Measured memory_bytes: 5528
#include <math.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <chrono>
#include <climits>
using namespace std ;
#define ld long double
#define int long long
#define ii pair<int,int>
#define _ ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL);
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
const int N = 2e5+7 ;
const int INF = 1e9 ;
const int MOD = INF + 7 ;
string s ;
int ans = 1 ;
vi g[N] ;
int n , cost ;
/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
template <typename T,typename S>
ostream & operator << (ostream &os , const map<T,S> &v) {
    for(auto it : v) {
        os << it.first << " : " << it.second << "\n" ;
    }
    return os ;
}
//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void dfs(int now , int past, int K){
	ans = (ans * K % MOD) ;
	//trace(now ,past , K , ans ) ;

	K = cost-1 ;
	if(past != -1) K-- ; 
	for(int x : g[now]){
		if(x == past) continue ;
		dfs(x,now,K) ;
		K-- ;
	///	trace(ans ,now ,past , K ) ;
	}
}

void solve(){
	cin >> n >> cost ;
	for(int i = 1 ; i < n ; i++){
		int u , v ;cin >> u >> v ;
		--u ; --v ;
		g[u].pb(v) ;
		g[v].pb(u) ;
	}
	dfs(0,-1,cost) ;
	cout << ans << endl ;
}

int32_t main(){_
	int t = 1 ;
//	cin >> t ;
	while(t--){
		solve() ;
	}

}


Measured memory_bytes: 11648
from sys import stdin
import fractions
mod = 10**9+7
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def div(a, b):
    return mul(a, pow(b, mod-2,mod))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

l = 1
for i in A:
    l = lcm(l,i)
    
for j in A:
    ans += div(l,j)
    ans %= mod
    
print(ans)

Measured memory_bytes: 6108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main() {
    ll N, M; cin >> N >> M;
   
    
    ll x; while(x * x < M) x++;
    ll temp = 0;
    for(ll i = x; i >= 1; i--) {
        if(M % i != 0) continue;
        if(i == N) {cout << M / i << endl; return 0;}
        if(M / i == N) {cout << i << endl; return 0;}
        if(min(i, M / i) > N) temp = max(i, M / i);
        if(max(i, M / i) > N and min(i, M / i) < N and temp < min(i, M / i) ) {cout << min(i, M / i) << endl; return 0;}
        else continue;
    }
    cout << temp << endl;
    return 0;
    
    

}

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

constexpr int MAX_C = 10;
constexpr int MAX_R = 10000;

int R, C;
bool a[MAX_C][MAX_R];

int solve();

int dfs(const int& n = 0);

int main(){
	std::ios::sync_with_stdio(false);
	while(true){
		std::cin >> C >> R;

		if(C == 0 && R == 0){
			break;
		}

		for(int i = 0; i < C; ++i){
			for(int j = 0; j < R; ++j){
				char in;
				std::cin >> in;
				if(in == '1'){
					a[i][j] = true;
				}
				else{
					a[i][j] = false;
				}
			}
		}
		
		std::cout << dfs() << std::endl;
	}
	return 0;
}

int dfs(const int& n){
	if(n == C){
		return solve();
	}

	int res = 0;
	for(int i = 0; i < R; ++i){
		a[n][i] = !a[n][i];
	}
	res = dfs(n + 1);
	for(int i = 0; i < R; ++i){
		a[n][i] = !a[n][i];
	}
	res = std::max(res, dfs(n + 1));

	return res;
}

int solve(){
	int res = 0;
	for(int i = 0; i < R; ++i){
		int _a = 0, _b = 0;
		for(int j = 0; j < C; ++j){
			if(a[j][i]){
				++_a;
			}
			else{
				++_b;
			}
		}
		res += std::max(_a, _b);
	}
	return res;
}

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

int main()
{
  int N, K;
  string S;
  cin >> N >> S >> K;
  for (int i = 0; i < N; i++)
  {
    if (S.at(K - 1) != S.at(i))
      S.at(i) = '*';
  }
  cout << S << endl;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	s := nextStr()

	for j := 'a'; j <= 'z'; j++ {
		found := false
		for i := 0; i < len(s); i++ {
			if s[i] == byte(j) {
				found = true
				break
			}
		}
		if found == false {
			fmt.Println(string(j))
			return
		}
	}

	fmt.Println("None")

}

// ---- readfunc
func scanInit() {
	const cap = 1000 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


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

public class Main {

     static Scanner scanner;

     public static void main(String[] args) {
         scanner = new Scanner(System.in);

         int N=gi();
         int[] A=new int[100001];
         int ans=N;
         for(int i=0; i<N;i++) {
        	 int v=gi();
        	 A[v]++;
        	 if(A[v]>1)ans--;
         }

         if(ans%2==0)ans--;
         System.out.println(ans);
     }

     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

Measured memory_bytes: 59148
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>

using namespace std;
using ll = long long;

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

    int N, K, X, Y;
    cin >> N;
    cin >> K;
    cin >> X;
    cin >> Y;

    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if (i < K) {
            ans += X;
        } else {
            ans += Y;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
def ri(): return int(input())
def rli(): return list(map(int, input().split()))


def tax(p, rate):
    return p*(100+rate)//100

ans = 0
x, y, s = rli()
while(x != 0 or y != 0 or s != 0):
    sum_bf = int(s/(100+x)*100)
    for i in range(sum_bf-2, sum_bf+3):
        for j in range(1,i):
            k = i-j
            if(tax(k, x) + tax(j, x) == s):
                ans = max(ans, tax(k, y) + tax(j, y))
    print(ans)
    ans = 0
    x, y, s = rli()

Measured memory_bytes: 7724
#include<bits/stdc++.h>
#define ll long long
#define pi acos(-1)
#define io  ios_base::sync_with_stdio(false); cin.tie(0);
using namespace std;
int main(){
    int d;
    double de;
    cin>>d;
    de=2*pi*d;
   printf("%.6lf\n",de);

return 0;
}


Measured memory_bytes: 3764
n, q = map(int, input().split())
s = input()

# lr = [list(map(int, input().split())) for _ in range(q)]

# 愚直な計算時間
# ループn回
# リスト切り取りO(n)
# O(n^2)
# 計算リミットが2000msで、n<=10^5
# 0(n)でn=10^6くらいが限度
# O8n^2)だと、n=3000くらい

# 先に回数を数える。累積和的に
# ここで結構時間かかる
# hoge = [s[0:(i + 1)].count('AC') for i in range(n)]

# 修正ver
hoge = [0]
cnt = 0
for i in range(1, n):
    if s[i - 1] + s[i] == 'AC':
        cnt += 1
    hoge.append(cnt)

for _ in range(q):
    l, r = map(int, input().split())
    print(hoge[r - 1] - hoge[l - 1])


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

int main(){
  string S;
  string k="keyence";
  int idx=6;
  cin >> S;
  for(int i=S.size()-1; i>=0; i--){
    if(S[i]==k[idx]){
      idx--; continue;
    }
    else break;
  }
  for(int i=idx; i>=0; i--){
    if(S[i]==k[i]){
      idx--; continue;
    }
  }
  if(idx==-1){
    cout << "YES" << endl;
    return 0;
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
//Structured Program I - Print a Frame
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));

		 int input =Integer.parseInt(in.readLine());
//		int input = 30;

		for (int i = 1; i <= input; i++) {

			if (i % 3 == 0) {
				System.out.print(" " + i);
			} else if (i % 10 == 3) {
				System.out.print(" " + i);
			} else if (i / 10 % 10 == 3) {
				System.out.print(" " + i);
			} else if (i / 100 % 10 == 3) {
				System.out.print(" " + i);
			} else if (i / 1000 % 10 == 3) {
				System.out.print(" " + i);
			}

		}
		System.out.println();

	}
}

Measured memory_bytes: 21940
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define n_p(v) next_permutation(v.begin(),v.end())
#define to_ll(b) stoll(b)
#define MOD 1000000007
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int n; cin>>n;
	string s; cin>>s;
	int ans=0;
	int x=0;
	for(char c:s){
		if(c=='I') ++x;
		else --x;
		ans=max(ans,x);
	}
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 256
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#import fractions
#import itertools
#import math
#lis=list(input().split())
#lis=list(map(float,input().split()))
#S=input()

n=int(input())
lis=list(map(int,input().split()))
lis.sort()
half=int(n/2)
a=lis[half-1]
b=lis[half]
delta=b-a
ans=delta

print(ans)


Measured memory_bytes: 14428
#include<bits/stdc++.h>
#define N 105
using namespace std;
vector<pair<int,int> >now;
typedef long long LL;
int n;LL a[N],b[N];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	  scanf("%lld",&a[i]),b[i]=a[i];
	now.clear();
	for (int i=2;i<=n;i++){
		if (a[i-1]<=a[i]) continue;
		if (abs(a[i-1])>=abs(a[i])){
		  now.push_back(make_pair(i-1,i));
		  if (a[i-1]>(a[i]+=a[i-1])) 
		    a[i]+=a[i-1],now.push_back(make_pair(i-1,i));
		  assert(a[i-1]<=a[i]);continue;
		}
		now.clear();
		for (int k=1;k<=n;k++) a[i]=b[i];
		for (int k=i;k>1;k--)
		  now.push_back(make_pair(k,k-1)),now.push_back(make_pair(k,k-1)),a[k-1]+=a[k]*2;
	}
	printf("%d\n",now.size());
	for (int i=0;i<now.size();i++)
	  printf("%d %d\n",now[i].first,now[i].second);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
ll n;
ll ch[12];
void dep(ll now,ll ma){
	if(now==n){
		for(ll i=0;i<n;i++){
			ll ne=ch[i];
			cout << char(ne+'a');
		}
		cout <<endl;
		return;
	}
	for(ll i=0;i<=ma+1;i++){
		ch[now]=i;
		dep(now+1,max(i,ma));
	}
}
int main() {
	cin>>n;
	ch[0]=0;
	dep(1,0);
	// your code goes here
	return 0;
}

Measured memory_bytes: 3608
def main():
    n, m = map(int, input().split())
    p = [0] + list(map(int, input().split()))
    cnt = 0
    global parent
    parent = list(range(n+1))
    for _ in range(m):
        x, y = map(int, input().split())
        unite(x, y)
    for i in range(1, n+1):
        cnt += (root(i) == root(p[i]))
    print(cnt)

def root(x):
    if parent[x] == x:
        return x
    parent[x] = root(parent[x])
    return parent[x]

def unite(x, y):
    root_x = root(x)
    if root_x != root(y):
        parent[root_x] = y

if __name__ == "__main__":
    main()

Measured memory_bytes: 121708
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int a,b;
  cin>>a>>b; 

  cout << max(0,a-b) << endl;

}

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

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

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
using namespace std;

long long x,i,ok,a,st,dr,b,mij,okk,y;
long long poww(long long a)
{
    return a*a*a*a*a;
}
int main()
{

    cin>>x;
    ok=0;
    for(i=0;i<=120&&!ok;i++)
    {
        a=poww(i);
        y=x;
        x-=a;
        st=-120;
        dr=120;
        okk=0;
        //cout<<i<<" "<<a<<" "<<x<<"\n";
        while(st<=dr&&!okk)
        {
            mij=(st+dr)/2;
            b=poww(mij);
            if(b==-x)
                okk=1;
            if(b<-x)
                st=mij+1;
            else
                dr=mij-1;

          //  if(i==65)
                //cout<<mij<<" "<<b<<" "<<-x<<'\n';
        }
        x=y;
        if(okk)
        {
            cout<<i<<" "<<mij;
            ok=1;
        }
    }
    return 0;

}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int arr[100005];
map<int,int>ma;
int main()
{
	int n;
	scanf("%d",&n);
	int i,j;
	for(i=0;i<n;i++)
	{
		scanf("%d",&arr[i]);
		ma[arr[i]]++;
	}
	map<int,int>::iterator it;
	int answ=0;
	for(it=ma.begin();it!=ma.end();it++)
	{
		int x=it->first;
		int y=it->second;
		if(y>=x)
		answ+=(y-x);
		else
		answ+=y;
	}
	printf("%d\n",answ);
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#define ordered_set tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update>
#pragma 03
using namespace std;
using namespace __gnu_pbds;
ll mod = 998244353;
ll dp[200005][3][3][2]; 
set <string> vis;
ll ss3(string s){
    vis.insert(s);
    for (ll i = 1; i < s.size(); i++){
        if (s[i] != s[i - 1]){
            string s1 = s;
            s1[i] = s1[i - 1] = (3 - (s1[i] - 'a') - (s1[i - 1] - 'a')) + 'a';
            if (vis.count(s1)) continue; ss3(s1);
        }
    }
    return vis.size();
}
int main(){
	string s; cin >> s;
	ll n = s.length(), edge = 0;
	for (ll i = 0; i < n - 1; i++) edge |= (s[i] != s[i + 1]);
	if (!edge) cout << 1 << endl;
	else if (n <= 3) cout << ss3(s) << endl;
	else{
		dp[1][0][0][0] = dp[1][1][1][0] = dp[1][2][2][0] = 1; 
		ll ans = 0; edge = 0;
		for (ll i = 1; i < n; i++){
			for (ll j = 0; j < 3; j++){
				for (ll k = 0; k < 3; k++){
					for (ll t = 0; t < 3; t++){
						for (ll l = 0; l < 2; l++) (dp[i + 1][t][(k + t) % 3][l | (t == j)] += dp[i][j][k][l]) %= mod;
					}
				}
			}
		}
		ll ss = 0; for (ll i = 0; i < n; i++) ss += (s[i] - 'a'); ss %= 3;
		for (ll j = 0; j < 3; j++) (ans += dp[n][j][ss][1]) %= mod;
		for (ll i = 0; i < n - 1; i++) edge |= (s[i] == s[i + 1]);
		cout << (ans + 1 - edge) % mod << endl; 
	}
}

Measured memory_bytes: 31868
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  ll a, b, k;
  scanf("%lld%lld%lld", &a, &b, &k);
  if (a <= k)
    printf("%d %lld\n", 0, MAX(0, b - (k - a)));
  else
    printf("%lld %lld\n", a - k, b);
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] abcd = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            var list = new List<long>();
            list.Add(abcd[0] * abcd[2]);
            list.Add(abcd[0] * abcd[3]);
            list.Add(abcd[1] * abcd[2]);
            list.Add(abcd[1] * abcd[3]);
            Console.WriteLine(list.Max());
        }
    }
}

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

int main() {
  string s;
  cin >> s;
  vector<string> a(3);
  a[0] = "Sunny";
  a[1] = "Cloudy";
  a[2] = "Rainy";
  rep(i,3) {
    if (s == a[i]) cout << a[(i+1)%3] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define dl double long
const int INF=0x3fffffff;
const ll MOD=1000000007;
const ll MODD=998244353;
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }

int main()
{
  ll N, ans=0;
  cin >> N;
  vector<ll> d(N);
  rep(i, N) cin >> d[i];
  sort(d.begin(), d.end());
  cout << d[N/2]-d[N/2-1] << "\n";
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define ll long long int
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define inputv(a) forall(i,0,a.size()) cin>>a[i]
#define outputv(a) for(auto i:a) cout<<i<<" ";br;
#define fs first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define minv(a) *min_element(all(a))
#define maxv(a) *max_element(all(a))
#define br cout<<"\n"
using namespace std;
int dr[]={-1,1,0,0};
int dc[]={0,0,-1,1};
ll mod=1000000007;
ll po(ll x,ll n){
    ll res = 1;
    while(n>0){
        if(n%2==1)
            res = ((res)*(x));
        x = (x*x);
        n = n/2;
    }
    return res;
}
ll ceil(ll x,ll y)
{
    if(x%y==0)
        return x/y;
    else
        return(x/y)+1;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll a[n];
    rep(i,0,n) cin>>a[i];
    ll dp[n+2]={0};
    for(ll i=0;i<=n;i++)
        dp[i]=INT_MAX;
    dp[0]=0;
    dp[1]=0;
    dp[2]=abs(a[1]-a[0]);
    for(ll i=3;i<=n;i++)
    {
        for(ll j=1;j<=k;j++)
        {
            if(j<i)
                dp[i]=min(dp[i],dp[i-j]+abs(a[i-1]-a[i-j-1]));
        }

    }
    cout<<dp[n];

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
using namespace std;
#define rep(i,n) for(int i=1;i<n+1;i++)
#define ll long long int
//�ő���񐔂ƍŏ����{��

int main(){
  int K;
  cin>>K;
  ll count=0;
  rep(a,K){
    rep(b,K){
      rep(c,K){
	count+=gcd(gcd(a,b),c);
 
      }
    }
  }
 
  cout<<count;
 
  return 0;
}

Measured memory_bytes: 3604