akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Debug = System.Diagnostics.Debug;
using static System.Math;
using System.Runtime.CompilerServices;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        int a = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();
        Console.WriteLine(3200 <= a ? s : "red");
    }

    static readonly TextReader In = Console.In;
    static int NextInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0;
            int next = In.Read();
            int rev = 1;
            while (45 > next || next > 57) next = In.Read();
            if (next == 45) { next = In.Read(); rev = -1; }
            while (48 <= next && next <= 57)
            {
                res = res * 10 + next - 48;
                next = In.Read();
            }
            return res * rev;
        }
    }
}


Measured memory_bytes: 13140
n, k = map(int, input().split())
a = list(map(int, input().split()))

MOD = 10 ** 9 + 7

dp = [[0 for _ in range(k+1)] for _ in range(n)]

dp[0][0] = 1
for j in range(1, a[0] + 1):
    dp[0][j] = 1

for i in range(1, n):
    dp[i][0] = 1
    for j in range(1, k+1):
        temp = dp[i-1][j]
        if j > 0:
            temp += dp[i][j-1]
        if j-a[i] > 0:
            temp -= dp[i-1][j-a[i]-1]
        dp[i][j] = (temp + MOD) % MOD

print(dp[n-1][k])

Measured memory_bytes: 171400
def main():
    N = int(input())
    S = {}
    for i in range(N):
        K = str(input())
        if(K not in S):
            S[K] = 0
        else:
            S[K] += 1
    max_v = max(S.items(), key = lambda x: x[1])
    ans = []
    for k, v in S.items():
        if v == max_v[1]:
            ans.append(k)
    ans.sort()
    for a in ans:
        print(a)
#     print(k[v.index(max(v))])
#     print(max(S, key=lambda k: S[k]))
#     print(Main(N, S))

if __name__ == '__main__':
    main()

Measured memory_bytes: 32092
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		String str;
		String[] spl = new String[100];
		String[] cp = new String[100];
		String ch = "";
		int [] count = new int[100];
		int i = 0;
		int Cc = 0;
		Scanner scan= new Scanner(System.in);

		str = scan.next();
		spl = str.split("");

		for(String s : spl) {
			cp[i] = s;
			i++;
		}
		for(int j = 0; j < str.length(); j++) {
			String U = str.substring(j + 1,str.length());
			if(!U.contains(cp[j])) {
				ch = cp[j];
				for(int k = 0;k < str.length(); k++) {
					if(ch.equals(cp[k])) {
						count[j]++;
					}
				}
			}
		}
		for(int l= 0; l < str.length(); l++) {
			if(count[l] % 2 != 0) {
				Cc++;
			}
		}
		if(Cc > 0) {
			System.out.println("No");
		}
		else {
			System.out.println("Yes");
		}
	}
}

Measured memory_bytes: 23124
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int t[n];
    for(int i = 0; i < n; i++) {
        cin >> t[i];
    }
    int m;
    cin >> m;
    int p[m];
    int x[m];
    for(int i = 0; i < m; i++) {
        cin >> p[i] >> x[i];
    }
    
    for(int i = 0; i < m; i++) {
        int sum = 0;
        for(int j = 0; j < n; j++) {
            if (j == p[i] - 1) {
                sum += x[i];
            } else {
                sum += t[j];
            }
        }
        cout << sum << endl;
    }
}

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

final class P{
    double x,y;
    P(double a,double b){
        x=a;y=b;
    }
    double dist(P o){
        return Math.sqrt(Math.pow(x-o.x,2)+Math.pow(y-o.y,2));
    }
}
class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        P s=sc.nextP();
        P t=sc.nextP();
        int n=sc.nextInt();
        P[]xy=new P[n];
        double[]r=new double[n];
        for(int i=0;i<n;++i){
            xy[i]=sc.nextP();
            r[i]=sc.nextDouble();
        }
        double[][]d=new double[n+2][n+2];
        d[0][1]=d[1][0]=s.dist(t);
        for(int i=0;i<n;++i)
            d[0][i+2]=d[i+2][0]=Math.max(0,s.dist(xy[i])-r[i]);
        for(int i=0;i<n;++i)
            d[1][i+2]=d[i+2][1]=Math.max(0,t.dist(xy[i])-r[i]);
        for(int i=0;i<n;++i)
            for(int j=0;j<n;++j)
                d[j+2][i+2]=d[i+2][j+2]=Math.max(0,xy[j].dist(xy[i])-r[i]-r[j]);
        double[]dist=new double[n+2];
        Arrays.fill(dist,1.0/0.0);
        dist[0]=0.0;
        boolean[]det=new boolean[n+2];
        for(int i=0;i<n+2;++i){
            double min=1.0/0.0;
            int minind=-1;
            for(int j=0;j<n+2;++j){
                if(!det[j]&&min>dist[j]){
                    min=dist[j];
                    minind=j;
                }
            }
            assert minind>=0;
            det[minind]=true;
            for(int j=0;j<n+2;++j)
                dist[j]=Math.min(dist[j],min+d[minind][j]);
        }
        out.println(dist[1]);
        out.close();
    }
    // http://codeforces.com/blog/entry/7018
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        P nextP(){
            double x=nextDouble();
            double y=nextDouble();
            return new P(x,y);
        }
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


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

