akhauriyash/Code-Regression huggingface dataset:
package main

import "fmt"

func main() {
	var N, t, h, cnt, r int
	fmt.Scan(&N)
	fmt.Scan(&t)
	for i := 1; i < N; i++ {
		fmt.Scan(&h)
		if t >= h {
			cnt++
		} else {
			r = Max(r, cnt)
			cnt = 0
		}
		t = h
	}
	r = Max(r, cnt)
	fmt.Println(r)

}
func Max(a, b int) int {
	if b > a {
		return b
	}
	return a
}


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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = (1 << 30);
constexpr ll L_INF = (1ll << 62);

//==================================

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

    int A, B;
    cin >> A >> B;

    cout << (B - 1 + A - 2) / (A - 1) << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int m1 = sc.nextInt();
		int d1 = sc.nextInt();
		int m2 = sc.nextInt();
		int d2 = sc.nextInt();
		if (m1 == m2) {
			System.out.println(0);
		} else {
			System.out.println(1);
		}
	}
}


Measured memory_bytes: 21844
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  int v[N];
  int m1 = -1000000000;
  int m2 = m1;
  FOR(i,0,N) {
    cin >> v[i];
    if (v[i] >= m1) {
      m2 = m1;
      m1 = v[i];
    } else if (v[i] >= m2) {
      m2 = v[i];
    }
  }
  FOR(i,0,N) {
    if (v[i] == m1) {
      cout << m2 << endl;
    } else {
      cout << m1 << endl;
    }
  }
}

Measured memory_bytes: 2432
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const double EPS = 1e-9;
const double INF = 1e9;




int main(){
	map<string,long>mp;
	mp.insert(MP("A",0));
	mp.insert(MP("B",0));
	mp.insert(MP("AB",0));
	mp.insert(MP("O",0));
	long num;string str;char c;
	while(cin>>num>>c>>str){
		mp[str]+=1;
	}
	cout<<mp["A"]<<endl;
	cout<<mp["B"]<<endl;
	cout<<mp["AB"]<<endl;
	cout<<mp["O"]<<endl;
	return 0;
}
/*

*/

Measured memory_bytes: 1216
import sys
from collections import deque
 
 
N, M = [int(i) for i in input().split()]
A = []
B = []
for i in range(M):
    l = [int(i) for i in input().split()]
    A.append(l[0])
    B.append(l[1])
 
# BFS
G = [[] for _ in range(N)]
for i in range(M):
    G[A[i] - 1].append(B[i] - 1)
    G[B[i] - 1].append(A[i] - 1)
G = [list(set(x)) for x in G]
 
q = deque([])
dist = [-1] * N
ans = [-1] * N
dist[0] = 0
ans[0] = 0
q.appendleft(0)
while(len(q) > 0):
    v = q.pop()
    for nv in G[v]:
        if not dist[nv] == -1:
            continue
        dist[nv] = dist[v] + 1
        ans[nv] = v
        q.appendleft(nv)
 
for i in ans[1:]:
    if i == -1:
        print('No')
        sys.exit()
 
for i, v in enumerate(ans):
    if i == 0:
        print('Yes')
        continue
    print(v + 1)

Measured memory_bytes: 60436
s=input()
import itertools
l=[*itertools.accumulate(s)]
o=[]
for b in range(1<<len(s)-1):
  q=[]
  p=0
  for i in range(len(s)-1):
    if b&(1<<i):
      q+=int(l[i][p::]),
      p=i+1
  c=l[-1][p::]
  c=c if c else 0
  q+=int(c),
  o+=sum(q),
print(sum(o))

Measured memory_bytes: 9092
import heapq
# import collection
# import bisect
# import numpy

N, M = list(map(int, input().split()))
# A = list(map(int, input().split()))

# N = 10**5
# A = [10 for i in range(10**5)]
# M = 10**5

# A = sorted(A)
A = []
for i in input().split():
    heapq.heappush(A, -int(i))

