akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << "\n"; }
#define YN(f) cout << (f ? "YES" : "NO") << "\n"
#define Yn(f) cout << (f ? "Yes" : "No") << "\n"
#define yn(f) cout << (f ? "yes" : "no") << "\n"
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
using ti3 = tuple<int, int, int>;
using tl3 = tuple<ll, ll, ll>;

int main() {
	int D, N; cin >> D >> N;
	if (N == 100) N++;
	rep(i, D) N *= 100;
	cout << N << endl;	
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 int main()
 {
   int a,b;
   cin >>a>> b;
   if(a%3 == 0 || b%3 == 0 || (a+b) % 3 == 0)
       cout << "Possible" << endl;
 else cout << "Impossible" << endl;
 }

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

int main(void) {
  char ch[201];
  char tmp[201];
  int n, i, s, len;
  while(1) {
    scanf("%s", &ch);
    if (ch[0] == '-') break;
    len = strlen(ch);
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      scanf("%d", &s);
      strcpy(tmp, ch);
      strcpy(ch, tmp + s);
      strcpy(ch + (len - s), tmp);
      ch[len] = '\0';
    }
    printf("%s\n", ch);
  }
  return 0;
}



Measured memory_bytes: 2036
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,ll>
const ll MOD=998244353;
const int INF=1e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    vector<string> s(3);
    rep(i,3) cin >> s[i];
    cout << 'A' << s[1][0] << 'C' << endl;

    return 0;

}


Measured memory_bytes: 3608
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int d = a+b;
    int e = b+c;
    int f = c+a;
    printf("%d\n", min(d,(min(e,f))));
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <algorithm>
 
using ii = std::pair<int, int>;
 
int main()
{
	std::string a;
	std::cin >> a;
 
	long long int counts[26] = { 0, };
 
	for (auto& c : a)
		counts[c - 'a']++;
 
	long long int l = a.size();
 
	long long int total = l * (l + 1) / 2 + 1;
 
	for (int i = 0; i < 26; i++)
	{
		total -= counts[i] * (counts[i] + 1) / 2;
	}
 
	printf("%lld\n", total);
 
	return 0;
}

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

int main() {
  string s;
  cin >> s;

  int total1 = 0;
  int total2 = 0;

  // start black
  for(int i=0;i<s.size();i++) {
    if(i % 2 == 0 && s[i] != '0') {
      total1 += 1;
      continue;
    }
    if(i % 2 != 0 && s[i] != '1') {
      total1 += 1;
      continue;
    }
  }

  // start white
  for(int i=0;i<s.size();i++) {
    if(i % 2 == 0 && s[i] != '1') {
      total2 += 1;
      continue;
    }
    if(i % 2 != 0 && s[i] != '0') {
      total2 += 1;
      continue;
    }
  }

  if(total1 > total2) {
    cout << total2 << endl;
  } else {
    cout << total1 << endl;
  }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

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

    /*vector<int> P(N);
    for(int i = 0; i < N; i++) cin >> P.at(i);*/

    int MIN = 3e5, cnt=0;

    for(int i = 0; i < N; i++){
        int P;
        cin >> P;
        if(MIN > P) {
            MIN = P;
            cnt++;
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define ll long long
#define P pair<int, int>

using namespace std;

ll N, X;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> X;

  ll sum = 0;
  if (N-X < X) {
    X = N-X;
  }
  sum += N;
  
  ll b = N-X;
  ll a = X;

  while (true) {
    sum += (b/a)*a*2;
    ll rem = b%a;
    if (rem == 0) {
      sum -= a;
      break;
    } else {
      b = a;
      a = rem;
    }
  }
  cout << sum << '\n';
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef priority_queue<int> pq;
typedef priority_queue<int, vi, greater<int>> mpq;

const ll INF = 1e18;
const int mod = 1e9+7;
const int dX[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

#define whatis(x) cerr << #x << " is " << x << endl;
#define endl "\n"
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ft front()
#define bk back()
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define FOR(i, a) for(int i = 0; i < a; i++)
#define FoR(i, a) for(int i = 1; i <= a; i++)
#define ROF(i, a) for (int i = (a)-1; i >= 0; i--)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
//-----------------------| Template By: DakDak |----------------------------
ll dp[105][100005];
int w[105], v[105];
int main(){
    int n, weight;
    cin >> n >> weight;
    for(int i = 0; i < n; i++){
        cin >> w[i] >> v[i];
    }
    int maxSum = 0;
    for(int x : v){
        maxSum += x;
    }
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= maxSum; j++){
            dp[i][j] = 1e9+5;
        }
    }
    dp[0][0] = 0; 
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= maxSum; j++){
            dp[i][j] = dp[i-1][j];
            int left = j - v[i-1];
            if(left >= 0){
                dp[i][j] = min(dp[i][j], dp[i-1][left]+w[i-1]);
            }
        }
    }
    int ans = 0;
    FoR(i, maxSum){
        if(dp[n][i] <= weight){
            ans = max(ans, i);
        }
    }
    cout << ans << endl;
    return 0;
    // Read notes to self
}