int main(){
    int N, M; cin >> N >> M;
    int task = 0, k;
    int A[10007];

    for(int i =0; i <M; i++){
        cin >> k;
        task += k;
    }

    if(N >= task){
        cout << N-task << endl;
    } else if(N < task){
        cout << "-1" << endl;
    }

}

Measured memory_bytes: 3680
INF = 9999999999
def prque_pop(n)
  rep = @a[0]
  @a[0] = @a[n-1]
  @a[n-1] = -INF
  id = 0
  while 1
    if 2*id+1 < n-1
      lft = 2*id+1
      (2*id+2 < n-1) ? (rit = 2*id+2):(rit = lft)
      if @a[id] <= @a[lft] || @a[id] <= @a[rit]
        (@a[lft] >= @a[rit]) ? (swp = lft):(swp = rit)
        tmp = @a[id]
        @a[id] = @a[swp]
        @a[swp] = tmp
        id = swp
      else
        break
      end
    else
      break
    end
  end
  return rep
end

def prque_push(n, v)
  @a[n-1] = v
  id = n-1
  while 1
    cmp = (id-1)/2
    if id > 0 && @a[id] > @a[cmp]
      tmp = @a[id]
      @a[id] = @a[cmp]
      @a[cmp] = tmp
      id = cmp
    else
      break
    end
  end
end


n, m = gets.split.map(&:to_i)
@a = gets.split.map(&:to_i)

@a.sort!{|x, y| y <=> x}

for i in 1..m
  break if @a[0] == 0
  disc = prque_pop(n) / 2
  prque_push(n, disc)
  #puts @a.join(" ")
end

sum = 0
@a.each{|v| sum += v}
puts sum

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

int main() {
  int N, C, K;
  cin >> N >> C >> K;

  vector<int> T(N);
  for (int i = 0; i < N; i++) cin >> T[i];
  sort(T.begin(), T.end());

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

    while (i < N && T[i] <= T[start_i] + K && i - start_i < C) {
      i++;
    }
  }

  cout << bus_count << endl;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
#define ll long long
ll mod = 1000000000+7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);  
    cout.tie(NULL);
    ll T;
    T=1;
    //cin>>T;
    start:
    while(T--)
    {
        ll n;
        cin>>n;
        ll ans = 0;
        for(ll i=1;i<=n;i++){
            ll x;
            cin>>x;
            if(x%2==1&&i%2==1){ans++;}
        }
        cout<<ans<<endl;
        
    }
    return 0;
}



Measured memory_bytes: 3604
import itertools

N = int(input())
N_list = [i for i in range(1,N+1)]

P = list(itertools.permutations(N_list))
P.sort()

Q = tuple(map(int, input().split()))
O = tuple(map(int, input().split()))

Q_number = P.index(Q) + 1
O_number = P.index(O) + 1

print(abs(Q_number - O_number))




Measured memory_bytes: 13784
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		int N = int.Parse(Console.ReadLine());
		int[][]A = new int[N][];
		for(var i=0;i<N;i++){
			string[] str = Console.ReadLine().Split();
			A[i] = new int[2]{int.Parse(str[0]),int.Parse(str[1])};
		}
		Array.Sort(A,(x,y)=>x[1]-y[1]);
		string ans = "Yes";
		long a = 0;
		for(var i=0;i<N;i++){
			a += A[i][0];
			if(a>A[i][1]){
				ans = "No";
				break;
			}
		}
		Console.WriteLine(ans);
	}
}

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

using namespace std;

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

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	int n=s.size();
	REP(i, n){
		REP(j, n-i){
			string tmp="";
			if(j>0){
				tmp+=s.substr(0, j);
			}
			tmp+=s.substr(j+i, n);
			if(tmp=="keyence"){
				cout<<"YES"<<'\n';
				return 0;
			}
		}
	}
	cout<<"NO"<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