while M > 0:
    heapq.heappush(A, -((-heapq.heappop(A))//2))
    M -= 1

print(-sum(A))


Measured memory_bytes: 64112
use std::io;
use std::cmp;
use std::collections::HashMap;


/// https://beta.atcoder.jp/contests/abc075/tasks/abc075_c
fn main() {
    let (n, m) = {
        let i = read::<usize>();
        (i[0], i[1])
    };

    let mut g = Vec::new();
    for _ in 0..m {
        let i = read::<usize>();
        g.push((i[0] - 1, i[1] - 1));
    }

    let mut cnt = 0;

    for j in 0..m {
        let mut  g_clone = g.clone();
        g_clone.remove(j);

        let mut uf = UnionFind::new(n);
        let mut edge = vec![0; n];

        for (u, v) in g_clone {
            uf.unite(u, v);
            edge[u] += 1;
            edge[v] += 1;
        }

        let mut hm = HashMap::new();

        for k in 0..n {
            hm.entry(uf.find(k))
                .or_insert(Vec::new()).push(k);
        }

        // println!("{:?}", hm);
        // println!("{:?}", edge);
        if hm.len() > 1 { cnt += 1; }
    }

    println!("{}", cnt);
}


struct UnionFind {
    par: Vec<usize>,
    rank: Vec<usize>,
}


impl UnionFind {
    fn new(n: usize) -> UnionFind {
        UnionFind {
            par: (0..n).collect(),
            rank: vec![0; n],
        }
    }

    fn find(&mut self, x: usize) -> usize {
        if self.par[x] == x { x }
        else {
            let p = self.par[x];
            let pp = self.find(p);
            self.par[x] == pp;
            pp
        }
    }

    fn unite(&mut self, x: usize, y: usize) {
        let x = self.find(x);
        let y = self.find(y);

        if x == y { return; }

        match self.rank[x].cmp(&self.rank[y]) {
            cmp::Ordering::Equal => {
                self.par[y] = x;
                self.rank[x] += 1;
            },
            cmp::Ordering::Less => {
                self.par[x] = y;
            },
            cmp::Ordering::Greater => {
                self.par[y] = x;
            }
        }
    }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep_r(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
#define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i)
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define INF 2e9
#define LLINF 11e16
 
using namespace std;
 
typedef long long ll;

int main(){
	int n;
	cin >> n;
	vector<string> str(n);
	rep(i, n){
		cin >> str[i];
		sort(all(str[i]));
	}
	
	sort(all(str));
	
	ll ans = 0;
	int tmp = 1;
	
	rep(i, n-1){
		if(str[i] == str[i + 1]){
			ans += tmp;
			tmp++;
		}
		else{
			tmp = 1;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}



Measured memory_bytes: 7296
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];

    sort(a, a+3);

    cout << a[2] - a[0];
    
    cout << endl;
    return 0;
}

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

long long n,i,a[300000],b[300000];

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

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i, n) for (int i = 0, i##_cond = (n); i < i##_cond; ++i)
#define FOR(i, a, b) for (int i = (a), i##_cond = (b); i < i##_cond; ++i)
#define ROF(i, a, b)                                                           \
  for (int i = (a)-1, i##_cond = (b); i >= i##_cond; --i) // ROF(i,n,0)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend() // sortで降順
#define SUM(a) accumulate(all(a), int(0))
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
constexpr ll inf = 1ll << 61;
constexpr ll mod = 1e9 + 7;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> T add(const T &a, const T &b) { return (a + b) % mod; }

signed main() {
  int a, b;
  cin >> a >> b;
  cout << a * b << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <map>
#include <functional>
#include <queue>
using namespace std;
struct num
{
	int h,w;
};

int main() {
	int H, W,wh = 0,ans;
	char st;
	int s[60][60];
	queue<num> q;
	num now;
	cin >> H >> W;
	for (int i = 0; i < H + 2; i++) {
		for (int j = 0; j < W + 2; j++) {
			if (i == 0 || j == 0 || i == H + 1 || j == W + 1) {
				s[i][j] = -1;
			}
			else {
				cin >> st;
				if (st == '#') {
					s[i][j] = -1;
				}
				else {
					s[i][j] = 0;
					wh++;
				}
			}
		}
	}
	ans = wh + 1;
	q.push({ 1,1 });
	s[1][1] = 1;
	while (!q.empty()) {
		now = q.front();
		if (now.h == H && now.w == W) {
			ans = s[now.h][now.w];
			break;
		}
		q.pop();
		if (s[now.h - 1][now.w] == 0) {
			s[now.h - 1][now.w] = s[now.h][now.w] + 1;
			q.push({ now.h - 1,now.w });
		}
		if (s[now.h + 1][now.w] == 0) {
			s[now.h + 1][now.w] = s[now.h][now.w] + 1;
			q.push({ now.h + 1,now.w });
		}
		if (s[now.h][now.w - 1] == 0) {
			s[now.h][now.w - 1] = s[now.h][now.w] + 1;
			q.push({ now.h,now.w - 1 });
		}
		if (s[now.h][now.w + 1] == 0) {
			s[now.h][now.w + 1] = s[now.h][now.w] + 1;
			q.push({ now.h,now.w + 1 });
		}
	}
	cout << wh - ans << endl;
	return 0;
}

Measured memory_bytes: 256
#[allow(dead_code)]
fn main() {
    let (n, k) = i::u2();
    let mut h = i::uv(n);
    h.sort();
    let mut ans = h[n - 1] - h[0];
    for i in 0..n - k + 1 {
        ans = min(ans, h[i + k - 1] - h[i]);
    }
    println!("{}", ans);
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn u2() -> (usize, usize) {
        (read(), read())
    }

    pub fn u3() -> (usize, usize, usize) {
        (read(), read(), read())
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv3(n: usize) -> Vec<(usize, usize, usize)> {
        (0..n).map(|_| uv(3)).map(|a| (a[0], a[1], a[2])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


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

#define ll long long


int main()
{
    ll h,i,a;

    cin>>h>>a;


     int x=h/a;


     if (h<a)cout<<1<<endl;
     else if(h%a==0) cout<<x<<endl;
     else cout<<x+1<<endl;



    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main (){
	int N, T, c[120], t[105];
	cin >> N >> T;
	
	for(int i=0; i<N; i++){
		cin >> c[i] >> t[i];
	}
	int ans = 999999999;
	
	for(int i=0; i<N;i++){
		if(t[i]<=T){
			if(c[i] < ans){
				ans = c[i];
			}
		}
	}
	if(ans <999999999){
		cout << ans << endl;
	}
	else{
		cout << "TLE" << endl;
	}
}


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

#define ll long long
const int inf = 1e9+7;
const ll INF = 1e18+7;

using namespace std;

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

  //dp[i][j] max happiness on day i with last activity j
  int n;
  cin>>n;
  vector<vector<int>> a(n,vector<int>(3));
  for(int i = 0; i < n; ++i){
    cin>>a[i][0]>>a[i][1]>>a[i][2];
  }
  vector<vector<int>> dp(n,vector<int>(3));
  dp[0] = a[0];
  for(int i = 1; i < n; ++i){
    for(int j = 0; j < 3; ++j){
      dp[i][j] = max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+a[i][j];
    }
  }
  int m = 0;
  for(int x : dp[n-1])
    m = max(x,m);
  cout<<m<<"\n";
}


Measured memory_bytes: 11264
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Console;

namespace AtCoder_1
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = Cin();
            var t = Cin();
            int c = 0;
            for(int i = 0;i < 3; i++)
            {
                if(N[i] == t[i])
                {
                    c++;
                }
            }
            Cout(c);
            Cin();
        }

        static int GCD(int a, int b)
        {
            if (a < b) { swap(ref a, ref b); }
            if (a % b == 0) { return b; }
            else { return GCD(b, a % b); }
        }

        static void swap<T>(ref T a, ref T b)
        {
            T t = a;
            a = b;
            b = t;
        }

        static readonly int MOD10E9 = (1000000000 + 7);
        static bool isInt(double d) { return (int)d == d; }
        static string Cin() { return ReadLine(); }
        static string[] CinAr() { return ReadLine().Split(' '); }
        static int CinT() { return S2i(Cin()); }
        static int[] CinTAr() { return CinAr().Select((x, i) => { return S2i(x); }).ToArray(); }
        static long CinL() { return S2L(Cin()); }
        static long[] CinLAr() { return CinAr().Select((x, i) => { return S2L(x); }).ToArray(); }
        static double CinD() { return S2D(Cin()); }
        static double[] CinDAr() { return CinAr().Select((x, i) => { return S2D(x); }).ToArray(); }
        static int S2i(string s) { return int.Parse(s); }
        static long S2L(string s) { return long.Parse(s); }
        static double S2D(string s) { return double.Parse(s); }
        static void Cout(object s) { WriteLine(s); }
        static int[] yakusuu(int n)
        {
            if (n == 1) { return new int[] { 1 }; }
            HashSet<int> res = new HashSet<int>();
            for (int i = 1; i < Math.Ceiling(n / 2.0); i++)
            {
                if (n % i == 0)
                {
                    res.Add(i);
                    res.Add(n / i);
                }
            }
            return res.ToArray();
        }
        static void CoutAr<Type>(IEnumerable<Type> types)
        {
            string text = string.Join(" ", types);
            WriteLine(text);
        }

        public static long nCr(int n, int r)
        {
            // naive: return Factorial(n) / (Factorial(r) * Factorial(n - r));
            return nPr(n, r) / Factorial(r);
        }

        public static long nPr(int n, int r)
        {
            // naive: return Factorial(n) / Factorial(n - r);
            return FactorialDivision(n, n - r);
        }

        private static long FactorialDivision(int topFactorial, int divisorFactorial)
        {
            long result = 1;
            for (int i = topFactorial; i > divisorFactorial; i--)
                result *= i;
            return result;
        }

        private static long Factorial(int i)
        {
            if (i <= 1)
                return 1;
            return i * Factorial(i - 1);
        }
    }
}


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

int main() {
  int n,m;
  cin >> n >> m;
  int a[m];
  for(int i = 0;i < m;i++){
    cin >> a[i];
  }
  sort(a,a+m);
  int c = m-1;
  int b[c];
  for(int i= 1;i < m;i++){
    b[i-1] = a[i] - a[i-1];
  }
  sort(b,b+c);
  int ans;
  for(int i = 0;i < m-n;i++){
    ans += b[i];
  }
  if(m == 1){
    cout << "0" << endl;
  }else{
  cout << ans-4196950 << endl;
}
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define pb push_back()
#define M 1000000007
#define rep(i , l , r) for(ll i=l; i < r; i++)
#define repr(i , r , l) for(ll i=r; i >= l; i--)

using namespace std;

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

    /*#ifndef ONLINE_JUDGE
        freopen("input.in", "r", stdin);
        freopen("output.out", "w", stdout);
    #endif*/

    ll n , k;
    cin >> n >> k;
    ll h[n+1] = {0} , c[n+1] = {0};
    rep(i , 1 , n+1) cin >> h[i];
    c[1] = 0; c[2] = abs(h[2]-h[1]);
    rep(i , 3 , n+1) {
        c[i] = INT_MAX;
        rep(j , 1 , min(i , k+1)) {
            c[i] = min(c[i] , c[i-j] + abs(h[i] - h[i-j]));
        }
    }
    cout << c[n] << "\n";
    return 0;

}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
K, S = map(int, input().split())
#A = str(input())

cnt = 0
for x in range(K+1) :
  for y in range(K+1) :
    if K >= S-x-y >= 0 :
      cnt += 1
print (cnt)


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

int f(int x){
  if (x%2==0){
    x = x/2;
  }
  else{
    x=3*x+1;
  }
  return(x);
}

int main() {
  int s;cin>>s;
  int a=1;
  while (s>0){
    if (s==1 ||s==2||s==4){
      cout << a + 3 << endl;
      break;
    }
    s=f(s);
    a++;
  }
}

Measured memory_bytes: 256
# coding:utf-8
# BBBBBBBBBBB

import math
import re

def main(params):
    n = int(params[0])
    sp = params[1:]
    cnt = 0
    ipt = {}
    for i in sp:
        cnt += 1
        s,p = i.split()
        p = int(p)
        if s in ipt:
            ipt[s].append([p,cnt])
        else:
            ipt[s] = [[p,cnt]]
    keys = ipt.keys()
    keys.sort()
    for k in keys:
        if len(ipt[k]) == 1:
            print ipt[k][0][1]
        else:
            ranks = ipt[k]
            ranks.sort()
            ranks.reverse()
            for i in ranks:
                print i[1]

if __name__ == "__main__":
    n = int(raw_input())
    cnt = n # TODO: edit here
    params = [n]
    for i in range(cnt):
        param = raw_input()
        params.append(param)
    main(params)



Measured memory_bytes: 7296
n,m = map(int,input().split())
p = [list(map(str,input().split())) for _ in range(m)]
ac =[0]*(n+1)
wa =[0]*(n+1)
for i in range(m):
    question =int(p[i][0])
    if p[i][1] == "AC" and ac[question] == 0:
        ac[question] = 1
    elif p[i][1] == "WA" and ac[question] == 0:
        wa[question] += 1
for j in range(n+1):
    if ac[j] == 0:
        wa[j] = 0
       # print(wa)
print(sum(ac),sum(wa))

Measured memory_bytes: 35160
#include <stdio.h>
#include <math.h>

int main (void){
    double r;
    double area,cir;
    scanf("%lf",&r);
    area = r*r*1.0*M_PI;
    cir = 2.0*r*M_PI;
    printf("%.6f %.6f\n",area,cir);
    return 0;
}


Measured memory_bytes: 2076
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#define swap(a,b) ((a != b) && (a += b,b = a - b,a -= b))
using namespace std;

int gcd(int a,int b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(b,a%b);
}

int main()
{
    long long n,a,b;
    cin >> a >> b;
    int count=1;
    n=a;
    while(true){
        n*=2;
        if(n>b)break;
        count++;

    }



    cout << count << endl;
    return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>

using namespace std;

int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    cout << c << " " << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
a = int(input())
b = list(map(int, input().split()))
p = int(sum(b) / len(b))
ans1 = ans2 = 0
for x in b:
    ans1 += (x - p) ** 2
    ans2 += (x - 1 - p) ** 2
if ans1 > ans2:
    print(ans2)
else:
    print(ans1)


Measured memory_bytes: 38256
def modulo_pairing(N: int, M: int, A: list)->int:
    A.sort()

    def check(n: int)->bool:
        '''2*n の位置を区切りとして、右側が全て赤のペアになることを確認する。
        '''
        for i in range(2*n, N+n):
            if A[i] + A[2*N+2*n-i-1] < M:
                return False
        return True

    l, r = -1, N+1
    while r - l > 1:
        m = (l + r) // 2
        if check(m):
            r = m
        else:
            l = m

    blue = [A[i]+A[2*r-i-1] for i in range(r)]
    red = [A[i]+A[2*N+2*r-i-1]-M for i in range(2*r, N+r)]

    return max(blue + red)


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = [int(s) for s in input().split()]

    ans = modulo_pairing(N, M, A)
    print(ans)


Measured memory_bytes: 27060
using System;
class p
{
  static void Main()
  {
    int N = int.Parse(Console.ReadLine());
    int K = int.Parse(Console.ReadLine());
    int num = 1;
    for (int i = 0; i < N; i++) {
      num = ((num * 2 - num) < K) ? num * 2 : num + K;
    }
    Console.WriteLine(num);
  }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;
using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;
const int INF=1<<30,MOD=1000000007;const ll LINF=1ll<<60;
#define _ol3(_1,_2,_3,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,v.size())
#define all(v) (v).begin(),(v).end()
#define bit(n) (1ll<<(n))
#define clamp(n,mi,ma) max(min(n,ma),mi)
#define uniq(v) sort(all(v));v.erase(unique(all(v)),v.end())
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b) cout<<((n)?a:b)<<endl
#define YES(n) cho(n,"YES","NO")
#define Yes(n) cho(n,"Yes","No")
#define Poss(n) cho(n,"Possible","Impossible")
template<class T>bool chmax(T&a,const T&b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}
template<class T>istream&operator>(istream&i,T&t){return i>>t;}
#ifndef LOCAL
struct ostdmy{
template<class T>ostdmy&operator<<(const T&t){return*this;}
template<class T>ostdmy&operator<(const T&t){return*this;}};ostdmy cer_;
#define cerr cer_
#endif
int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    string s;
    cin>>s;
    int a=0;
    if((s[0]=='0' && s[1]!='0') || (s[0]=='1' && s[1]<'3'))a+=2;
    if((s[2]=='0' && s[3]!='0') || (s[2]=='1' && s[3]<'3'))a+=1;
    cerr<a;
    switch(a){
        case 0:
            cout<<"NA";
            break;
        case 1:
            cout<<"YYMM";
            break;
        case 2:
            cout<<"MMYY";
            break;
        case 3:
            cout<<"AMBIGUOUS";
            break;
    }
    cout<endl;
    return 0;
}


Measured memory_bytes: 256
loop {
    w, h = gets.split.map(&:to_i)
    break if w == 0
    x = y = 1
    dx, dy = 0, 1
    loop {
        command, k = gets.split
        k = k.to_i if k 
        case command[0]
        when 'S'
            break
        when 'F'
            x += k * dx
            x = 1 if x < 1
            x = w if x > w
            y += k * dy
            y = 1 if y < 1
            y = h if y > h
        when 'B'
            x -= k * dx
            x = 1 if x < 1
            x = w if x > w
            y -= k * dy
            y = 1 if y < 1
            y = h if y > h
        when 'R'
            dx, dy = dy, -dx
        when 'L'
            dx, dy = -dy, dx
        end
    }
    puts "#{x} #{y}" 
}

Measured memory_bytes: 6108
#include<stdio.h>
#define N 1000
 int main(){
  int n, i, j, v;
  int A[N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    v=A[i];
    j=i-1;
    while(j>=0 && A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    for(j=0;j<n;j++){
      printf("%d",A[j]);
      if(j+1!=n){
				printf(" ");
			}
    }
    printf("\n");
  }
  return 0;
}



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

using namespace std;

int R,C;
int cnt;
int s = 0;
bool sen[11][10001];
bool flg[11];

int fnc(){
	// for(int i = 1;i <= R;i++){
	// 	cout <<flg[i] <<" ";
	// }
	// printf("\n");
	int ret = 0;
	int senc[R+1][C+1];

	for(int i = 1;i <= R;i++){
		for(int j = 1;j <= C;j++){
			senc[i][j] = sen[i][j];
			if(flg[i] == 1){
				if(sen[i][j] == 1){
					senc[i][j] = 0;
				}else if(sen[i][j] == 0){
					senc[i][j] = 1;
				}
			}
		}
	}

	// for(int i = 1;i <= R;i++){
	// 	for(int j = 1;j <= C;j++){
	// 		cout << senc[i][j] <<" ";
	// 	}
	// 	printf("\n");
	// }

	int sum1;
	int sum0;
	int sum;

	for(int i = 1;i <= C;i++){
		sum1 = 0;
		sum0 = 0;
		sum = 0;
		for(int j = 1;j <= R;j++){
			if(senc[j][i] == 1)sum1++;
			if(senc[j][i] == 0)sum0++;
		}
		sum = max(sum1,sum0);
		//cout << sum1 <<" " << sum0 << " " << sum << endl;
		//cout << sum << endl;
		ret += sum;
		//cout << ret << " ";
	}
	//printf("\n");
	//cout << ret <<" "<< ++s << endl ;
	return ret;
}

int solve(int d){
	int ret = 0;

	if(d == R)return fnc();

	ret = max(ret,solve(d+1));
	
	flg[d+1] = 1;
	ret = max(ret,solve(d+1));
	flg[d+1] = 0;

	return ret;
}

int main(){
	while(cin >> R >> C,R){
		fill_n(flg,11,0);
		fill_n(*sen,11*10001,-1);

		for(int i = 1;i <= R;i++){
			for(int j = 1;j <= C;j++){
				cin >> sen[i][j];
			}
		}
		cout << solve(0) << endl;
	} 
	return 0;
}

Measured memory_bytes: 3584
a = input()
check = 'ACGT'
ans_list = []
for p in range(len(a)):
    for q in range(len(a)-1):
        
        count = 0
        for r in range(len(a[p:len(a)-q])):
            
            if a[p:len(a)-q][r] in check:
                count += 1
                if count == len(a[p:len(a)-q]):
                    ans_list.append(a[p:len(a)-q])
                    break
ls =[]
for i in range(len(ans_list)):
    ls.append(len(ans_list[i]))
if len(ls) == 0:
    if a[0] in check:
        print(1)
    else:
        print(0)
else:
    print(max(ls))



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

int main(){
  int n;ll k;cin >> n >> k;
  vector<int> a(n),f(n);
  ll sum = 0;
  rep(i,n) {
    cin >> a[i];
    sum += a[i];
  }
  if(sum <= k){
    cout << 0 << endl;
    return 0;
  }
  rep(i,n) cin >> f[i];
  sort(a.rbegin(),a.rend());
  sort(f.begin(),f.end());

  vector<ll> score(n);
  ll mx = 0;
  rep(i,n) {
    score[i] = ll(a[i])*ll(f[i]);
    mx = max(mx,score[i]);
  }
  ll mi = 0;

  ll temp;
  while(mx-mi>1){
    temp = (mx+mi)/2;
    sum = 0;
    rep(i,n){
      ll upp = max(score[i]-temp,ll(0));
      sum += upp/f[i];
      if(upp%f[i]!=0) sum++;
    }
    if(sum > k) mi = temp;
    else mx = temp;
  }
  cout << mx << endl;
}

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

using namespace std;

int main()
{
    string s;
    cin>>s;
    int i=-1,c1=0,c2=0;
    while(s[++i]!='\0'){

        if(i%2!=0){

            if(s[i]!='1')++c1;

        }
        else if(i%2==0){

            if(s[i]!='0')++c1;

        }
        if(i%2!=0){

            if(s[i]!='0')++c2;

        }
        else if(i%2==0){

            if(s[i]!='1')++c2;

        }

    }
    if(c1>c2)cout<<c2<<endl;
    else cout<<c1<<endl;

    return 0;


}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;

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

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

    long long ans = 0;
    if (a[0] > x) {
        ans += a[0] - x;
        a[0] = x;
    }
    for (int i = 1; i < N; i++) {
        if (a[i - 1] + a[i] > x) {
            ans += a[i - 1] + a[i] - x;
            a[i] -= a[i - 1] + a[i] - x;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#include <cstdio>

int main(void){
		int a, b;
		scanf("%d %d", &a, &b);
		if(a > b)printf("a > b\n");
		else if(a < b)printf("a < b\n");
		else if(a == b)printf("a == b\n");
		return 0;
}



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

using ll = long long;
using namespace std;

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

    ll n; cin >> n;
    ll ans = 0;

    for(ll i = 2; i * i <= n; i++)
        if(n % i == 0) ans = i;
    cout << (ans != 0 ? ((ans - 1) + (n / ans - 1)) : n - 1);
}


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

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

int main() {
	int n, k, m;
	while(cin >> n >> k >> m, n||k||m) {
		bool used[10001] = {};
		int rest = n;
		int p = m;
		while(rest>1) {
			used[p] = true;
			int adv = k%rest;
			int add = k/rest;
			rest--;
			int i = add + adv;
			while(i>0) {
				p++;
				if(p==n+1) p = 1;
				if(!used[p]) {
					i--;
				}
			}
		}
		for(int i=1; i<=n; i++) {
			if(!used[i]) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

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

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

int main(){
    int n;
    cin >> n;
    ll res=0;
    rep2(i, 1, n){
        if(n%i){
            res += n / i;
        }else{
            res += n / i - 1;
        }   
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;

    map<int, int> m;
    REP1(i, 100) REP1(j, 100) REP1(k, 100) {
        m[i * i + j * j + k * k + i * j + j * k + k * i]++;
    }
    REP1(i, n) cout << m[i] << endl;
}


Measured memory_bytes: 5392
package main

import (
  	"sort"
	"fmt"

)
func main() {

	var N,L int

	fmt.Scan(&N,&L)

	aji := make([]int,N)

	for i:=1;i<=N;i++{

		aji[i-1] = L+i-1

	}

	sort.Sort(sort.IntSlice(aji))

	sum :=0

	temp :=0
	min :=0
	index :=0

	if aji[0] > 0{

		for i:=1;i<=len(aji)-1;i++{

			sum = sum + aji[i]
		}

		fmt.Println(sum)

	}else{

		for j:=0;j<len(aji);j++{

			if aji[j] < 0 {

				temp = aji[j] *-1
			
			}else{
				temp = aji[j]

			}

			if j==0{

				min =temp
				
			}else if min >= temp {

			 min = temp

			 index =j
			}

		}
      
		for j:=0;j<len(aji);j++{

			if j != index {

				sum =sum + aji[j]
			}

		}

		fmt.Println(sum)
	}

}

Measured memory_bytes: 512
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        long C = sc.nextLong();
        long[] X = new long[N+2];
        long[] V = new long[N+1];
        for(int i = 1;i < N+1;i++){
            X[i] = sc.nextLong();
            V[i] = sc.nextLong();
        }
        X[N+1] = C;
        long[] R = new long[N+1];
        long[] L = new long[N+2];
        long[] RM = new long[N+1];
        long[] LM = new long[N+2];
        for(int i = 1;i < N+1;i++){
            R[i] = R[i-1]+V[i]-X[i]+X[i-1];
            RM[i] = Math.max(RM[i-1], R[i]);
        }
        for(int i = N;i > 0;i--){
            L[i] = L[i+1]+V[i]-X[i+1]+X[i];
            LM[i] = Math.max(LM[i+1], L[i]);
        }
        long rlm = 0;
        for(int i = 1;i < N+1;i++){
            if(X[i]*2 >= C)  break;
            rlm = Math.max(rlm, R[i]-X[i]+LM[i+1]);
        }
        long lrm = 0;
        for(int i = N;i > 0;i--){
            if(X[i]*2 <= C)     break;
            lrm = Math.max(lrm, L[i]-X[N+1]+X[i]+RM[i-1]);
        }
        long ans = 0;
        ans = Math.max(RM[N], LM[1]);
        ans = Math.max(ans, rlm);
        ans = Math.max(ans, lrm);
        if(ans < 0) System.out.println(0);
        else    System.out.println(ans);
    }
}

Measured memory_bytes: 90408
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int a=700,b=0;
    string x;
    cin>>x;
    for(int i=0;i<x.size();++i)
    if(x[i]=='o')
       b++;
    a=a+(100*b);
    cout<<a<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        if (scanner.hasNextLine()) {
            String[] array = scanner.nextLine().split(" ");
            int A = Integer.parseInt(array[0]);
            int B = Integer.parseInt(array[1]);
            int C = Integer.parseInt(array[2]);

            int sumDiff = 0;
            if (A < B) {
                if (B < C) {
                    // max is C
                    sumDiff = C - A + C - B;
                } else {
                    // max is B
                    sumDiff = B - A + B - C;
                }
            } else if (A < C) {
                // max is C
                sumDiff = C - A + C - B;
            } else {
                // max is A
                sumDiff = A - B + A - C;
            }

            if ((sumDiff & 1) == 1) {
                sumDiff += 3;
            }
            System.out.println(sumDiff / 2);
        }
    }
}

Measured memory_bytes: 23252
#include <stdio.h>
#include <math.h>

int main(){
	char x[1], y[1], ans[1];
	int a[3], z, i, j;
	a[0] = 1;
	a[1] = a[2] = 0;
	while(scanf("%1s,%1s", &x[0], &y[0]) != EOF){
		if(x[0] == 'A') i = 0;
		if(x[0] == 'B') i = 1;
		if(x[0] == 'C') i = 2;
		if(y[0] == 'A') j = 0;
		if(y[0] == 'B') j = 1;
		if(y[0] == 'C') j = 2;
		z = a[i];
		a[i] = a[j];
		a[j] = z;
	}
	if(a[0] == 1) printf("A\n");
	if(a[1] == 1) printf("B\n");
	if(a[2] == 1) printf("C\n");
	return 0;
}

Measured memory_bytes: 524
import java.util.Scanner;

//Simultaneous Equation
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			double a[] = new double[6];
			for(int i=0;i<6;i++)a[i]=sc.nextDouble();
			double d = a[0]*a[4]-a[1]*a[3];
			double x = (a[4]*a[2]-a[1]*a[5])/d;
			double y = (a[0]*a[5]-a[2]*a[3])/d;
			if(x==0)x=0;
			if(y==0)y=0;
			System.out.printf("%.3f %.3f\n", x, y);
		}
	}
}

Measured memory_bytes: 12000
use std::io::BufRead;

pub struct StdinReader<R: BufRead> {
    pub buf_reader: R,
    pub buf: String,
}

impl<R: BufRead> StdinReader<R> {
    pub fn new(r: R) -> Self {
        StdinReader {
            buf_reader: r,
            buf: String::with_capacity(10000),
        }
    }
}

#[macro_export]
macro_rules! input {
    ($reader : expr, $t : ty) => { // one variable
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: $t = reader.buf.trim().parse().unwrap();
                reader.buf.clear();
                tmp_var
            },
        }
    };
    ($reader : expr, $t0 : ty, $t1 : ty) => { // 2 tuple
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: Vec<$t0> = reader.buf.trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
                reader.buf.clear();
                (tmp_var[0].clone(), tmp_var[1].clone())
            }
        }
    };
    ($reader : expr, $t0 : ty, $t1 : ty, $t2 : ty) => { // 3 tuple
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: Vec<$t0> = reader.buf.trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
                reader.buf.clear();
                (tmp_var[0].clone(), tmp_var[1].clone(), tmp_var[2].clone())
            }
        }
    };
    ($reader : expr, $t : ty; $size : expr) => { // Vector
        match &mut $reader {
            reader => {
                use std::io::BufRead;
                reader.buf_reader.read_line(&mut reader.buf).unwrap();
                let tmp_var: $t = reader.buf.trim().split_whitespace().map(|a| a.parse().unwrap()).collect();
                reader.buf.clear();
                tmp_var
            }
        }
    };
}