/* NOTES TO SELF:
 * Check for int vs ll, worst case just switch everything to ll
 * Check for array bounds if you SEGFAULT, especially in range based loops
 * Always initialize everything in global 
 * Edge cases such as n = 1 or 0
 * Make sure to calculate big O complexity
 * You are geniosity you got this
 */





Measured memory_bytes: 80128
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                a[j][k] = 0

cross = 0
ucross = 0
for j in range(3):
    if sum(a[j][:]) == 0 or sum([row[j] for row in a]) == 0:
        print("Yes")
        exit()
    cross += a[j][j]
    ucross += a[2-j][j]
if cross == 0 or ucross == 0:
    print("Yes")
    exit()

print("No")

Measured memory_bytes: 3064
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	goods := make([]string, n)

	count := 1
	for i:=0; i<n; i++{
		fmt.Scan(&goods[i])
	}

	sort.Strings(goods)

	for l:=1; l<n; l++{
		if goods[l-1] != goods[l] {
			count++
		}
	}

	fmt.Println(count)

}

Measured memory_bytes: 12180
use std::cmp::min;
use std::io;
use std::str;

pub struct Scanner<R> {
    reader: R,
    buffer: Vec<String>,
}

impl<R: io::BufRead> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buffer: vec![],
        }
    }

    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            self.reader.read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }

    pub fn tokens<T: str::FromStr>(&mut self) -> Vec<T> {
        assert!(self.buffer.is_empty());
        let mut input = String::new();
        self.reader.read_line(&mut input).expect("Failed read");
        input
            .split_whitespace()
            .map(|x| x.parse().ok().expect("Failed parse"))
            .collect()
    }
}

// f(n) -> f(n + 1), cost: |heights[n] - heights[n + 1]|
// f(n) -> f(n + 2), cost: |heights[n] - heights[n + 2]|

const INF: i32 = 1000000000;

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let n: usize = scan.token();
    let heights: Vec<i32> = scan.tokens();
    let mut dp = vec![INF; n];
    dp[0] = 0;
    dp[1] = (heights[0] - heights[1]).abs();
    // for i in 0..(n - 2) {
    //     dp[i + 1] = dp[i + 1].min(dp[i] + (heights[i] - heights[i + 1]).abs());
    //     dp[i + 2] = dp[i + 2].min(dp[i] + (heights[i] - heights[i + 2]).abs());
    // }
    for i in 2..n {
        dp[i] = dp[i].min(min(dp[i - 1] + (heights[i] - heights[i - 1]).abs(), dp[i - 2] + (heights[i] - heights[i - 2]).abs()));
    }

    let ans = dp[n - 1];
    writeln!(out, "{}", ans).ok();
}

fn main() {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = Scanner::new(stdin.lock());
    let mut out = io::BufWriter::new(stdout.lock());
    solve(&mut scan, &mut out);
}


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

int main() {
  int N,T,A;
  cin >> N >> T >> A;
  vector<int> a(N);
  for(int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  double s;
  double ans;
  double f;
  for (int i = 0; i < N; i++) {
    s = T-a.at(i)*0.006;
    if (i == 0) {
      ans = i+1;
      if (A-s < 0) {
        f = -A+s;
      }
      else {
        f = A-s;
      }
    }
    if (A-s >= 0 && A-s < f) {
      ans = i+1;
      f = A-s;
    }
    else if (s-A > 0 && s-A < f) {
      ans = i+1;
      f = s - A;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fin freopen("input", "r", stdin);
#define fout freopen("output", "w", stdout);
#define wt(x) cerr << #x << ": " << x << " ";
#define whatis(x) {cerr << #x << ": " << x << endl;}
#define whatis2(x, y) {wt(x); wt(y); cerr << endl;}
#define whatis3(x, y, z) {wt(x); wt(y); wt(z); cerr << endl;}
#define whatis4(x, y, z, a) {wt(x); wt(y); wt(z); wt(a); cerr << endl;}
using namespace std;

typedef long long ll; typedef unsigned long long ull; typedef long double ld;
const ll MOD = 1000000007; const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int mx = 1e5;
const ll inf = 1e10;
ll dp[102][mx + 2];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    ll n, cap;
    cin >> n >> cap;
    vector<pair<ll, ll>> item(n + 1);
    ll sm = 0;
    for (int i = 1; i < n + 1; ++i) {
        cin >> item[i].first >> item[i].second;
        // weight val
        sm += item[i].second;
    }
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j < mx + 2; ++j) {
            dp[i][j] = inf;
        }
    }
    int ans = 0;

    for (int i = 0; i <= n; ++i) { dp[i][0] = 0; }
    /* for (int i = 0; i <= sm; ++i) { dp[0][i] = 0; } */
    dp[0][0] = 0;

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= sm; ++j) {
            if (j >= item[i].second) dp[i][j] = min (dp[i-1][j], dp[i-1][j-item[i].second] + item[i].first);
            else dp[i][j] = dp[i-1][j];
        }
    }


    /* int ans = 0; */
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j <= sm; ++j) {
            /* cout << dp[i][j] << '\t'; */
            if (dp[i][j] <= cap) ans = max (ans, j);
        }
        /* cout << endl; */
    }
    cout << ans << endl;
    


    return 0;
}


Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std;
long long dp[100002][2] = {};
const int MOD = 1000000007;

