akhauriyash/Code-Regression huggingface dataset:
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   string s;
   cin >> s;
   int ans = 0;
   int n = s.length();
   for(int i = 0, j = 0; i < n; i = j){
      while(j < n and s[i] == s[j]) ++j;
      if(s[i] == 'R'){
         ans = max(ans,j-i);
      }
   }
   cout << ans << '\n';
   return 0;
} 

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

int main()
{
  char n[100];
  int s, e, flag;

  scanf("%s", n);
  s = 0; e = strlen(n); flag = 1;
  while (s < (e/2)){
    if (n[s] != n[e-s-1]){
      flag = 0;
      break;
    }
    s++;
  }

  if (flag) printf("Yes\n");
  else printf("No\n");
  
  return 0;
}

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

class UnionFind
{
  public:
    UnionFind(int n);
    ~UnionFind();
    int find(int x);
    bool same(int x, int y);
    int size(int x);
    void unite(int xp, int yp);

  private:
    vector<int> par;
    vector<int> sze;
};

UnionFind::UnionFind(int n)
    : par(vector<int>(n)), sze(vector<int>(n, 1))
{
    for (int i = 0; i < n; i++)
    {
        par[i] = i;
    }
}

UnionFind::~UnionFind() {}

int UnionFind::find(int x)
{
    if (x != par[x])
        par[x] = find(par[x]);
    return par[x];
}

bool UnionFind::same(int x, int y)
{
    return find(x) == find(y);
}

int UnionFind::size(int x)
{
    return sze[find(x)];
}

void UnionFind::unite(int xp, int yp)
{
    int x = find(xp);
    int y = find(yp);
    if (x == y)
        return;
    if (size(x) > size(y))
    {
        sze[x] += size(y);
        par[y] = x;
    }
    else
    {
        sze[y] += size(x);
        par[x] = y;
    }
}

int main() {
    long long N,M;
    cin >> N >> M;
    vector<int> A(M), B(M);
    for(int i=0; i<M; ++i) {
        cin >> A[i] >> B[i];
        --A[i];
        --B[i];
    }
 
    UnionFind *U = new UnionFind(N);
    vector<long long> res(M + 1);
    res[M] = N * (N - 1) / 2;
 
    for(int i=M-1; i>=1; --i) {
        if(U->same(A[i], B[i])) res[i] = res[i + 1];
        else res[i] = res[i + 1] - U->size(A[i]) * U->size(B[i]);
        U->unite(A[i], B[i]);
    }
    delete U;
 
    for(int i=1; i<=M; ++i) cout << res[i] << endl;
}

Measured memory_bytes: 2928
#include<stdio.h>

float Product(float x1,float y1,float x2,float y2,float x,float y){
	return (x2-x1)*(y-y1)-(y2-y1)*(x-x1);
}