fn main() {
    let handle = std::io::stdin();
    let mut r = StdinReader::new(handle.lock());
    let (h, w) = input!(r, usize, usize);
    let (hh, ww) = input!(r, usize, usize);
    println!("{}", h * w + hh * ww - hh * w - ww * h );
}


Measured memory_bytes: 4352
#include<stdio.h>
int main(){
    int n, ans = 0;
    scanf("%d",&n);
    char s[n + 1];
    scanf("%s",s);
    for(int i = 0; i < n - 2; i++)
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
            ans ++;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ll long long int
using namespace std;
ll ans = 0, sum = 0, n, k, counter = 0;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(50, vector<ll>(50, INF));

map<char, ll> mp;
ll d[10005][10005];
vector<ll> vec;

int main()
{
	ll a, b, c;
	cin >> a >> b >> c;
	if (a + b == c || a + c == b || b + c == a) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
n,x=map(int,input().split())
a=list(map(int,input().split()))

cnt=0
for i in range(1,n):
    if a[i]+a[i-1]>x:
        t=a[i]+a[i-1]-x
        if a[i]>=t:
            a[i]-=t
        else:
            a[i]=0
        cnt+=t
print(cnt)

Measured memory_bytes: 14252
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
#define INF 0x7FFFFFFF

int main(){
  long long n,q,xx,nn;
  scanf ("%lld %lld",&n,&q);
  xx=int(sqrt(n))+1;
  nn=xx*xx;
  vector<long long> a(nn,0);
  vector<long long> aa(xx,0);
  long long int x,y,c,xxx,yyy,z;
  for(int i=0;i<q;i++){
    scanf ("%lld",&c);
    scanf ("%lld",&x);
    x--;
    xxx=x/xx;
    if(c==1){
      long long ans;
      ans=a[x]+aa[xxx];
      printf("%lld\n",ans);
    }
    else{
      scanf ("%lld %lld",&y,&z);
      y--;
      yyy=y/xx;
      long long ma,mb;
      ma=xxx*xx+xx;
      mb=yyy*xx;
      if((y-x)>=xx*2){
        for(int t=x;t<ma;t++){
          a[t]=a[t]+z;
        }
        for(int t=xxx+1;t<yyy;t++){
          aa[t]=aa[t]+z;
        }
        for(int t=mb;t<=y;t++){
          a[t]=a[t]+z;
        }
      }
      else{
        for(int t=x;t<=y;t++){
          a[t]=a[t]+z;
        }
      }


    }
    /*for(int s=0;s<nn;s++){
      printf("%d",a[s]);
    }
    printf("\n");*/
  }
}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
const int64_t INF=9999999999999999;

int main() {
   int A,B;
   cin>>A>>B;
   if((A+B)/2*2==(A+B)){cout<<(A+B)/2<<endl;}
   else{cout<<"IMPOSSIBLE"<<endl;}
return 0;}

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

void solve(int x, int y, int z)
{
  std::cout << z << " " << x << " " << y << std::endl;
}

int main()
{
  int x, y, z;
  std::cin >> x >> y >> z;

  std::cout << std::setprecision(20);
  solve(x, y, z);
}


Measured memory_bytes: 256
package main

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

func main() {
	sc := NewScanner()
	S, T := sc.Next(), sc.Next()

	cnt := 0
	for i := 0; i < len(S); i++ {
		if S[i] != T[i] {
			cnt++
		}
	}
	fmt.Println(cnt)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 4408
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline

n = int(input())
A = []
for i in range(n):
    a = int(input())
    A.append(a)
I = list(range(n))
I.sort(key = lambda x:A[x])
ans = 0
for i,j in enumerate(I):
    ans += (i-j)%2
print(ans//2)


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

int main()
{
    int N;
    cin >> N;
    vector<int> H;
    while(N--) {
        int h;
        cin >> h;
        H.push_back(h);
    }

    bool valid = true;
    for (int i=H.size()-1; i>0; i--) {
        int ldiff = H[i] - H[i-1];
        if (ldiff == -1) {
            H[i-1]--;
        } else if (ldiff < -1) {
            valid = false;
            break;
        }
    }

    if(valid) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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

int main()
{
    char s[1000], t[1000];
    int s_len, t_len;
    int min_counts = 10000, counts = 0;

    cin >> s >> t;
    s_len = strlen(s);
    min_counts = t_len = strlen(t);

    for (int i = 0; i <= s_len - t_len; i++)
    {
        for (int j = 0; j < t_len; j++)
        {
            if (s[i + j] != t[j])
            {
                counts++;
            }
#if (0)
            if (s[i + j] == t[j])
            {
            }
            else
            {
                counts++;
            }
#endif
        }
        min_counts = min(min_counts, counts);
        // if (counts < min)
        // {
        //     min = counts;
        // }
        counts = 0;
    }

    cout << min_counts << endl;
    return 0;
}

Measured memory_bytes: 3580
s=input()
s_s=set()
for i in s:
    s_s.add(i)
s_s=list(s_s)
if len(s_s)==2:
    a=s_s[0]
    b=s_s[1]
    a_c=0
    b_c=0
    for i in s:
        if i==a:
            a_c+=1
        else:
            b_c+=1
    if a_c==2 and b_c==2:
        print('Yes')
    else:
        print('No')
else:
    print('No')


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
const int inf=1e9;
int n,k,s;
int main(){
	cin>>n>>k>>s;
	int i=1;
	for(i;i<=k;i++){
		cout<<s<<" ";
	}
	for(;i<=n;i++){
		cout<<(s==inf?1:s+1)<<" ";
	}
}

Measured memory_bytes: 1280