int main() {
    string L;
    cin >> L;
    int n = L.size();
    dp[0][0] = 1;
    for(int i=1; i<=n; ++i) {
        if(L[i - 1] == '0') {
            dp[i][0] = dp[i - 1][0];
            dp[i][1] = (dp[i - 1][1] * 3) % MOD;
        } else {
            dp[i][0] = (dp[i - 1][0] * 2) % MOD;
            dp[i][1] = (dp[i - 1][0] + dp[i - 1][1] * 3) % MOD;
        }
    }
    cout << (dp[n][0] + dp[n][1]) % MOD << endl;
}

Measured memory_bytes: 2048
#include<iostream>
#include<cmath>
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
typedef long long int ll;
const long long int n=(int)1e6 + 77;
int main()
{
    int x,y;
    cin>>x>>y;
    if(((4*x)-y)%2==0 && ((4*x)-y)/2>=0 && (-(2*x)+y)%2==0 && (-(2*x)+y)/2>=0)
    {
          cout<<"Yes\n";
    }
    else
        cout<<"No\n";
    cerr << "\nTime ela psed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 3620
def examA():
    N, M = LI()
    ans = N*(N-1)//2 + M*(M-1)//2
    print(ans)
    return

def examB():
    def judge(A):
        #print(A)
        n = len(A)
        for i in range(n//2):
            if A[i]!=A[n-i-1]:
                return False
        return True
    S = SI()
    N = len(S)
    if not judge(S):
        print("No")
        return
    if judge(S[:(N-1)//2]) and judge(S[(N+1)//2:]):
        print("Yes")
    else:
        print("No")
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examB()

"""

"""

Measured memory_bytes: 4720
#
# File    : A.rb
# Author  : Kazune Takahashi
# Created : 11/24/2018, 8:03:06 PM
# Powered by Visual Studio Code
#

n = gets.to_i
a = gets.chomp.split(" ").map{|i| i.to_i}

sum = a.inject(:+)

ave = sum/n.to_f

dist = 2 * n
num = 0

for i in 0...a.size
  if dist > (a[i] - ave).abs
    dist = (a[i] - ave).abs
    num = i
  end
end

puts num


Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
 
int main() {
  int inp;
  int a, b, c, d ;
  int i, sum;
  scanf("%d", &inp) ;
  a = inp/1000 ;
  inp %=1000;
  b =  inp/100 ;
  inp %=100 ;
  c = inp/10 ;
  inp %=10 ;
  d = inp ;
  for(i=0; i<8; i++){
    sum=a;
    sum+=(i&1)?b:-b ;
    sum+=(i&1<<1)?c:-c ;
    sum+=(i&1<<2)?d:-d ;
    if(sum==7) break;
  }
  printf("%d%c%d%c%d%c%d=7\n", a, (i&1)?'+':'-', b ,(i&1<<1)?'+':'-', c ,(i&1<<2)?'+':'-',d) ;
  return 0 ;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn = 3e5 + 5;
const int mo = 1e9 + 7;
const int to[8][2] = {3, 1, 5, 2, 2, 2, 4, 7, 3, 3, 6, 1, 5, 5, 3, 1};
int f[maxn][8], n; char str[maxn];
int main(){
	scanf("%s", str + 1); n = strlen(str + 1);
	f[n + 1][1] = 1, f[n + 1][2] = 1;
	for (int i = n; i >= 1; i--)
		for (int j = 0; j < 8; j++){
			if (str[i] != '0') f[i][j] += f[i + 1][to[j][1]];
			if (str[i] != '1') f[i][j] += f[i + 1][to[j][0]];
			f[i][j] %= mo;
		}
	printf("%d\n", f[1][0]);
	return 0;
}

Measured memory_bytes: 9856
#include <cstdio>
#include <cstring>
#include <algorithm>

#define FILL(a, n, x) memset((a), (x), sizeof ((a)[0]) * (n))
#define COPY(a, n, b) memcpy((b), (a), sizeof ((a)[0]) * (n))
#define FILLA(a, x) memset((a), (x), sizeof (a))
#define COPYA(a, b) memcpy((b), (a), sizeof (a))

using namespace std;

typedef long long li;
typedef unsigned long long lu;
const li infl = ~0LLU >> 2;

template <class T>
inline void Min(T &x, T y) {
  if (y < x) x = y;
}
template <class T>
inline void Max(T &x, T y) {
  if (y > x) x = y;
}

const int mod = 1e9 + 7;
inline int Add(int x) { return x >= mod ? x - mod : x; }
inline void Add(int &x, int y) { x += y; if (x >= mod) x -= mod; }
inline int Sub(int x) { return x < 0 ? x + mod : x; }
inline void Sub(int &x, int y) { x -= y; if (x < 0) x += mod; }
inline int Mul(int x, int y) { return (int)((li)x * y % mod); }
inline int Mul(int x, int y, int z) { return Mul(x, Mul(y, z)); }
int Pow(int x, int y) {
  int z = 1;
  for (; y; y >>= 1) {
    if (y & 1) z = Mul(z, x);
    x = Mul(x, x);
  }
  return z;
}
int Inv(int x) {
  return Pow(x, mod - 2);
}

// ----------------------------------------

const int maxn = 1e5;

int n;
li c[maxn], x[maxn], s;

pair<li, li> Solve(int l, int r) {
  if (l == r) {
    return make_pair(abs(s - x[l]), x[l]);
  }
  if (s >= x[r]) {
    return make_pair(s - x[l], x[l]);
  }
  if (s <= x[l]) {
    return make_pair(x[r] - s, x[r]);
  }
  if (c[l] >= c[r]) {
    c[l] += c[r];
    pair<li, li> res = Solve(l, r - 1);
    res.first += x[r] - res.second;
    res.second = x[r];
    return res;
  } else {
    c[r] += c[l];
    pair<li, li> res = Solve(l + 1, r);
    res.first += res.second - x[l];
    res.second = x[l];
    return res;
  }
}

int main(void) {
  scanf("%d%lld", &n, &s);
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld", x + i, c + i);
  }
  pair<li, li> ans = Solve(0, n - 1);
  printf("%lld\n", ans.first);
  return 0;
}


Measured memory_bytes: 4352
#include<stdio.h>

void trace(int A[], int N){
  int i;
  for (i=0; i<N; i++){
    if (i > 0){
      printf(" ");
    }
    printf("%d", A[i]);
  }
  printf("\n");
}

void insertionSort(int A[], int N){
  int j, i, v;

  for (i=1; i<N; i++){
    v = A[i];
    for (j=i-1; j>=0; j--){
      if (A[j] > v){
        A[j+1] = A[j];
      } else {
        break;
      }
    }
    A[j+1] = v;
    trace(A, N);
  }
}

int main(){
  int i, N;
  int A[100];

  scanf("%d", &N);

  for (i=0; i<N; i++){
    scanf("%d", &A[i]);
  }

  trace(A, N);
  insertionSort(A, N);

  return 0;
}



Measured memory_bytes: 2724
m,n=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
dp=[[int(1e4) for i in range(m+1)] for j in range(n+1)]
i=n-1
while i>=0:
    for j in range(m+1):
        if j==c[i]:
            dp[i][j]=1
        elif j<c[i]:
            dp[i][j]=dp[i+1][j]
        else:
            dp[i][j]=min(dp[i+1][j],dp[i+1][j-c[i]]+1,dp[i][j-c[i]]+1)
    i-=1
print(dp[0][m])

Measured memory_bytes: 49268
function Main(input) {
  input = input.split("\n");
  const N = parseInt(input[0]);
  let answer = [0,0,0,0];

  for (let i = 1; i < N + 1; i++){
    switch (input[i]) {
      case "AC":
        answer[0]++
        break;
      case "WA":
        answer[1]++
        break;
      case "TLE":
        answer[2]++
        break;
      case "RE":
        answer[3]++
        break;
    }
  }

  console.log(`AC x ${answer[0]}\nWA x ${answer[1]}\nTLE x ${answer[2]}\nRE x ${answer[3]}`);

}
// デバッグ用
function debug() {
  var input = document.getElementById("input").value;
  Main(input);
}

//* この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 37252
package main

import "fmt"

func main() {
	var e, v int
	var a [100]int
	fmt.Scan(&e)
	for i := 0; i < e; i++ {
		fmt.Scan(&v)
		a[i] = v
	}

	for i := 0; i < e; i++ {
		if a[i] == a[e-1] {
			fmt.Printf("%d", a[i])
		} else {
			fmt.Printf("%d ", a[i])
		}
	}
	fmt.Print("\n")

	for i := 1; i < e; i++ {
		key := a[i]
		j := i - 1
		for j >= 0 && a[j] > key {
			a[j+1] = a[j]
			j--
		}
		a[j+1] = key
		for i := 0; i < e; i++ {
			if a[i] == a[e-1] {
				fmt.Printf("%d", a[i])
			} else {
				fmt.Printf("%d ", a[i])
			}
		}
		fmt.Print("\n")
	}
}



Measured memory_bytes: 1240
#include<stdio.h>
#include<string.h>
int main()
{
	char command[15], output[15];
	scanf("%s",&command);
	int len = strlen(command);
	int i = 0,j = 0;
	while(len--)
	{
		if(command[j] == 'B')
		{
			if(i > 0)
			{
				i--;
			}
			output[i] = ' ';
			j++;
		}
		else{
			output[i] = command[j];
			i++;
			j++;
		}
	}
	output[i] = '\0';
	printf("%s\n",output);
	return 0;
}

Measured memory_bytes: 1656
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n;
bool isprime[1100000] = {0};
int prime[1110000] = {0};
int ans = 0,cnt = 0;
signed main(){
	cin >> n;
	int rr = sqrt(n);
	for(int i = 2;i<=rr;i++){
		if(!isprime[i]){
			prime[++cnt] = i;
			int pp = 1,res = 0;
			while(n%i==0){
				res++;
				if(res==pp) res = 0,ans++,pp++;
				n/=i;
			}
		}
		for(int j = 1;j<=cnt;j++){
			if(i*prime[j]>rr) break;
			isprime[i*prime[j]] = 1;
			if(i%prime[j]==0) break;
		}
	} 
	if(n>1) ans++;
	cout << ans;
	return 0;
	
}

Measured memory_bytes: 5280
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //GCC5.4.1で配列の範囲外アクセスをエラーにする

//cmdで g++ test.cpp とするとコンパイルできる
//制限1秒なら10^6は余裕 10^7は多分間に合う 10^8はよほど単純でないと厳しい
// https://github.com/atcoder/live_library
// cppdbg: test.exeのterminalに標準入力を打てる

#define ALL(x) x.begin(),x.end()
#define get_tp(t,i) get<i>(t)
#define len(x) (ll)(x.size())
#define ub(a,x) (upper_bound(ALL(a),x)-a.begin())
#define lb(a,x) (lower_bound(ALL(a),x)-a.begin())
typedef long long ll; //long long
typedef pair<int,int> pii; //pair<int,int>
typedef pair<long long,long long> pllll; //pair<ll,ll>
typedef vector<int> vi; //vector<int>
typedef vector<vector<int>> vvi; //vector<vector<int>>
typedef vector<ll> vll; //vector<long long>
typedef vector<vector<ll>> vvll; //vector<vector<long long>>
typedef priority_queue<ll, vector<ll>, greater<ll> > gpq; //逆順priority_queue
typedef priority_queue<ll> pq;

//const int MOD=998244353;
const int MOD=1000000007; //10^9+7
const long double PI=3.1415926535897932;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b && b==c){
        cout<<1<<endl;
    }else if(a==b || b==c || c==a){
        cout<<2<<endl;
    }else{
        cout<<3<<endl;
    }
}

Measured memory_bytes: 3632
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scanner()
	c := false
	f := false
	for _, v := range s {
		if string(v) == "C" {
			c = true
		}
		if string(v) == "F" && c {
			f = true
		}
	}
	if c && f {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main() {
  int N;
  cin >> N;
  // ここにプログラムを追記
  int a, c;
  int b = N;

  while ( b != 0 ) {
    a = b % 10;
	b /= 10;
    c += a;
  }
  if ( N % c == 0 ) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
/*input
humu humu
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s, t; cin >> s >> t;
   	cout << t + s << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/algorithm/string/replace.hpp>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::algorithm;
using namespace boost::multiprecision;
 
#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;
 
const int INF = 1e9;
const int MOD = 1e9+7;

template<typename T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//C++17以上
template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

template<typename T>//文字列の置換/Boost:replace_all()
T replace_str(T str, string target, string str_to) {
    string::size_type pos = 0;
    while (pos = str.find(target, pos), pos != string::npos) {
        str.replace(pos, target.length(), str_to);
        pos += str_to.length();
    }
    return str;
}

int main() {
    string s;cin >> s;
    for(int i=0;i<3;i++){
        if(s[i] == s[i+1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <list>
#include <cstdio>

#pragma warning(disable: 4996)

using namespace std;

int main()
{
	int n, v;

	char c[12];

	list<int> l;

	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		scanf("%s", c);

		if (c[0] == 'i')
		{
			scanf("%d", &v);

			l.push_front(v);
		}
		else if (c[6] == 'F')
		{
			l.pop_front();
		}
		else if (c[6] == 'L')
		{
			l.pop_back();
		}
		else
		{
			scanf("%d", &v);

			list<int>::iterator it = l.begin();

			while (it != l.end())
			{
				if (*it == v)
				{
					l.erase(it); break;
				}

				it++;
			}
		}
	}

	list<int>::iterator it = l.begin();

	while (it != l.end())
	{
		if (it == l.begin())
		{
			printf("%d", *it);
		}
		else
		{
			printf(" %d", *it);
		}

		it++;
	}

	printf("\n");

	return 0;
}

Measured memory_bytes: 34004
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    val S = ns()
    var ans = Integer.MAX_VALUE
    REP(S.length - 2) { i =>
      ans = min(ans, abs(753 - S.drop(i).take(3).toInt))
    }
    out.println(ans)
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    REP(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    REP(n) { i =>
      REP(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }


  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Long](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}

Measured memory_bytes: 26820
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    string S; cin >> S;
    map <char,int> mp;
    rep(i,S.size()){
        mp[S[i]]++;
    }
    bool ok=false;
    if ( abs(mp['a']-mp['b'])<=1 && abs(mp['b']-mp['c'])<=1 && abs(mp['c']-mp['a'])<=1  ) ok=true;
    if (ok) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define break break
#define continue continue
#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define LLPair pair<ll, ll>
#define vint vector<int>
#define vll vector<ll>
typedef long long ll;

using namespace std;


int main(void){
	int k, x; cin >> k >> x;
	if(k*500 >= x) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long int
#define IOS ios_base::sync_with_stdio(false), cin.tie(NULL);
#define fr(i,a,b)  for(int i=a;i<=b;i++)
#define rf(j,b,a)  for(int j=b;j>=a;j--)
#define frr(k,a,b) for(int k=a;k<=b;k++)
#define mp make_pair
#define pb push_back
#define MOD 1000000007
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
signed main()
{   
	IOS
  /*  #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif*/
int n;
cin>>n;
int a[n][3];
for(int i=0;i<n;i++)
{
	for(int j =0;j<3;j++)
	{
		cin>>a[i][j];
	}	
}

int dp[n][3]={0};
dp[0][0]=a[0][0];
dp[0][1]=a[0][1];
dp[0][2]=a[0][2];
if(n==1)
{
	cout<<max(dp[0][0],max(dp[0][1],dp[0][2]))<<endl;
	return 0;
}
for(int i = 1;i<n;i++)
{
	dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a[i][0];
	dp[i][1]=max(dp[i-1][0],dp[i-1][2])+a[i][1];
	dp[i][2]=max(dp[i-1][1],dp[i-1][0])+a[i][2];

}
int ans = max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));


cout<<ans<<endl;
}






Measured memory_bytes: 4992
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCorder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }


        public void Solve(ConsoleInput cin)
        {
            var R = cin.ReadInt;
            var G = cin.ReadInt;
            var ans = 2 * G - R;
            WriteLine(ans);
        }

        public class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll n;