int main(){

    int N;
    cin >> N;
    vector<pair<int, int>> p(N);

    int a;
    for(int i = 0; i < N; i++){
        cin >> a;
        p[i] = make_pair(a, i + 1);
    }

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

    for(int i = 0; i < N; i++){
        cout << p[i].second;
        if(i == N - 1){
            cout << endl;
        }
        else{
            cout << " ";
        }
    }

    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
#define reps(i, S, E) for (ll i = (S); i <= (E); i++)
#define rep(i, N) reps(i, 0, N-1)
#define deps(i, E, S) for (ll i = (E); i >= (S); i--)
#define dep(i, N) deps(i, N-1, 0)
const ll MOD = 1000000007;
const ll INF = 1LL << 60;


//AtCoder Beginner Contest 134 - A B
int main() {
	ll N;
	scanf("%lld", &N);
	ll D;
	scanf("%lld", &D);

	ll result = (ll)ceil((double)N / (1 + D * 2));

	printf("%lld\n", result);
}

/*
int main() {
	ll r;
	scanf("%lld", &r);

	ll result = 3 * r * r;

	printf("%lld\n", result);
}
*/

//AtCoder Beginner Contest 135 - B
/*
int main() {
	ll N;
	scanf("%lld", &N);
	vector<ll> p(N);
	for (ll i = 0; i < N; i++) {
		scanf("%lld", &p[i]);
	}

	ll err = 0;
	rep(i, N) {
		if (p[i] != i + 1) {
			err++;
		}
	}

	if (err <= 2) {
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}
}
*/

//AtCoder Beginner Contest 135 - A
/*
int main() {
	ll A;
	scanf("%lld", &A);
	ll B;
	scanf("%lld", &B);

	if (abs(A - B) % 2 == 1) {
		printf("IMPOSSIBLE\n");
		return 0;
	}

	ll ans = abs(A - B) / 2;
	ll result = min(A, B) + ans;

	printf("%lld\n", result);
}
*/

//AtCoder Beginner Contest 126 - B
/*
int main() {
	char s[101010];
	scanf("%s", s);
	ll len = strlen(s);

	ll front = (s[0] - '0') * 10 + (s[1] - '0');
	ll back = (s[2] - '0') * 10 + (s[3] - '0');

	if ((front > 12 && back > 12) || (front > 12 && back == 0) || (back > 12 && front == 0) || (back == 0 && front == 0)) {
		printf("NA\n");
	}
	else if (front > 12 || front == 0) {
		printf("YYMM\n");
	}
	else if (back > 12 || back == 0) {
		printf("MMYY\n");
	}
	else {
		printf("AMBIGUOUS\n");
	}
}
*/

//AtCoder Beginner Contest 126 - A
/*
int main() {
	ll N;
	scanf("%lld", &N);
	ll K;
	scanf("%lld", &K);
	char s[101010];
	scanf("%s", s);
	ll len = strlen(s);

	s[K - 1] = s[K - 1] - 'A' + 'a';

	printf("%s\n", s);
}
*/

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long

const int MOD =  1000000007;
const int IINF = INT_MAX;
const ll INF = 1LL << 60;


int main() {
    int x, y; cin >> x >> y;
    cout << x + y / 2 << endl;

    return 0;
}


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

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

class TaskA
{
public:
  void solve(istream &in, ostream &out)
  {
    int A, B, C, D;
    in >> A >> B >> C >> D;
    if(A + B > C + D) {
      out << "Left";
    } else if(A + B == C + D) {
      out << "Balanced";
    } else {
      out << "Right";
    }
  }
};


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  TaskA solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);

}


Measured memory_bytes: 256
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#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>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin >>s;
    int n = s.size();
    bool flag = true;
    for(int i = 0; i < n; i += 2)
        if(s[i] == 'L')
            flag = false;
    for(int i = 1; i < n; i += 2)
        if(s[i] == 'R')
            flag = false;
    if(flag)
        cout <<"Yes";
    else 
        cout <<"No";
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ull = unsigned long long;

int main() {
    string S;
    cin >> S;
    for (int i = 0; i < S.size(); i += 2) {
        cout << S[i];
    }
    cout << endl;
}


Measured memory_bytes: 576
#include<bits/stdc++.h>
#define loop(a,b) for(int a=0;a<b;a++)
#define lout(a,b) for(int i=0;i<b;i++){if(i!=0) cout<<" ";cout<<a[i];}cout<<endl;
using namespace std;
int main(){
  int a,b,c,d,p;
  cin>>a>>b>>c>>d>>p;
  int x,y;
  x=a*p;
  if(p<=c) y=b;
  else{
    y=b+d*(p-c);
  }
  if(x>y) cout<<y<<endl;
  else cout<<x<<endl;
  return 0;
}




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

int64_t gcd(int64_t A,int64_t B){
  if(B==0){return A;}
  return gcd(B,A%B);
}