int main(){
	float x1,y1,x2,y2,x3,y3,x,y;
	float a,b,c;

	while(scanf("%f %f %f %f %f %f %f %f",&x1,&y1,&x2,&y2,&x3,&y3,&x,&y)!=EOF){
		a=Product(x1,y1,x2,y2,x,y);
		b=Product(x2,y2,x3,y3,x,y);
		c=Product(x3,y3,x1,y1,x,y);
		if(a<0 && b<0 && c<0) printf("YES\n");
		else if(a>0 && b>0 && c>0) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 604
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;


    vector<bool> seen;
    void dfs(const Graph &G,int v){
        int cnt = 0;
        seen[v] = true;
        for(auto nv:G[v]){
            if(seen[nv])continue;
            cnt++;
            dfs(G,nv);
        }
    }
    int main(){
      int n;cin>>n;
      int dp[n+1000];
      rep(i,n+1000)dp[i] = INF;
      dp[0] = 0;
      REP(i,1,n){
          for(int j=1;j<=i;j*=6){
              if(i>=j)dp[i] = min(dp[i],dp[i-j]+1);
          }
          for(int k=1;k<=i;k*=9){
              if(i>=k)dp[i] = min(dp[i],dp[i-k]+1);
          }
          //cout<<dp[i]<<endl;
      }
      cout<<dp[n]<<endl;
    }


Measured memory_bytes: 640
#include <iostream>

int main() {
  int A, B, C, X, Y;
  std::cin >> A >> B >> C >> X >> Y;
  int min_p = 1<<30;// A*X + B*Y + C*(X+Y)*2;
  for (int c=0;c<=std::max(X,Y);c++) {
    int a = std::max(0, X - c);
    int b = std::max(0, Y - c);
    int p = A*a + B*b + 2*C*c;
    if (p<min_p)min_p=p;
  }
  std::cout << min_p << std::endl;
  return 0;
}

Measured memory_bytes: 256
/* template.cpp(shinobu_menkoi) {{{ */
#include <bits/stdc++.h>
using namespace std;

// clang-format off
#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) rep4(i, a, n, 1)
#define rep4(i, a, n, s) for (lint i = (a); i < (lint)(n); i += (s))
#define rrep(...) GET_MACRO(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rrep1(a) rrep2(_, a)
#define rrep2(i, a) rrep3(i, a, 0)
#define rrep3(i, a, n) rrep4(i, a, n, 1)
#define rrep4(i, a, n, s) for (lint i = (a); i >= (lint)(n); i -= (s))
#define each(i, ctn) for (auto &&i : (ctn))

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(v) begin(v), end(v)
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'
#define TEMP_T template <class T>
#define TEMP_TU template <class T, class U>

TEMP_T using vec = vector<T>;
TEMP_T using heap = priority_queue<T>;
TEMP_T using minheap = priority_queue<T, vec<T>, greater<T>>;
using lint = long long;
using ulint = unsigned long long;
using ld = long double;
using vi = vec<int>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<int, int>;
using vs = vec<string>;

TEMP_TU ostream &operator<<(ostream &os, const pair<T, U> &p) { return os << p.fi << " " << p.se; }
TEMP_TU istream &operator>>(istream &is, pair<T, U> &p) { return is >> p.fi >> p.se; }

constexpr int INF{1001001001};
constexpr lint LINF{1001001001001001001ll};
constexpr int MOD{(int)1e9 + 7};
constexpr double EPS{1e-9};
const double PI{acos(-1)};
constexpr int dx[]{0, 1, 0, -1, 1, -1, 1, -1}, dy[]{1, 0, -1, 0, 1, -1, -1, 1};

inline bool inside(int y, int x, int h, int w) { return y >= 0 && x >= 0 && y < h && x < w; }
TEMP_T inline bool chmin(T &a, const T &b) { if (a > b) a = b; return a > b; }
TEMP_T inline bool chmax(T &a, const T &b) { if (a < b) a = b; return a < b; }
TEMP_T inline void print(const T &x) { cout << x << '\n'; }
TEMP_T inline void print(const vec<T> &v, string d = "\n") { rep(i, v.size()) cout << v[i] << (i == (lint)(v.size() - 1) ? "\n" : d); }
template <class T = int> inline T in() { T x; cin >> x; return x; }
template <class T = string> vec<T> split(const string &s, char d = ',') {
  vec<T> v; stringstream ss(s); for (string b; getline(ss, b, d); ) {
    stringstream conv(b); T t; conv >> t; v.eb(t); } return v;
}
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } pre__;
// clang-format on
/* }}} */

signed main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) print(c);
  else if (a == c) print(b);
  else if (b == c) print(a);
}


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

using namespace std;

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)