void func(ll a[][4]){
    ll h[n+1][4];
    h[1][1]=a[1][1];
    h[1][2]=a[1][2];
    h[1][3]=a[1][3];
    for(ll i=2;i<=n;i++){
        h[i][1]=a[i][1]+max(h[i-1][2],h[i-1][3]);
        h[i][2]=a[i][2]+max(h[i-1][3],h[i-1][1]);
        h[i][3]=a[i][3]+max(h[i-1][1],h[i-1][2]);
    }
    cout<<max(h[n][1],max(h[n][2],h[n][3]));
}
int32_t main(){
    IOS;
    cin>>n;
    ll a[n+1][4];
    for(ll i=1;i<=n;i++){
        cin>>a[i][1]>>a[i][2]>>a[i][3];
    }
    func(a);
} 

Measured memory_bytes: 9908
#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<algorithm>
#define mod 1000000007
#define ll long long
using namespace std;

int main() {
	int a, b;	
		scanf("%d%d", &a, &b);
		ll c = a, d = 1;
		while (b != 1) {
			if (b & 1)d = c*d%mod;
			c = c*c%mod;
			b /= 2;
		}
		printf("%lld\n", c*d%mod);	
}

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

int main() {
	ios_base::sync_with_stdio( false );

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

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int ans;
  for(int i=0;i<=n;i++){
    for(int j=0;j<n;j++){
      ans=4*i+7*j;
      if(ans==n){
        cout << "Yes" << endl;
        return 0;
      }
      if(ans>n) break;
    }
  }
  cout << "No" << endl;

  return 0;
}
      


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <cmath>
using namespace std;
typedef long long ll;