int main(){
  int N;
  cin>>N;
  
  vector<int64_t> T(N);
  for(int i=0;i<N;++i){
    cin>>T.at(i);
  }
  
  int64_t ans=T.at(0);
  for(int i=1;i<N;++i){
    int64_t sub=T.at(i)/gcd(ans,T.at(i));
    ans *= sub;
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 256
def f(a):
    if a % 4 == 1:
        return 1
    elif a % 4 == 2:
        return a + 1
    elif a % 4 == 3 or a == 0:
        return 0
    else:
        return a
a, b = map(int, input().split())
print(f(b) ^ f(a - 1))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> void mmax(T &m, const T q) { if (m < q) m = q; }
template<typename T> void mmin(T &m, const T q) { if (m > q) m = q; }
template<typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;


int main()
{
    int N;
    cin >> N;
    lint a;
    int res = 0;
    REP(i, N)
    {
        cin >> a;
        res += __builtin_ctzll(a);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#define llint long long
#define mod 1000000007

using namespace std;

llint n;
llint ans[505][505];

void solve(llint l, llint r, llint d)
{
	if(l == r) return;
	if(l+1 == r){
		ans[l][r] = ans[r][l] = d;
		return;
	}
	
	llint m = (l+r)/2;
	for(int i = l; i <= m; i++){
		for(int j = m+1; j <= r; j++){
			ans[i][j] = d;
		}
	}
	solve(l, m, d+1);
	solve(m+1, r, d+1);
}

int main(void)
{
	cin >> n;
	
	solve(1, n, 1);
	
	
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			if(i >= j) continue;
			cout << ans[i][j] << " ";
		}
		cout << endl;
	}
	
	return 0;
}

Measured memory_bytes: 2432
#include <iostream>

using namespace std;

int main()
{
    int n ;
    cin >> n ;
    int  s= 0 ;
    int mask= 0;
    for(int i =0 ; i<n ;i++){
        int a ;
        cin >> a ;
        if(a>=3200)s++;
        else if(a>=2800) mask|=(1<<0);
        else if(a>=2400) mask|=(1<<1);
        else if(a>=2000) mask|=(1<<2);
        else if(a>=1600) mask|=(1<<3);
        else if(a>=1200) mask|=(1<<4);

        else if(a>=800) mask|=(1<<5);
        else if(a>=400) mask|=(1<<6);
        else mask|=(1<<7);
    }
    int m = 0;
    for(int i = 0 ; i< 8 ;i++)if(mask &(1<<i))m++;
    cout << max(1,m) << ' ' << m+s;
    return 0;
}


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

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

    int numOfCandy = 0;
    rep(i, N) {
        numOfCandy += i + 1;
    }
    cout << numOfCandy << endl;

    return 0;
}

Measured memory_bytes: 256
def gi() gets.to_i end
def gs() gets.chomp end
def gim() gets.split.map(&:to_i) end
def gsm() gets.split.map(&:chomp) end
def YesNo1(bool, yes="Yes", no="No") puts (bool ? yes : no) end
def YESNO2(bool, yes="YES", no="NO") puts (bool ? yes : no) end
def sqrt(i) i ** (1.0/2) end

require "bigdecimal"
#####

n,x = gim
ls = gim
sums = [0]
i = 0
n.times do
  sums.push(sums[-1] + ls[i])
  i += 1
end

res = 0
sums.each do |val|
  if val <= x
    res += 1
  end
end

puts res

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

int main(){
  int N,M;
  cin >> N >> M;
  if(M==0){
    cout << 0 << " " << 0 << endl;
    return 0;
  }
  map<int,bool> mb;
  map<int,int> mi;
  set<int> st;
  for(int i=0;i<M;i++){
    int p;
    string s;
    cin >> p >> s;
    if(mb.count(p)){
      if(mb.at(p)){
        continue;
      }else{
        if(s=="AC"){
          mb.at(p)=true;
          st.insert(p);
        }else{
          mi.at(p)++;
        }
      }
    }else{
      if(s=="AC"){
        mb[p]=true;
        st.insert(p);
      }else{
        mb[p]=false;
        mi[p]=1;
      }
    }
  }
  int64_t ansa=0,ansp=0;
  for(auto x:mb){
    if(x.second==true){
      ansa++;
    }
  }
  for(auto y:mi){
    if(st.count(y.first)){
        ansp+=y.second;
    }
  }
  cout << ansa << " " << ansp << endl;
}


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

#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define mem(x,val) memset((x),(val),sizeof(x))
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define PI acos(-1.0) 
#define N 111111
#define MOD 1000000007

const int INF = 1 << 30 ;
typedef long long ll ;
typedef pair < int , int > pii ;

int main() {
  ll n , fact = 1 ;
  scanf("%lld", &n) ;

  for(int i = 2 ;i<=n ;i++) {
    fact = ((fact%MOD) *(i%MOD))%MOD ;
  }
  cout << fact << endl ;

	
  return 0 ;
}



Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;

int main(){
    int N,ans=0;
    cin>>N;
    vector<int> a(N);
    rep(i,N){
        cin>>a[i];
        if (i%2==0 && (a[i]%2)==1) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

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

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[] = br.readLine().split(" ");
            StringBuffer strBuf = new StringBuffer();
            strBuf.append(strArr[0].toUpperCase().charAt(0));
            strBuf.append(strArr[1].toUpperCase().charAt(0));
            strBuf.append(strArr[2].toUpperCase().charAt(0));
            System.out.println(strBuf.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 22996
#include <iostream>

int sumDigits(int n) {
  int a = n, mod, total = 0;
  while (true) {
    if (a < 10)
      return total + a;
    mod = a % 10;
    total += mod;
    a /= 10;
  }
}

int main(int argc, char *argv[]) {
  int N, A, B;
  std::cin >> N >> A >> B;

  int total = 0;
  for (int i = 1; i <= N; ++i) {
    int sd = sumDigits(i);
    if (A <= sd && sd <= B) {
      total += i;
    }
  }
  std::cout << total << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#define ll long long 
const int K=205;
using namespace std;
int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}
int main(){
	ll k; cin>>k;
	ll ans=0;
	for(int i=1;i<=k;i++)
		for(int j=1;j<=k;j++)
			for(int z=1;z<=k;z++){
				ans+=gcd(gcd(i,j),z);	
			}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>

#define mod 1000000007
#define ten5 100005
#define PI 3.1415926
using namespace std;

int num[201];

int main()
{
    //int m,n,o=0,i,j,k;
    long long int sum=0,sum2=0,n1=0,n2=0,n3;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=1,now=1;
    long long int a,a1,a2,a3,a4;
    //float f,g,h;
    char c;
    string s,s1;
    //priority_queue<int> pq;
    //map<string,int> mp;
    //map<string,int>::iterator iter;
    cin>>n;
    for(i=n;;i++)
    {
        if(i==2)
        {
            cout<<2;
            break;
        }
        if(i%2==0) continue;
        for(j=2;j<i;j++)
        {
            if(i%j==0) break;
            if(j==i-1)
            {
                cout<<i;
                return 0;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 256
//
// Created by watemus on 01.05.2020.
//

#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>

using namespace std;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ff first
#define ss second

using ll = long long;
using ld = long double;
#define int ll

constexpr ll INFL = 1'000'000'000'000'000'228;
constexpr int INFI = 1'000'000'228;

#ifdef LOCAL
#else
#endif


void run() {
    int h1, a1, h2, a2;
    cin >> h1 >> a1 >> h2 >> a2;
    while (1) {
        h2 -= a1;
        if (h2 <= 0) {
            cout << "Yes\n";
            return;
        }
        h1 -= a2;
        if (h1 <= 0) {
            cout << "No\n";
            return;
        }
    }
}

signed main() {
#ifdef LOCAL
    std::freopen("input.txt", "r", stdin);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
    int t = 1;
//    cin >> t;
    while (t--) {
        run();
    }
    return 0;
}

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

int main()
{
	int n;
	cin>>n;
	int a[n];
	int b[n];
	int c[n-1];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int ans=0;
	for(int i=0;i<n;i++)
	{
		cin>>b[i];
		ans+=b[i];
	}
	for(int i=0;i<n-1;i++)
	{
		cin>>c[i];
	}
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(a[j]==i&&a[j+1]==i+1)
			{
				ans+=c[i-1];
			}
			if(a[j]==i)
			{
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
S=input()
T=input()
import fractions
gcd=int(N*M/fractions.gcd(N,M))
lis=[int(gcd/N),int(gcd/M)]
for i in range(int(N*M/gcd)):
    if S[int(i*lis[1])]!=T[int(i*lis[0])]:
        print(-1)
        exit()
print(gcd)

Measured memory_bytes: 5304
import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
import collections

N, M = map(int, input().split())
edge = np.array([input().split() for _ in range(M)], dtype=np.int64).T

if M == 0:
    print(1)
else:
    tmp = np.ones(M, dtype=np.int64).T
    graph = csr_matrix((tmp, (edge[:] - 1)), (N, N))

    n, labels = connected_components(graph)

    c = collections.Counter(labels)

    print(max(c.values()))

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

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)
#define sz(x) int32_t(x.size())

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// --------------------------------------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9 + 7;
const int INF = 2e18;
const ld EPS = 1e-9;
const int NN = 2e5 + 2;

int dp[NN][2];

void solve() {
	int i = 0, j = 0, k = 0, n = 0, m = 0;
	string s;
	cin >> s;
	n = sz(s);
	// p = 0, d =
      fr(i, 0, n) if(s[i] == '?') s[i] = 'D';

      cout << s << el;
}

int32_t main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int T = 1;
	// cin >> T;
	for(int tc = 1; tc <= T; tc++) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3704
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1 << 29;
const int MOD = 1000000007;

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

    int v_min = INF;
    int sum = 0;
    rep(i, n)
    {
        // 味が最小のリンゴ
        int v = (i + 1) + (l - 1);
        if (abs(v) < abs(v_min))
        {
            v_min = v;
        }
        sum += v;
    }
    // 味の絶対値が最小のリンゴを味の総和から除く
    int ans = sum - v_min;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,k,sum,a[100000],i;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++)
	   scanf("%d",&a[i]);
	n=n-1;k=k-1;
	if(n%k==0) sum=n/k;
	else sum=n/k+1;
	printf("%d",sum);
	return 0;
}

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

using  namespace std;

const int N = 2e5 + 500;

int n;
int a[N];
map<ll , ll> mp;

int main (){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> a[i];
    mp[a[0]]++;
    ll ans = 0;
    for(int i = 1; i < n; ++i){
        ll x = i - a[i];
        ans += mp[x];
        mp[a[i] + i]++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 27124
s=input()
n=len(s)+1
cnt = 1
pool = -1
ans = 0
for i in range(1,n-1):
    if s[i-1]== s[i] == '<':
        cnt += 1
    elif s[i-1] == '<' and s[i] == '>':
        ans += cnt*(cnt-1)//2
        pool = cnt
        cnt = 1
    elif s[i-1] == s[i] == '>':
        cnt += 1
    else:
        ans += cnt*(cnt-1)//2
        ans += max(cnt,pool)
        cnt = 1
ans += cnt*(cnt+1)//2
print(ans)

Measured memory_bytes: 43552
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan =new Scanner(System.in);
		int X=scan.nextInt();
		
		if(X>=30) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


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

int main(){
	int n,m,c;
	cin>>n>>m>>c;
	vector<int> b(m);
	int cnt = 0;
	for(int i=0;i<m;i++) cin>>b[i];
	for(int i=0;i<n;i++){
		int s = 0;
		for(int j=0;j<m;j++){
			int a;
			cin>>a;

			s+=a*b[j];

		}
		if(s+c>0)cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define each(i,mp) for(auto& i:mp)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll a,b,c;cin>>a>>b>>c;

  if((a<c&&c<b) || (b<c&&c<a))out("Yes");
  else out("No");



  return 0;
}


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

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int dx[3] = {0, -1, 1};
int dy[3] = {0, -1, 1};

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

	int H, W;
	string s[52];
	cin >> H >> W;
	REP(i, H){
		cin >> s[i+1];
		s[i+1] = '*'+s[i+1]+'*';
	}
	s[0] = string(W+2, '*');
	s[H+1] = string(W+2, '*');
	FOR(i, 1, H+1){
		FOR(j, 1, W+1){
			if(s[i][j] == '.'){
				int cnt = 0;
				REP(a, 3){
					REP(b, 3){
						if(s[i+dx[a]][j+dy[b]] == '#')
							cnt++;
					}
				}
				s[i][j] = cnt+'0';
			}
		}
	}
	FOR(i, 1, H+1){
		cout << s[i].substr(1, W) << endl;
	}
}


Measured memory_bytes: 256
h,w = map(int,input().split())
s = [h*w] * 4

if h == w == 2:
  print(1)
  exit()
if h % 3 == 0 or w % 3 == 0:
  print(0)
  exit()

if w > 2:
  s[0] = h
if h > 2:
  s[1] = w
if h % 2 == 0:
  s[2] = h // 2
else:
  tmp = h*w
  for i in range(w//3, w//3+2):
    s1 = i * h
    s2 = (w-i) * (h//2)
    s3 = (w-i) * (h//2 + 1)
    tmp = min(tmp, max(s1, s2, s3) - min(s1, s2, s3))
  s[2] = tmp
if w % 2 == 0:
  s[3] = w // 2
else:
  tmp = h*w
  for i in range(h//3, h//3 + 2):
    s1 = i * w
    s2 = (h-i) * (w//2)
    s3 = (h-i) * (w//2 + 1)
    tmp = min(tmp, max(s1, s2, s3) - min(s1, s2, s3))
  s[3] = tmp

print(min(s))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
long long N;
long long X;
vector<long long> l,p;

long long func(long N, long long X){
  	if(N==0){
      	if(X<=0){
         	return 0; 
        }
      	else{
         	return 1; 
        }
    }
 	else if(X <= l.at(N-1)+1){
     	return func(N-1, X-1); 
    }
  	else{
     	return p.at(N-1) + func(N-1, X-l.at(N-1)-2)+1; 
    }
  
}

int main(){
 	//int N, X;
  	cin >> N >> X;
  	//vector<int> l(N),p(N);
  	l.push_back(1);
  	p.push_back(1);
  	for(int i=1; i <= N; ++i){
      	l.push_back(3+2*l.at(i-1));
      	p.push_back(1+2*p.at(i-1));
    }
  	cout << func(N,X) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read()
{
	ll out=0,fh=1;
	char jp=getchar();
	while ((jp>'9'||jp<'0')&&jp!='-')
		jp=getchar();
	if (jp=='-')
		fh=-1,jp=getchar();
	while (jp>='0'&&jp<='9')
		out=out*10+jp-'0',jp=getchar();
	return out*fh;
}
int main()
{
	ll r=read(),d=read(),x=read();
	for(int i=1;i<=10;++i)
	{
		x=x*r-d;
		cout<<x<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

int main(){
  int N, K; cin >> N >> K;
  int a[N]; bool dp[K+10] = {0};
  rep(i, N){
    cin >> a[i];
  }
  for(int i=1; i<=K; i++){
    rep(j, N){ 
      if(i>=a[j]) dp[i] |= !(dp[i-a[j]]);
    }
  }
  if(dp[K]) cout << "First" << endl;
  else cout << "Second" << endl;
}

Measured memory_bytes: 384
#include<stdio.h>

int main(){
  int n; scanf("%d",&n);
  if(n==1){ printf("Yes\n"); return 0;}
  int a; scanf("%d",&a);
  for(int i=0; i<n; i++){
    int b; scanf("%d",&b);
    if(a>b){
      if(a==b+1){
        if(i==n-1) printf("Yes\n");
        continue;
      }
      else { printf("No\n"); break;}
    }
    else if(i==n-1) printf("Yes\n");
    a=b;
  }
  return 0;
}

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

int main(){
  int n, k, x, ans = 0;
  cin >> n >> k;
  
  for(int i = 0; i < n; i++){
    cin >> x;
    ans += min(x, k - x);
  }
  cout << ans * 2 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  long int sc,loop,n;
  long int sum;
  scanf("%ld",&sc);
  sum=0;
  for(loop=1;loop<=sc;loop++){
    n=loop;
      if(loop%3==0 || loop%5==0 || loop%15==0){
          n=0;
      }
      sum+=n;
  }
  printf("%ld",sum);
  return 0;
}

Measured memory_bytes: 1736
N,C = map(int,input().split())
D = []
for i in range(C):
    d = list(map(int,input().split()))
    D.append(d)
A = []
for i in range(N):
    a = list(map(int,input().split()))
    A.append(a)

X0,X1,X2 = [],[],[]
for i in range(N):
    for j in range(N):
        if (i+j)%3 == 0:
            X0.append(A[i][j])
        elif (i+j)%3 == 1:
            X1.append(A[i][j])
        else:
            X2.append(A[i][j])

# それぞれの集合を塗り替える場合のコストを計算
Xn = [X0,X1,X2]
cost = [[0 for _ in range(C)] for _ in range(3)]
for i in range(3):
    for c in range(1,C+1):
        Ans = 0
        for x in Xn[i]:
            if x != c:
                Ans += D[x-1][c-1]
        cost[i][c-1] = Ans

Y0 = cost[0]
Y1 = cost[1]
Y2 = cost[2]
Ans = 1000000000000000
for i in range(C):
    for j in range(C):
        for k in range(C):
            if i != j and j != k and k != i:
                Ans = min(Ans, Y0[i]+Y1[j]+Y2[k])

print(Ans)


Measured memory_bytes: 7696
import java.util.Scanner;

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

	int A = scan.nextInt();
	int B = scan.nextInt();
	int C = scan.nextInt();

	if(A*C <= B){
	    System.out.println(C);
	}else{
	    System.out.println(B/A);
	}
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

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

    int odd=0, four=0, two=0;
    rep(i,n){
        int a;
        cin >>a;

        if(a%4==0) ++four;
        else if(a%2==0) ++two;
        else ++odd;
    }
    // printf(" %d %d %d\n",odd,two,four);

    string ans = "No";
    if(two<=1){
        if(odd+two<=four+1) ans="Yes";
    }
    else{
        if(odd<=four) ans="Yes";
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  unsigned long long int H;
  std::cin >> H;
  unsigned long long int res{0};
  unsigned long long int h{1};
  while (h <= H) {
    res += h;
    h <<= 1;
  }
  printf("%llu\n", res);
}

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

int R, G, B, N, r, g, b, cnt;

int main(){
    cin >> R >> G >> B >> N;
    
    for(r = 0; r <= N/R; r ++){
        for(b = 0; b <= N/B; b++){
            int num = N - (r*R + b*B);
            if(num >= 0 && num%G == 0){    
                    cnt ++;
            }
        }
    }
cout << cnt;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    rep(i,n-2){
        if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C'){
            ans++;
        }
    }
    dunk(ans);
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
 
int n;
bool found = false;
vector<int> b;
vector<int> ans;
 
void operate(vector<int> c, int index) {
  if (c.size() == 1) {
    if (c[0] == 1) {
      found = true;
      ans[index] = 1;
    }
    return;
  }
  
  int omit;
  bool unfit = true;
  for (int i = c.size() - 1; i >= 0; i--) {
    if (i + 1 == c[i]) {
      omit = c[i];
      unfit = false;
      break;
    }
  }
  if (unfit) return;
  
  vector<int> d;
  for (int i = 0; i < c.size(); i++) {
    if (i != omit - 1) d.push_back(c[i]);
  }
  ans[index] = omit;
  operate(d, index + 1);
  if (found) return;
}
 
int main() {
  cin >> n;
  b.resize(n);
  ans.resize(n);
  for (int i = 0; i < n; i++) cin >> b[i];
  
  operate(b, 0);
  reverse(ans.begin(), ans.end());
  
  if (found) for (int i = 0; i < n; i++) cout << ans[i] << endl;
  else cout << -1 << endl;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

// Binary Indexed Tree (1 indexed)
struct BIT {
  vector<int> data;
  BIT(int n):data(n+1, 0){}
  int sum(int k) {
    int ret = 0;
    while(k > 0) {
      ret += data[k];
      k -= k & -k;
    }
    return ret;
  }
  void add(int k, int x) {
    while(k < (int)data.size()) {
      data[k] += x;
      k += k & -k;
    }
  }
};

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, K;
  cin >> N >> K;
  vint a(N);
  rep(i, N) cin >> a[i];
  vint sum(N+1);
  rep(i, N) sum[i+1] = sum[i] + a[i];
  vint press;
  rep(i, N+1) {
    sum[i] -= i*K;
    press.push_back(sum[i]);
  }
  sort(all(press));
  press.erase(unique(all(press)), press.end());
  BIT bit(N+1);
  int ans = 0;
  rep(i, N+1) {
    sum[i] = lower_bound(all(press), sum[i])-press.begin();
    ans += bit.sum(sum[i]+1);
    bit.add(sum[i]+1, 1);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6640
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
ll mod = 998244353;
map<string, ll>ma;
ll get(string s)
{
	if (ma.count(s))return ma[s];
	vector<ll>dp;
	dp.resize(s.size() + 1, 0);
	dp[0] = 1;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '0')dp[i + 1] = (dp[i + 1] + dp[i]) % mod;
		else dp[i + 1] = (dp[i + 1] + dp[i] * 2) % mod;
		string z = "";
		for (int j = i; j < s.size(); j++)
		{
			z.push_back(s[j]);
			string t = z;
			for (int k = 2;; k++)
			{
				if (i + z.size()*k>s.size())break;
				for (int l = 0; l < z.size(); l++)if (s[i + z.size()*(k - 1) + l] == '0')t[l] = '0';
				ll r = get(t);
				dp[i + z.size()*k] = (dp[i + z.size()*k] + r*dp[i]) % mod;
			}
		}
		//cout << s << " ";
		//for (int i = 0; i <= s.size(); i++)printf("%lld ", dp[i]); printf("\n");
	}
	return ma[s] = dp[s.size()];
}
int main()
{
	string s;
	cin >> s;
	printf("%lld\n", get(s));
}

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

int main()
{
    int test;
    cin>>test;
    map<string,int> mapper;
    while(test--)
    {
        string temp;
        cin>>temp;
        mapper[temp]++;        
    }
    cout<<"AC"<<" x "<<mapper["AC"]<<endl;
    cout<<"WA"<<" x "<<mapper["WA"]<<endl;
    cout<<"TLE"<<" x "<<mapper["TLE"]<<endl;
    cout<<"RE"<<" x "<<mapper["RE"]<<endl;
    return 0;
}


Measured memory_bytes: 3628
using System.Linq;
using System;//.Linq;
class A{
static void Main()
{
int []a=Console.ReadLine().Split().Select(int.Parse).ToArray();
int s=a[2]-a[1]-a[0];
int d=a[1]-a[2]-a[0];
if(d<0&&s<0){Console.WriteLine("0");}
else if(d>0&&s<0){Console.WriteLine(d);}
else if(d<0&&s>0){Console.WriteLine(s);}
else if(d<s){Console.WriteLine(s);}else{ Console.WriteLine(d);}
}
}

Measured memory_bytes: 13396
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

int main()
{
    ll n;
    cin >> n;
    map<string,ll> m;
    rep(i,n){
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        m[s]++;
    }
    ll ans=0;
    for(auto x:m){
        if(x.se>=2){
            ans+=(x.se-1)*x.se/2;
        }
    }
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 11136
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
using namespace std;
struct edge {int to, cost;};
typedef pair<int,int> P;
const int MAX_V=100000,INF=1000000000;
int N,X,Y,d[MAX_V];
vector<edge> G[MAX_V];

void dijkstra(int s){
  fill(d,d+N,INF);
  d[s]=0;
  priority_queue<P,vector<P>,greater<P> >q;
  q.push(P(0,s));
  while(!q.empty()){
    P p=q.top();q.pop();
    int v=p.second;
    if(d[v]<p.first)continue;
    for(int i=0;i<(int)G[v].size();i++){
      edge e=G[v][i];
      if(d[e.to]>d[v]+e.cost){
        d[e.to]=d[v]+e.cost;
        q.push(P(d[e.to],e.to));
      }
    }
  }
}

int main(){
  scanf("%d %d %d",&N,&X,&Y);
  for(int i=0;i<N-1;i++){
    edge e;
    e.to=i+1;e.cost=1;
    G[i].push_back(e);
    e.to=i;
    G[i+1].push_back(e);
  }
  X--;Y--;
  edge e;
  e.to=Y;
  e.cost=1;
  G[X].push_back(e);
  e.to=X;
  G[Y].push_back(e);
  map<int,int>cnt;
  for(int i=0;i<N;i++){
    dijkstra(i);
    for(int j=i+1;j<N;j++)cnt[d[j]]++;
  }
  for(int k=1;k<N;k++)cout<<cnt[k]<<endl;
  return 0;
}


Measured memory_bytes: 2816
import qualified Data.Vector as V
import Control.Monad
import Control.Applicative
import Data.List

toTuple :: [Int] -> (Int, Int)
toTuple [x,l] = (x+l, x-l)

solve :: V.Vector (Int,Int) -> Int
solve xs = fst $ foldl' (\(res, curr) (l,s) -> if curr <= s then (res+1, l) else (res, curr)) (0, negate $ 10^10) xs

main = do
  n <- readLn :: IO Int
  arms <- replicateM n (toTuple . map read . words <$> getLine)
  print $ solve (V.fromList $ sort arms)


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;

  if (a==b || a==c || b==c) {
    if(!(a==b && b==c))
      cout << "Yes" << endl;
      else
        cout << "No" << endl;
  }
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3620