signed main(){

	lli a,b,c;
	cin>>a>>b>>c;
	cout<<c/a*b<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;

int main(void) {
	ll N, a, b, c, A, B;
	cin >> N;
	for (a = 1; a <= 3500; a++) {
		for (b = a; b <= 3500; b++) {
			B = 4 * a * b - N * (a + b);
			if (B <= 0)
				continue;
			A = N * a * b;
			if (A % B == 0) {
				c = A / B;
				printf("%lld %lld %lld\n", a, b, c);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long k,n,a[202020];
int main()
{
	cin>>k>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	long long mx=0;
	a[0]=a[n]-k;
	for(int i=1;i<=n;i++)
	{
		mx=max(mx,a[i]-a[i-1]);
	}
	cout<<k-mx<<endl;
	return 0;
}

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


using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(ll i=ll(m); i<ll(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;




int main() {


	int n;
	cin >> n;
	ll ans = 0;
	FOR(i, 1, n + 1) {
		if (i % 3 != 0 && i % 5 != 0) {
			ans += i;
		}
	}
	cout << ans << endl;

}

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

int main() {
    int k,s;
    cin>>k>>s;
    int result=0;
    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            int z=s-i-j;
            if(0<=z && z<=k) result++;
        }
    }
    cout<<result<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  vector<int> ans(N+1);
  rep(i,N) {
    int A; cin >> A;
    ans[A] = i+1;
  }
  for(int i=1; i<N; ++i) {
    cout << ans[i] <<" ";
  }
  cout << ans[N] << endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

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

int main() {

    int A, B, C, D;
    cin >> A >> B >> C >> D;
    cout << (min(A, B) + min(C, D)) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int k, s;
	cin >> k >> s;
	
	int ans = 0;
	for(int x = 0; x <= k; x++)
	{
		for(int y = 0; y <= k; y++)
		{
			int z = s - x - y;
			if(0 <= z && z <= k)
			{
				ans++;
			}
		}
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline

    def same_line(p1, p2, p3):
        c1 = complex(p1[0], p1[1])
        c2 = complex(p2[0], p2[1])
        c3 = complex(p3[0], p3[1])
        a = c2 - c1
        b = c3 - c1
        if a.real * b.imag == a.imag * b.real:
            return 1
        else:
            return 0

    mod = 998244353
    N = int(input())

    if N <= 2:
        print(0)
        exit()

    xy = []
    for _ in range(N):
        x, y = map(int, input().split())
        xy.append((x, y))

    ans = pow(2, N, mod) - N - 1
    ans %= mod
    used = [[0] * N for _ in range(N)]
    for i in range(N-1):
        for j in range(i+1, N):
            if used[i][j]:
                continue
            tmp = [i, j]
            cnt = 2
            for k in range(N):
                if k == i or k == j:
                    continue
                if same_line(xy[i], xy[j], xy[k]):
                    cnt += 1
                    tmp.append(k)
            ans -= pow(2, cnt, mod) - cnt - 1
            ans %= mod
            for a in range(len(tmp)):
                for b in range(a+1, len(tmp)):
                    used[tmp[a]][tmp[b]] = 1
                    used[tmp[b]][tmp[a]] = 1
    print(ans%mod)


if __name__ == '__main__':
    main()


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

using std::cin;
using std::cout;
using std::endl;
using std::vector;

constexpr int MAXGAPS = 13;

long g_cnt = 0;

void shellSort(vector<int>& line, const int n);
void insertionSort(vector<int>& line, const int n, const int gap);

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

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

    shellSort(line, n);

    cout << g_cnt << endl;
    for (auto i = 0; i < n; i++) {
        cout << line[i] << endl;
    }

    return 0;
}

void shellSort(vector<int>& line, const int n)
{
    vector<int> gap(MAXGAPS);
    int m = 1;
    gap[0] = m;
    int gap_cnt = 1;
    for (auto i = 1; (m = 3 * m + 1) <= n; i++) {
        gap[i] = m;
        gap_cnt++;
    }

    cout << gap_cnt << endl;
    for (auto i = gap_cnt - 1; i >=  0; i--) {
        cout << gap[i];
        if (i != 0) {
            cout << " ";
        }
    }
    cout << endl;

    for (auto i = gap_cnt - 1; i >=  0; i--) {
        insertionSort(line, n, gap[i]);
    }
}

void insertionSort(vector<int>& line, const int n, const int gap)
{
    for (auto i = gap; i < n; i++) {
        int key = line[i];

        auto j = i - gap;
        while (j >= 0 && line[j] > key) {
            line[j + gap] = line[j];
            g_cnt++;
            j -= gap;
        }

        line[j + gap] = key;
    }
}

Measured memory_bytes: 4892
#include<vector>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstring>
#include<string>
#include<queue>
using namespace std;


int main()
{
	int i, j, k, l, m,sum,flag;
	sum = 0;
	flag = 0;
	long long int N,M;
	cin >> N;
	M = N;
	while (N > 0) {
		sum += N % 10;
		N /= 10;
	}
	
	if (M%sum == 0) {
		cout << "Yes" << endl;
	}
	else
		cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 256
X = int(input())
if X == 2:
  print(2)
  exit()

count = 0
if X % 2 == 0:
  X += 1
while True:
  now = X + count
  k = 3
  while k*k <= now:
    if now % k == 0:
      count += 2
      break
    else:
      k += 2
      continue
  if k*k > now:
    break
  
  
print(now)

Measured memory_bytes: 8980
import javax.print.attribute.SupportedValuesAttribute;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.function.Predicate;

public class Main{
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(in, out);
        out.close();
    }

    static class TaskB {


        public static int binarySearch(int arr[], int low, int high, int key)
        {
            int mid = (low + high)/2;
            while( low <= high )
            {
                if ( arr[mid] < key )
                {
                    low = mid + 1;
                }
                else if ( arr[mid] == key )
                {
                    return mid;
                }else
                {
                    high = mid - 1;
                }
                mid = (low + high)/2;
            }
            if( low > high )
            {
                return -1;
            }
            return -1;
        }

        public static int[][] maxPos;

        public void solve(InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int d = in.nextInt();

            int count = 0;
            for(int i = 0; i < n; i++)
            {
                int p = in.nextInt();
                int q = in.nextInt();

                if(Math.sqrt(Math.pow(p,2)+Math.pow(q,2))<=d)
                {
                    count++;
                }
            }
            out.print(count);
        }
    }


    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public InputReader(InputStream inputStream) {
            this.reader = new BufferedReader(
                    new InputStreamReader(inputStream));
        }

        public String next() {
            while (!tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

    }
}

Measured memory_bytes: 55628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace AC
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Read();
            var sum = 0L;
            for (int i = 0; i < input.Length; i++)
            {
                sum += int.Parse(input.Substring(i, 1));
            }

            Console.WriteLine(sum % 9 == 0 ? "Yes" : "No");
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static string[] ReadArrayString() { return Read().Split(' '); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 32972
a, b, k = map(int, input().split())
ans = []
for i in range(a, min(a+k, b+1)):
    if i not in ans:
        ans.append(i)
for i in range(max(a, b-k+1), b+1):
    if i not in ans:
        ans.append(i)

[print(x) for x in ans]


Measured memory_bytes: 38256
# -*- coding: utf-8 -*-

N = int(input())
B = list(map(int, input().split()))

A = []

A.append(B[-1])
B.reverse()
for i in range(N - 1):

    A.append(B[i])
    if A[i] >= A[i + 1]:
        A[i] = B[i]


print(sum(A))


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

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    ll p;
    rep(i,n) {
        cin >> a[i];
        if(a[i]==1) p = i + 1;
    }

    // ll r,l;
    // r = n - p;
    // l = p - 1;

    // ll ans = 0;

    // if(r%(k-1)!=0&&l%(k-1)!=0){
    //     ans += 1;
    //     r--;
    //     l--;
    //     ans += (l + k - 2)/(k - 1) + (r + k - 2)/(k - 1);
    // }else{
    //     ans += (l + k - 2)/(k - 1) + (r + k - 2)/(k - 1);
    // }
    
    ll ans = (n - 1 + k - 2)/(k - 1);

    cout << ans;

    return 0;
}

Measured memory_bytes: 3960
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,d;
    cin >> n >> d;
    ll ans = (n + d*2) / (d * 2 + 1);
    print(ans);

    
}

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

int main(){
    int N, M, X, Y;
    cin >> N >> M >> X >> Y;

    int x[N], y[M];
    int maximum = -100;
    int minimum = 100;
    for(int i = 0; i < N; i++){
        cin >> x[i];
        maximum = max(x[i], maximum);
    }
    for(int i = 0; i < M; i++){
        cin >> y[i];
        minimum = min(y[i], minimum);
    }

  	int count = 0;
    for(int Z = X + 1; Z <= Y; Z++){
        if(maximum < Z && Z <= minimum){
            cout << "No War" << endl;
            count++;
          	break;
        }
    }
  	if(count == 0){
      cout << "War" << endl;
    }
}

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

int main(){
    while(1){
        int a,b;
        char op;
        cin >> a >> op >> b;
        if(op=='?') break;

        int ans;
        if(op=='+') ans=a+b;
        if(op=='-') ans=a-b;
        if(op=='*') ans=a*b;
        if(op=='/') ans=a/b;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3104
#include<iostream>
using namespace std;
int main(){
int n,t,c[1001],ti[1001],te=0;
cin>>n>>t;
for(int i=0;i<n;i++){
    cin>>c[i]>>ti[i];
}
for(int i=0;i<n;i++)
{
    for(int j=i;j<n;j++)
    {
        if(c[i]>c[j])
        {
            int t=c[i];
            c[i]=c[j];
            c[j]=t;
            int t2=ti[i];
            ti[i]=ti[j];
            ti[j]=t2;
        }
    }
}
for(int i=0;i<n;i++){
    if(ti[i]<=t){
       cout<<c[i]<<endl;
        te=6;
       break;
    }
}
if(te==0)
    cout<<"TLE"<<endl;
return 0;
}


Measured memory_bytes: 256
import java.util.*;

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 + b == c || b + c == a || c + a == b){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
static ll c[(ll)2e7];
int main(void){
    ll n;
    cin>>n;
    rep(1,i,n+1){
        for(ll x=i;x<=n;x+=i){
            ++c[x];
        }
    }
    ll ans=0;
    rep(1,i,n+1){
        ans+=i*c[i];
        //cout<<c[i]<<endl;
    }
    cout<<ans;
}


Measured memory_bytes: 81744
n = int(input())

ans = 0

a = 1

while a <= n:
 
    if a == 1 :
        ans =  ans + (n - 1)
    else :
        if n % a == 0 :
            ans = ans + ( (n // a) - 1)
        else :
            ans = ans + ( (n // a) )

    a += 1

print(ans)

Measured memory_bytes: 9184
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int n;
const int SIZE=1<<19;
P seg[SIZE*2];
struct segtree
{
	segtree()
	{
		for(int i=0;i<SIZE*2;i++)seg[i]=P(0,0);
	}
	void update(int k,int x)
	{
		k+=SIZE-1;
		seg[k].fi=x;
		seg[k].sec=k-(SIZE-1);
		while(k>0)
		{
			k=(k-1)/2;
			seg[k]=max(seg[k*2+1],seg[k*2+2]);
		}
	}
	int get_max_value()
	{
		return seg[0].fi;
	}
	int get_max_id()
	{
		return seg[0].sec;
	}
};
struct bug{int a,b;};
bool comp(bug p,bug q)
{
	if(p.b!=q.b)return p.b > q.b;
	else return p.a < q.a;
}
bug foo[300100];
bool check(int x)
{
	if(x>n)return false;
	ll sum=0ll;
	ll limit=foo[x-1].b;
	segtree seg;
	for(int i=0;i<x;i++)sum+=foo[i].a;
	for(int i=0;i<x;i++)seg.update(i,foo[i].a);
	if(limit*x>=sum)return true;
	for(int i=x;i<n;i++)
	{
		if(seg.get_max_value()<=foo[i].a)continue;
		limit=foo[i].b;
		int p=seg.get_max_id();
		seg.update(p,0);
		seg.update(i,foo[i].a);
		sum-=foo[p].a;
		sum+=foo[i].a;
		if(limit*x>=sum)return true;
	}
	return false;
}
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d %d",&foo[i].a,&foo[i].b);
	sort(foo,foo+n,comp);
	int l=0,r=n+1;
	while(r-l>1)
	{
		int mid=(l+r)/2;
		if(check(mid))l=mid;
		else r=mid;
	}
	printf("%d\n",l);
	return 0;
}

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

#define int long long
#define fi first
#define se second
#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 rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define yn(f) cout << (f ? "Yes" : "No") << endl;

int h,w;

signed main() {
    cin >> h >> w;
    if (h == 1 || w == 1) cout << 1 << endl;
    else cout << ((h+1)/2)*((w+1)/2) + (h/2)*(w/2) << endl;
}


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

int max(int x, int y);
int min(int x, int y);
int gcd(int x, int y);	/*最大公約数*/
int lcm(int x, int y);	/*最小公倍数*/
void swap(int* x, int* y);	/*値の交換*/
void downsort(int* a, int n);	/*降順ソート*/
void upsort(int* a, int n);	/*昇順ソート*/

typedef stack<int> IntStack;
typedef queue<int> IntQueue;

/*ここまでテンプレ*/

/*ここからmain関数*/

int main()
{
	int a, b;
	cin >> a >> b;
	if (a == b)
		cout << 2 * a;
	else
		cout << 2 * max(a, b) - 1;

	return 0;
}

/*2数の大きい方を返す*/
int max(int x, int y)
{
	int max;

	if (x < y)
		max = y;
	else
		max = x;

	return max;
}

/*2数の小さい方を返す*/
int min(int x, int y)
{
	int min;

	if (x < y)
		min = x;
	else
		min = y;

	return min;
}

/*2数の最大公約数を返す*/
int gcd(int x, int y)
{
	int m;
	int gcd = 1;

	m = min(x, y);

	for (int i = 1;i <= m; i++)
	{
		if (x%i == 0 && y%i == 0)
			gcd = i;
	}

	return gcd;
}

/*2数の最小公倍数を返す*/
int lcm(int x, int y)
{
	int m;

	for (int i = 1;i <= y;i++)
	{
		if ((x*i) % y == 0) {
			m = x * i;
			break;
		}
	}

	return m;
}

/*2数の値を交換する*/
void swap(int* px, int* py)
{
	int temp;

	temp = *px;
	*px = *py;
	*py = temp;
}

/*クイックソートによる降順並べ替え*/
void downsort(int* a, int n)
{
	//初期設定
	int l = 0, r = n - 1;

	// ピボットの決定
	int piv = *a;

	//ピボットより大を左に、ピボット以下を右に
	while (l < r)
	{
		if (*(a + l) > piv)
			l++;
		else if (*(a + r) <= piv)
			r--;
		else
			swap(a + l, a + r);
	}

	//再帰処理
	if (n == 2)
		return;
	else if (l == 1 || l == 0)
		downsort(a + 1, n - 1);
	else if (r == n - 1)
		downsort(a, n - 1);
	else
	{
		downsort(a, l);
		downsort(a + l, n - l);
	}
}

/*クイックソートによる昇順ソート*/
void upsort(int* a, int n)
{
	downsort(a, n);

	for (int i = 0;i < n / 2;i++)
		swap(a[i], a[n - 1 - i]);
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {

		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[][] array = new int[n][2];
		for(int i = 0; i < n; i++){
			array[i][0] = sc.nextInt();
			array[i][1] = sc.nextInt();
		}
		Arrays.sort(array,(a,b) -> Integer.compare(a[0],b[0]));
		long ans = 0;
		int ans2 = 0;
		int i = 0;
		while(ans2 != m){
			for(int j = 0; j < array[i][1] && ans2!=m; j++){
				ans+=array[i][0];
				ans2++;
			}
			i++;
		}
		System.out.print(ans);

	}
	//以下、自作ライブラリ

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    long long min_sum = 2E9, max_sum = -2E9, min_diff = 2E9, max_diff = -2E9;
    vector<long long> x(N), y(N);
    for (int i = 0; i < N; ++i) {
        cin >> x[i] >> y[i];
        min_sum = min(x[i] + y[i], min_sum);
        max_sum = max(x[i] + y[i], max_sum);
        min_diff = min(x[i] - y[i], min_diff);
        max_diff = max(x[i] - y[i], max_diff);
    }
    long long ans = 0;
    for (int i = 0; i < N; ++i) {
        long long sum = x[i] + y[i], diff = x[i] - y[i];
        ans = max(max_sum - sum, ans);
        ans = max(sum - min_sum, ans);
        ans = max(max_diff - diff, ans);
        ans = max(diff - min_diff, ans);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 6360
using System;

class Atcoder52
{
    public static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int r = int.Parse(input[0]);
        int g = int.Parse(input[1]);
        int b = int.Parse(input[2]);

        int mark = 10 * g + b;
        if (mark % 4 == 0)
            Console.WriteLine("YES");
        else
            Console.WriteLine("NO");
    }
}

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

int main(){
    long N;
    cin >> N;
    
    vector<long> f(N+1);
    for(long i=1;i<=N;i++){
        for(long j=1;j<=N;j++){
            if(j*i>N)break;
            f[j*i] += 1;
        }
    }
    ll ans=0;
    for(int i=1;i<=N;i++)ans += i*f[i];
    cout << ans << endl;
}

Measured memory_bytes: 81300
import sys

N = int(input())

alpha = ['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']

ans = []

for i in range(11):
    N -= 1
    if N < 0:
        break
    ans.append(alpha[N % 26])
    N //= 26

print(''.join(ans[::-1]))


Measured memory_bytes: 9164
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

int main()
{
    int n, k;
    cin >> n >> k;
    vll x(n);
    for (int i = 0; i < n; i++)
    {
        scanf("%lld", &x[i]);
    }

    ll mn = 1e16 + 3;
    for (int i = 0; i < n - k + 1; i++)
    {
        ll tmp = 0;
        ll lg = x[i + k - 1];
        ll sm = x[i];

        if (lg < 0)
        {
            tmp = sm * -1;
        }
        else if (sm > 0)
        {
            tmp = lg;
        }
        else if (lg < sm * -1)
        {
            tmp = lg * 2 - sm;
        }
        else
        {
            tmp = sm * -2 + lg;
        }

        mn = min(mn, tmp);
    }

    cout << mn << endl;
    return 0;
}


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

int main(){
  int n, q, b, m, e;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  cin >> q;
  for(int i = 0; i < q; i++){
    cin >> b >> m >> e;
    auto it = a.begin();
    rotate(it + b, it + m, it + e);
  }
  for(int i = 0; i < n; i++){
    if(i > 0) cout << " ";
    cout << a[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3160
x, y = map(int, input().split())

list_1 = [1, 3, 5, 7, 8, 10, 12]
list_2 = [4, 6, 9, 11]
list_3 = [2]

if x in list_1:
  tmp = list_1
elif x in list_2:
  tmp = list_2
else:
  tmp = list_3

if y in tmp:
  ans = 'Yes'
else:
  ans = 'No'

print(ans)

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



int main(){
    int n,x,y,d;
    cin>>n>>x>>y;
    vector<int> ans(n);
    rep(i,n){
        rep(j,i){
            d=min(i-j,abs(j+1-x)+abs(i+1-y)+1);
            ans[d]++;
        }
    }
    for(int i=1; i<n; i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
N, K, Q = map(int, input().split())
A = list(int(input()) for _ in range(Q))

score = [0] * N
for i in range(Q):
  score[A[i] - 1] += 1
 
ans = []
for j in range(N):
  if K - Q + score[j] <= 0:
    ans.append("No")
  else:
    ans.append("Yes")
 
for a in ans:
  print(a)

Measured memory_bytes: 9428
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long int ll;
void swap(ll *x,ll *y){ll temp;temp=*x;*x=*y;*y=temp;}
int compare_asc(const void *a,const void *b){return *(int*)a-*(int*)b;}
int compare_desc(const void *a,const void *b){return *(int*)b-*(int*)a;}

int main(){
    static ll n,a[200000],ans=0,max=-1;
    int i,j,k;

    scanf("%lld",&n);
    for(i=0;i<n;i++)scanf("%lld",&a[i]);

    qsort(a,n,sizeof(ll),compare_asc);
    int cnt;
    ll tmp=a[0];
    cnt=1;

    for(i=1;i<n;i++){
        if(a[i]!=tmp){
            tmp=a[i];
            if(cnt%2)ans++;
            cnt=1;
        }else{
            cnt++;
        }
    }
    if(cnt%2)ans++;
    printf("%lld\n",ans);
    return 0;
}

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

#define MAX 100000

int main(){

    int i, N;
    int max = 0;
    int A[MAX+2];

    cin >> N;
    A[0] = 0;
    for(i = 1; i <= N; i++){
        cin >> A[i];
        max += abs(A[i] - A[i - 1]);
    }
    A[N + 1] = 0;
    max += abs(A[N + 1] - A[N]);

    for(i = 1; i <= N; i++){
        cout << max - (abs(A[i - 1] - A[i]) + abs(A[i] - A[i + 1]) - abs(A[i - 1] - A[i + 1])) << endl;
    }

    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <queue>
#include <numeric>
#include <ctype.h>
#include <limits>
#include <iomanip>

#define rep(i,n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

typedef long long ll;

int main()
{
	/*int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c >= 22)puts("bust"); else {
		puts("win");
	}*/

	string s;
	cin >> s;
	int ans = 0;
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
fn main() {
    let x = read().parse::<u128>().unwrap();
    let mut counter = 100;
    let mut years = 0;
    loop {
        counter = counter + (counter / 100);
        years += 1;
        if counter >= x {
            break;
        }
    }
    println!("{}", years);
}
fn read() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}
fn read_as_vec() -> std::vec::Vec<String> {
    read().split(' ').map(|s| s.to_string()).collect()
}

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

int main(){

  string s;

  cin >> s;

  string mm;

  mm = s.substr(5,2);

  string dd;

  dd = s.substr(8,2);



  int mmm = stoi(mm);
  int ddd = stoi(dd);

  if(mmm >= 5) cout << "TBD\n";
  else cout << "Heisei\n";

}

Measured memory_bytes: 256
a=gets.to_i
line=gets.chomp.split.map(&:to_i)
maxer= line.max
answers=[]
maxer.times do |c|
  d= c+1
  ans=0
  line.map do |l|
    ans +=(l-d).abs**2
  end  
  answers<<ans
end  
puts answers.min

Measured memory_bytes: 1916
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int a,b;
   cin>>a>>b;
   if(a>b)
   {
       if(b==1)
       {
           cout<<"Bob"<<endl;
       }
       else
       cout<<"Alice"<<endl;
   }
   if(a<b)
   {
       if(a==1)
       {
           cout<<"Alice"<<endl;
       }
       else
       cout<<"Bob"<<endl;
   }
   if(a==b)
   {
       cout<<"Draw"<<endl;
   }
}


Measured memory_bytes: 256
n = int(input())
mod = 10**9+7
 
dp = [[[[0]*4 for _ in range(4)] for _ in range(4)] for _ in range(n+1)]
#長さ0の文字列は1
#0,1,2(A,G,C)に関する制約しかないため
#Sは、TTTSと考えてもよい
dp[0][3][3][3] = 1
 
#swapしてAGCが発生しない文字列:=AGC,ACG,GAC,A?GC,AG?Cを含まない文字列
#A:=0,G:=1,C:=2,T:=3
 
#文字列の文字数
for i in range(n):
    #最後から1文字目
    for j in range(4):
        #最後から2文字目
        for k in range(4):
            #条件に当てはまるものがない場合
            if dp[i][j][k] == 0:
                continue
            #最後から3文字目
            for l in range(4):
                #新たに追加する文字
                for a in range(4):
                    #ダメな5条件をカット
 
                    #AGCの場合
                    if a == 2 and j == 1 and k == 0:continue
                    #GACの場合
                    if a == 2 and j == 0 and k == 1:continue
                    #ACGの場合
                    if a == 1 and j == 2 and k == 0:continue
                    #A?GCの場合
                    if a == 2 and j == 1 and l == 0:continue
                    #AG?Cの場合
                    if a == 2 and k == 1 and l == 0:continue
 
                    #ダメの条件を抜けると、aを足した文字列が作れる
                    dp[i+1][a][j][k] += dp[i][j][k][l]
                    dp[i+1][a][j][k] %= mod
 
ans = 0
for j in range(4):
    for k in range(4):
        for l in range(4):
            #長さnの全通り回収
            ans += dp[n][j][k][l]
            ans %= mod
print(ans)

Measured memory_bytes: 3312
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <numeric>
#include <fstream>
#include <queue>
using namespace std;
#define fol(i,n) for (int i=0;i<n;i++)
#define db(a) cout << a<< endl;
typedef pair <int,int>P;
int main(){
    int N,a;
    vector<int>s;
    cin >>N;
    fol(i,N){cin >>a;s.push_back(a);}
    sort(s.begin(),s.end());
    int b = accumulate(s.begin(),s.end(),0);
    for (;b%10==0&&b!=0&&s.size()!=0;){
        if (s[0]%10) b = b -s[0];
        s.erase(s.begin());
        }
    if (b%10)cout << b<<endl;
    else cout << 0 <<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
xs = list(map(int, input().split()))

osum = 0
for x in xs:
    osum = osum ^ x

for i in range(N):
    xs[i] = xs[i] & ~osum

vs = set()
for i in range(60):
    i = 59 - i
    base = -1
    for j, x in enumerate(xs):
        if j in vs:
            continue
        if (x >> i) % 2:
            vs.add(j)
            base = j
            break
    if base < 0:
        continue
    for j, x in enumerate(xs):
        if j == base:
            continue
        if (x >> i) % 2:
            xs[j] = xs[j] ^ xs[base]

ksum = 0
for x in xs:
    ksum = ksum ^ x

print(osum+ksum*2)


Measured memory_bytes: 76960
import java.util.*;

public class Main {

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

        int n = sc.nextInt();
        int m = sc.nextInt();

        Map<Integer, List<String>> result = new HashMap<>();
        for (int i = 0; i < m; i++) {
            int p = sc.nextInt();
            String s = sc.next();

            if (!result.containsKey(p)) {
                result.put(p, new ArrayList<>());
            }
            result.get(p).add(s);
        }

        int ok = 0;
        int ng = 0;
        for (Map.Entry<Integer, List<String>> entry : result.entrySet()) {
            int acIndex = entry.getValue().indexOf("AC");
            if (acIndex == -1) {
                continue;
            }

            ok++;
            ng += acIndex;
        }

        System.out.println(ok + " " + ng);
    }

}

Measured memory_bytes: 77524
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
////////////////////////////

int main(){fastio
    ll n;cin>>n;
    ll a[10][10];memset(a,0,sizeof(a));
    rep(i,1,n){
        a[i%10][(to_string(i))[0]-'0']++;
    }
    ll ans=0;
    /*
    rep(i,0,9){
        rep(j,0,9){
            cout<<a[i][j]<<" ";
        }cout<<endl;
    }*/
    rep(i,0,9){
        rep(j,0,9){
            ans+=a[i][j]*a[j][i];
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-5;
const ll MOD=1e9+7;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    string s;cin>>s;
    int n=s.length();
    if(s=="keyence"){
        cout<<"YES"<<endl;
        return 0;
    }
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            string t="";
            if(i)t+=s.substr(0,i);
            if(j<n-1)t+=s.substr(j+1);
            if(t=="keyence"){
                cout<<"YES"<<endl;
                return 0;
            }
        }
    }
    cout<<"NO"<<endl;
}   


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

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

int main()
{
    int group[] = {1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    int x, y;
    cin >> x >> y;
    cout << (group[x-1] == group[y-1] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn solve(n: usize, s: &Vec<char>, mut r: Vec<char>) -> Option<String> {
    for i in 1..n-1 {
        let a = r[i];
        let b = r[i-1];
        if (a == 'S' && s[i] == 'o') || (a == 'W' && s[i] == 'x') {
            r.push(b);
        } else {
            r.push(if b == 'S' { 'W' } else { 'S' });
        }
    }
    let mut a = false;
    let mut b = false;
    if  (r[0] == 'S' && s[0] == 'o' && r[1] == r[n-1]) ||
        (r[0] == 'S' && s[0] == 'x' && r[1] != r[n-1]) ||
        (r[0] == 'W' && s[0] == 'o' && r[1] != r[n-1]) ||
        (r[0] == 'W' && s[0] == 'x' && r[1] == r[n-1]) { a = true; };
    if  (r[n-1] == 'S' && s[n-1] == 'o' && r[n-2] == r[0]) ||
        (r[n-1] == 'S' && s[n-1] == 'x' && r[n-2] != r[0]) ||
        (r[n-1] == 'W' && s[n-1] == 'o' && r[n-2] != r[0]) ||
        (r[n-1] == 'W' && s[n-1] == 'x' && r[n-2] == r[0]) { b = true; };
    
    if a && b {
        Some(r.into_iter().collect::<String>())
    } else {
        None
    }
}

fn main() {
    let n = get!(usize);
    let s = get!(String).chars().collect::<Vec<_>>();

    if let Some(r) = solve(n, &s, vec!['S', 'S']) { println!("{}", r); return; };
    if let Some(r) = solve(n, &s, vec!['S', 'W']) { println!("{}", r); return; };
    if let Some(r) = solve(n, &s, vec!['W', 'S']) { println!("{}", r); return; };
    if let Some(r) = solve(n, &s, vec!['W', 'W']) { println!("{}", r); return; };
    println!("-1");
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,M,c=0,x=0 ;cin>>N>>M;
  vector<pair<int,int>>V(M);
  for(int i=0;i<M;i++)
    cin>>V.at(i).first>>V.at(i).second;
  sort(V.begin(),V.end());
  while(x<M){
    int y=x,MIN=V.at(x).second;
    while(y<M&&MIN>V.at(y).first){
      MIN=min(MIN,V.at(y++).second);
    }
    x=y;c++;
  }
  cout<<c<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int n,m;
char s;
const int oo=-10;
int tot;
char a[51][51];
int d;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++) cin>>a[i][j];
	for(int i=1;i<=n;i++)
	{
	for(int j=1;j<=m;j++)
	{
		if(a[i][j]=='#') cout<<"#";
		else
		{
		if(a[i][j+1]=='#') tot++;
		if(a[i+1][j]=='#') tot++;
		if(a[i+1][j+1]=='#') tot++;
		if(a[i-1][j]=='#') tot++;
		if(a[i][j-1]=='#') tot++;
		if(a[i-1][j-1]=='#') tot++;
		if(a[i-1][j+1]=='#') tot++;
		if(a[i+1][j-1]=='#') tot++;
		cout<<tot;
		}
		tot=0;
	}
	cout<<endl;
	}
}

Measured memory_bytes: 256