void solve(){
  ll n, m; cin >> n;
  if(n == 1){
    cout << 0 << endl;
    return;
  }
  m = sqrt(n);
  map<ll, ll> mp;
  for(ll i = 2; i <= m + 2; i++){
    while(n % i == 0){
      n /= i;
      mp[i]++;
    }
  }
  ll ans = 0;
  if(n != 1) ans++;
  for(auto it = mp.begin(); it != mp.end(); it++){
    ll x = it->first, y = it->second;
    //cout << x << " : " << y << endl;
    for(ll i = 1; ; i++){
      y -= i;
      if(y >= 0){
        ans++;
      }
      else break;
    }
  }
  cout << ans << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 3728
#include <cstdio>
#include <cstring>
using namespace std;

char s[4];
int v[4];
int n;

int main() 
{
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%s", s);
		if (!strcmp(s, "AC")) ++v[0];
		else if (!strcmp(s, "WA")) ++v[1];
		else if (!strcmp(s, "TLE")) ++v[2];
		else ++v[3];
	}
	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n", v[0], v[1], v[2], v[3]);
	return 0;
}


Measured memory_bytes: 1736
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
c=0
k=M
import numpy as np
A=np.array(A).cumsum()
B=np.array(B).cumsum()
for i in range(N):
  d=K-A[i]
  if d<0:
    for j in reversed(range(M)):
      if K-B[j]>=0:
        if c<j+1:
          c=j+1
        break
    break
  else:
    for j in reversed(range(k)):
      if d>=B[j]:
        if c<i+j+2:
          c=i+j+2
        k=j+1
        break
    if d<B[0]:
      if c<i+1:
        c=i+1
      k=0
for j in reversed(range(M)):
  if K-B[j]>=0:
    if c<j+1:
      c=j+1
print(c)

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

int main(void){
  int n,m; cin >> n >> m;
  int k[m],s[m][n];
  rep(i,m){
    cin >> k[i];
    rep(j,k[i]){
      cin >> s[i][j];
    }
  }
  int p[m];
  rep(i,m){
    cin >> p[i];
  }
  int ans = 0;
  for(int bits = 0; bits < (1 << n); bits++){
    bool ok = true;
    for(int i = 0; i < m; i++){
      int count = 0;
      for(int j = 0; j < k[i]; j++){
        if((bits >> (s[i][j] -1)) & 1){
          count++;
        }
      }
      if(count % 2 != p[i]) ok = false;
    }
    if(ok) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader(); 
        long X = r.i();
        long t = (long)(-1+Math.sqrt(8*X+1))/2;
        while(t*(t+1) < X*2)
            t++;
        println(t);
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long.parseLong(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 21332
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iso646.h>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

#ifndef M_PI
#define M_PI 3.14159265358979
#endif
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
    ll S, W;
    cin >> S >> W;
    if(S > W) {
        cout << "safe" << endl;
    } else {
        cout << "unsafe" << endl;
    }

    return 0;
}

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

#define MAX 300000

int main() {
	int N;
	string S;
	int cntE[MAX], cntW[MAX];
	cin >> N >> S;
	cntW[0] = (S[0] == 'W' ? 1 : 0);
	cntE[N - 1] = (S[N - 1] == 'E' ? 1 : 0);
	for (int i = 1; i < N; i++) {
		cntW[i] = cntW[i - 1] + (S[i] == 'W' ? 1 : 0);
	}
	for (int i = N - 2; i >= 0; i--) {
		cntE[i] = cntE[i + 1] + (S[i] == 'E' ? 1 : 0);
	}
	int ans = 2000000000;
	ans = min(ans, cntE[1]);
	ans = min(ans, cntW[N - 1]);
	for (int i = 1; i < N - 1; i++) {
		ans = min(ans, cntW[i - 1] + cntE[i + 1]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3076
#include <stdio.h>
 
int main() {
 
  int m, f, r;
  int x;
  while(1) {
 
    scanf("%d %d %d", &m , &f , &r);
    x = m + f;
    if(m == -1 && f ==-1 && r == -1) {
      break;
    }
 
    if(m == -1 || f == -1) {
      printf("F\n");
    } else if(x >= 80) {
      printf("A\n");
    } else if (x >= 65) {
      printf("B\n");
    } else if(x >= 50) {
      printf("C\n");
    } else if ( x >=30) {
      if(r >= 50) {
    printf("C\n");
      } else {
    printf("D\n");
      }
    } else if (x < 30) {
      printf("F\n");
    }
  }
  return 0;
}


Measured memory_bytes: 2140
MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def debug(k,v) puts "#{k}:#{v}" end
########### ( ˘ω˘ )ｽﾔｧ… ###########
N,M=gsmi

require 'prime'
def divisors(num)
  return [1] if num == 1

  pows = []
  # 0乗、1乗・・・した値を入れる
  num.prime_division.each do |b, r|
    pow = []
    0.upto(r).each do |n|
      pow << b ** n
    end

    pows << pow
  end

  first_array = pows.shift
  return first_array if pows.size == 0

  result = first_array.product(*pows)
  result.map do |item|
    item.inject { |sum, i| sum * i }
  end.sort
end

def satisfy?(x)
  M%x==0 && M/x>=N
end

divs=desc divisors(M)
divs.each do |x|
  putsend x if satisfy?(x)
end

Measured memory_bytes: 2300
#include <stdio.h>
int main() {
	int n;
	long long ans = 0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		if (i % 3 != 0 && i % 5 != 0)
			ans += i;
	}
		printf("%lld",ans);
}

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

using namespace std;

void getResult(long long a, long long b, long long** result, long long** sum, long long* vals) {

	if (result[a][b] != -1) {
		return;
	}

	if (a == b) {
		result[a][b] = 0;
		return;
	}

	result[a][b] = 2e18;
	for (long long i = 0; i < b-a; i++) {
		getResult(a, a + i, result, sum, vals);
		getResult(a + i + 1, b, result, sum, vals);
		result[a][b] = min(result[a][b], result[a][a+i] + result[a+i+1][b] + sum[a][a+i] + sum[a+i+1][b]);
	}

	return;

}

int main() {

	long long n;
	cin >> n;

	long long vals[n];
	for (long long i = 0; i < n; i++) {
		cin >> vals[i];
	}

	// The sum of values between indices a and b
	long long** sum = new long long*[n];
	for (long long i = 0; i < n; i++) {
		sum[i] = new long long[n];
	}

	for (long long i = 0; i < n; i++) {
		for (long long j = 0; j < n; j++) {
			sum[i][j] = 0;
		}
	}
	
	for (long long i = 0; i < n; i++) {
		long long currentSum = 0;
		for (long long j = i; j < n; j++) {
			currentSum += vals[j];
			sum[i][j] = currentSum;
		}
	}

	// Stores the result for the subsection from a to b
	long long** result = new long long*[n];
	for (long long i = 0; i < n; i++) {
		result[i] = new long long[n];
	}
	for (long long i = 0; i < n; i++) {
		for (long long j = 0; j < n; j++) {
			result[i][j] = -1;
		}
	}
	getResult(0, n-1, result, sum, vals);
	cout << result[0][n-1] << endl;

	// for (long long i = 0; i < n; i++) {
	// 	for (long long j = 0; j < n; j++) {
	// 		cout << result[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }

}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define op_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fo(i,a,b) for(int i=a;i<b;i++)
using namespace std;
typedef vector<int> vi;

int solve(vi heights){
  int res[heights.size()];
  res[0] = 0;
  res[1] = abs(heights[1] - heights[0]);
  fo(i,2,heights.size()){
    res[i] = min(res[i-2] + abs(heights[i] - heights[i-2]), res[i-1] + abs(heights[i] - heights[i-1]));
  }
  return res[heights.size()-1];
}


int main(){
  op_io;
  int n;
  cin>>n;
  vi heights(n,0);
  fo(i,0,n){
    cin>>heights[i];
  }
  cout<<solve(heights)<<endl;
  return 0;
}


Measured memory_bytes: 1408
from collections import defaultdict

def diverta192_b():
    N = int(input())
    P = [tuple(map(int, input().split())) for _ in range(N)]
    if len(P) == 1:
        print(1)  # 座標が1つだけ与えられる場合は即終了
        return

    dcnt = defaultdict(int)  # import忘れずに
    for i in range(N):
        xi, yi = P[i]
        for j in range(i):
            xj, yj = P[j]
            dcnt[(xi-xj, yi-yj)] += 1
            dcnt[(xj-xi, yj-yi)] += 1  # 逆向きもカウントする(都合よいほうを使う)
    most = sorted(dcnt.values(), reverse=True)[0]  # 最も多いカウントを取り出す
    ans = N - most
    print(ans)

diverta192_b()

Measured memory_bytes: 3828