akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;
// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

int calc_digit(long long N) {
    int res = 0;
    while (N) {
        ++res;
        N /= 10;
    }
    return res;
}



int main(){
  ll N;cin >> N;
  vector<ll> a(N);
  rep(i,N) cin >> a[i];
  ll ans = 1;
  rep(i,N){
    if(a[i] == 0){
      cout << 0 << endl;
      return 0;
    }
  }
  bool check = false;
  rep(i,N){
    if(a[i] % 10) check = true;
  }
  rep(i,N){
    // cout << log10(ans) + log10(a[i]) << endl;
    if( double(log10(ans) + log10(a[i]) ) >= 18.0  and check ){
      cout << -1 << endl;
      return 0;
    }
    ans *= a[i];
    /*
    if(ans > 1e18){
      cout << -1 << endl;
      return 0;
    }
    */
  }
  cout << ans << endl;

}


Measured memory_bytes: 4116
#include<stdio.h>
#include<string.h>
int main()
{
	char s[202];
	scanf("%s",s);
	int i;
	int ans;
	int k;
	for(ans=strlen(s)-2;ans>=0;ans-=2)
	{
		k=0;
		for(i=0;i<ans/2;i++)
		{
			if(s[i]!=s[ans/2+i])
			{
				k++;
				break;
			}
		}
		if(k==0)
		  break;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#pragma region template
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9+7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,S,T,U,V,W,x,y,z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
typedef long long ll;
typedef pair<ll, ll> Pa;

template <std::int_fast64_t Modulus> class modint {
  using u64 = std::int_fast64_t;
public:
  u64 a;
  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};
#pragma endregion

int main() {
  cin >> N;
  ll count = (N / 500) * 1000;
  N %= 500;
  count += (N / 5)*5;
  cout << count;
} 



Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

k,x = inpm()
if k * 500 >= x:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 31200
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cstring>
#include <tuple>
#include <vector>
#include <map>
#include <iterator>
#include <cmath>

using namespace std;
using lint = long long int;

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

	double *v;
	v = new double[n];

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

	sort(v, v + n);

	double val = v[0];
	for (int i = 1; i<n; i++) {
		val = (val + v[i]) / 2.0;
	}

	cout << val;

	return 0;
}

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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	string s; cin >> s;
	for(int i=0; i<s.length(); i++){
		if(s[i]=='7'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}	
/*  Benq's (modified)
	stuff you should look for
	* ll, int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 3640
N = int(input())

cards = [[0 for i in range(13)] for j in range(4)]

for i in range(N) :
    suit, num = input().split()
    if suit == "S" :
        cards[0][int(num) - 1] = 1
    elif suit == "H" :
        cards[1][int(num) - 1] = 1
    elif suit == "C" :
        cards[2][int(num) - 1] = 1
    elif suit == "D" :
        cards[3][int(num) - 1] = 1

for i in range(4) :
    for j in range(13) :
        if i == 0 and cards[i][j] == 0 :
            print("S", j + 1)
        if i == 1 and cards[i][j] == 0 :
            print("H", j + 1)
        if i == 2 and cards[i][j] == 0 :
            print("C", j + 1)
        if i == 3 and cards[i][j] == 0 :
            print("D", j + 1)



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

int main(){
    int N;
    cin >> N;
    string C;
    cin >> C;
    int counta=0;
    int akaka=0;
    int i;
    for(i=0; i<N; i++){
        if(C[i]=='R'){
            counta++;
        }
    }
    for(i=0; i<counta; i++){
        if(C[i]=='R'){
            akaka++;
        }
    }
    cout << counta-akaka << endl;
    system("pause");
    return 0;
}

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

void main(){
  int N;
  scanf("%d",&N);
  int data[N],res,ave;
  double sum;
  sum=res=0;
  for(int i=0;i<N;i++){
  	scanf("%d",&data[i]);
    sum+=data[i];
  }
  
  ave=(int)round(sum/N);
  for(int i=0;i<N;i++){
    res+=(ave-data[i])*(ave-data[i]);
  }
  printf("%d",res);
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
using namespace std;

int main(void){
    int a,b,c;
    int count = 0;
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> c;
    for(int i = a;i<=b;i++) {
        if(c%i == 0) count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 3184
nums1 = []
sum = 0
for i in range(2):
    nums = [int(e) for e in input().split()]
    nums1.append(nums)

max = nums1[1][0]
min = nums1[1][0]
sum = 0

for i in range(len(nums1[1])):
    if nums1[1][i]>max:
        max = nums1[1][i]
    if nums1[1][i]<min:
        min = nums1[1][i]
    sum = sum + nums1[1][i]
    
print(min, max, sum)


Measured memory_bytes: 6604
#pragma comment(linker,"/STACK:36777216")

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <limits>
#include <ctime>
#include <cassert>
#include <map>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <stack>
#include <queue>
#include <numeric>
#include <iterator>
#include <bitset>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())
#define ten(n) ((int)1e##n)
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;


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

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
ll mod_pow(ll a, ll n, ll mod) {
	ll ret = 1;
	ll p = a % mod;
	while (n) {
		if (n & 1) ret = ret * p % mod;
		p = p * p % mod;
		n >>= 1;
	}
	return ret;
}
template<class T> T extgcd(T a, T b, T& x, T& y) { for (T u = y = 1, v = x = 0; a;) { T q = b / a; swap(x -= q * u, u); swap(y -= q * v, v); swap(b -= q * a, a); } return b; }
template<class T> T mod_inv(T a, T m) { T x, y; extgcd(a, m, x, y); return (m + x % m) % m; }

int dp[2][210];

int main() {
    int n; cin>>n;
    vector<int> t(n),v(n);
    FOR(i,n) cin>>t[i];
    FOR(i,n) cin>>v[i];
    FOR(i,n) {
        t[i] *= 2;
        v[i] *= 2;
    }

    auto cr = dp[0], nt = dp[1];
    memset(dp, 0x8F, sizeof(dp));
    cr[0] = 0;
  FOR(i,n) {
        FOR(j, t[i]) {
            FOR(k, v[i]+1) if(cr[k] >= 0) {
                for (int nk = -1; nk <= 1; nk++) {
                  	int d = k + nk;
                  	if (d < 0 || d > v[i]) continue;
                    chmax(nt[d], cr[k] + k + d);
                }
            }
          swap(cr, nt);
            memset(nt, 0xCF, sizeof dp[0]);
        }
    }

    printf("%.10lf\n", cr[0] / 8.0);

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
	int n, h, mx, total = 0;
	scanf("%d %d", &n, &h);
	vector<int> a(n), b(n);
	for(int i = 0; i < n; i++)
	{
		scanf("%d %d", &a[i], &b[i]);
	}
	mx = *max_element(a.begin(), a.end());
	sort(b.begin(), b.end(), greater<int>());
	for(int i = 0; h > 0; total++)
	{
		if(i < n && mx < b[i])
		{
			h -= b[i];
			i++;
		}
		else
		{
			total += h / mx + (h % mx ? 1 : 0);
			break;
		}
	}
	printf("%d\n", total);
}

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

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

int main(void){
    string S,T;
    cin >> S >> T;
    T.pop_back();
    if(S == T){
        cout << "Yes";
    } else {
        cout << "No";
    }
}

Measured memory_bytes: 3628
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	//static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		//int a[]=new int[N];
		//Ae2+Be2=Ce2
		int N=sc.nextInt();
		String S=sc.next();
		
		if(N>=3200) {
			p(S);
		}else p("red");
		
		
		
		
		
		
		}
		
		
	
	
	
	public static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
	}
	
	public static long gcd(long a, long b) {
        return b == 0 ? a: gcd(b, a % b);
	}

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	
}
	


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

int r[20010], p;
ll a[20010], b[20010];

int main(){
    int n;
    cin >> n;
    rep(i, n) {
        cin >> p;
        r[p]=i+1;
    }

    rep(i, n){
        a[i] = 30000 * (i+1);
        b[i] = 30000 * (n-i-1) + r[i+1];
    }

    rep(i, n) cout << a[i] << " ";
    cout << endl;
    rep(i, n) cout << b[i] << " ";
    cout << endl;

    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - AtCoder Alloy
            var line = ReadLine();
            var N = line[0];
            var H = line[1];
            var W = line[2];

            int ans = 0;

            for(int i = 0; i < N; i++)
            {
                line = ReadLine();
                var A = line[0];
                var B = line[1];

                if (A >= H && B >= W)
                {
                    ans++;
                }
            }

            Console.WriteLine(ans);
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 13268
import math

n = int(input())
c = [0] * n
s = [0] * n
f = [0] * n

for i in range(1, n):
    c[i], s[i], f[i] = [int(i) for i in input().split(" ")]

for i in range(1, n + 1):
    t = 0
    for j in range(i, n):
        if t <= s[j]:
            t = s[j] + c[j]
        else:
            t = math.ceil(t / f[j]) * f[j] + c[j]
    print(t)

Measured memory_bytes: 3064
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        b: [i32; 3],
    }

    let mut bell = b.clone();
    bell.sort();

    println!("{}", bell[0] + bell[1]);
}



Measured memory_bytes: 4352
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

LD f(int s,int p,int q){
	LD ans;
	ans = (LD)100*s -(LD)(20-PI*5.0)*p + (PI*10-20)*q;
	return ans;
}
void solve(){
	int sX,sY,gX,gY;
	cin >> sX >> sY >> gX >> gY;
	int N;
	cin >> N;
	int minX,maxX,minY,maxY;
	minX = min(sX,gX);
	maxX = max(sX,gX);
	minY = min(sY,gY);
	maxY = max(sY,gY);
	vector< pair<int,int> > pos;
	pos.reserve(N);
	for(int i=0;i<N;++i){
		int x,y;
		cin >> x >> y;
		if( minX <= x && x <= maxX && minY <= y && y <= maxY){
			pos.push_back( pair<int,int>(x,y) );
		}
	}
	if( sX == gX || sY== gY){
		int s = (maxX-minX) + (maxY-minY);
		LD ans = f(s,0,pos.size());
		cout << ans << endl;
		return;
	}
	int dirX,dirY;
	dirX = (sX<gX)?1:-1;
	dirY = (sY<gY)?1:-1;
	int size = pos.size();
	for(int i=0;i<size;++i){
		pos[i].first *= dirX;
		pos[i].second *= dirY;
	}
	sort(pos.begin(),pos.end());
	vector<int> v(size);
	for(int i=0;i<size;++i){
		v[i] = pos[i].second;
	}
	//LIS
	vector<int> dp(size,INF);
	for(int i=0;i<size;++i){
		*lower_bound(dp.begin(),dp.end(), v[i] ) = v[i];
	}
	int res = lower_bound(dp.begin(),dp.end(),INF) - dp.begin();

	///
	int s = (maxX-minX)+(maxY-minY);
	LD ans;
	if( min(maxX-minX,maxY-minY) < res ){
		ans = f(s,res-1,1);
	}else{
		ans = f(s,res,0);
	}
	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 3456
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])


Measured memory_bytes: 2940
# include <bits/stdc++.h>
# define ll long long
# define pb push_back
# define fi first
# define se second
# define mp make_pair
# define gcd(m,n)  __gcd(m, n)
# define pr_double(x) cout << fixed << setprecision(10) << x
using namespace std;

const int N = 200007;
ll par[N];
ll siz[N];
ll total_comp;
    ll get(ll x)
    {
        if(x==par[x]) return x;
        else return par[x]=get(par[x]);
    }

    void unite(ll a,ll b){
         a = get(a);
        b = get(b);
        if (a != b) {
        if (siz[a] < siz[b])
            swap(a, b);
        par[b] = a;
        siz[a] += siz[b];
    }
    }

    bool check(ll x,ll y)
    {
       if(get(x)==get(y)) return true;
       else return false;
    }

int main() {
  ll n,m;
  cin>>n>>m;
  total_comp=n;
  for(ll i=1;i<=n;i++)
  {
      siz[i]=1;
      par[i]=i;
  }
  ll ans=1;
  while(m--)
  {
      ll x,y;
      cin>>x>>y;
      if(!check(x,y))
      {
          unite(x,y);
      }
  }
  for(ll i=1;i<=n;i++)
  {
   ans=max(ans,siz[i]);
  }
  cout<<ans<<endl;
}


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

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 = 1e16;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;

ll dp[100010][2];

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

	return 0;
}


Measured memory_bytes: 2048
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    intmax_t N, A[200000];
    intmax_t sum = 0, tmp = 0, ans = 0;
    size_t i;

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

    i = 0;
    while ((tmp * 2) <= sum)
        tmp += A[i++];

    i--;
    if ((tmp * 2) == sum)
        ans = 0;
    else if ((tmp - (sum - tmp)) < ((sum - tmp + A[i]) - (tmp - A[i])))
        ans = tmp - (sum - tmp);
    else
        ans = (sum - tmp + A[i]) - (tmp - A[i]);

    printf("%jd\n", ans);

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
#define ll long long
ll dp[maxn];
string a;
ll ksm(ll a , ll b , ll mod)
{
    ll ans = 1 , base = a;
    while(b){
        if (b&1) ans = ans * base % mod;
        b >>= 1;
        base = base * base % mod;
    }
    return ans;
}
int check(int x)
{
   // cout << "待处理的数是" << x << endl;
    int ans = 0;
    while(x){
        ans++;
        x %= dp[x];
    }
    return ans;
}
int main()
{
    ios::sync_with_stdio(false);
    dp[0] = 0;
    for (int i = 1 ; i < maxn ; i++) dp[i] = dp[i >> 1] + (i & 1);
    int n ; cin >> n;
    cin >> a;
    int cnt = 0;
    for (auto g : a) cnt += (g == '1');
    // 只会减少一个或者增多一个
    ll cnt1 = 0 , cnt2 = 0;
    for (int i = 0 ; i < n ; i++){
        if (a[i] == '1'){
            // 计算假如增多了一个的情况 n 是不可能增多的
            cnt1 = (cnt1 + ksm(2 , n - i - 1 , cnt + 1))%(cnt + 1);
            // 计算假如减少了一个的情况 0 是不可能减少的
            if (cnt != 1){
                cnt2 = (cnt2 + ksm(2 , n - i - 1 , cnt - 1))%(cnt - 1);
            }
        }
    }
  //  cout << cnt << " " << cnt1 << " " << cnt2 << endl;
    ll v;
    int mod;
    for (int i = 0 ; i < n ; i++){
         if (a[i] == '1'){
            // cut down
            mod = cnt - 1;
            if (cnt == 1){
                cout << 0 << endl;
                continue;
            }
            v = ((cnt2 - ksm(2 , n - i - 1 , cnt - 1))%mod + mod)%mod;
            cout << check(v) + 1 << endl;
         }
         else {
            mod = cnt + 1;
            v = (cnt1 + ksm(2,n-i-1 , cnt + 1))%mod;
            cout << check(v) + 1 << endl;
         }
    }
    return 0;
}


Measured memory_bytes: 5320
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
using namespace std;

#define int             long long
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vector<int>>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define itr(v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fd(i,n)         for(int i=n-1;i>=0;i--)
#define fir(i,a,b)      for(int i=a;i<b;i++)
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);
#define MAXZ            200005
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

bool cmp(int a,int b) {return a>b;}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

int a[200001],b[200001];

int dfs(int n,int a,int b,int c,int d,mii &m){
    if(n==0) return 0;
    if(n==1) return d;
    if(m.find(n)!=m.end()) return m[n];
    // int minz=INT_MAX;
    // int p=(n*d);
    int minz=INT_FAST64_MAX;
    if((log2(n)+log2(d))<=log2(minz)) minz=n*d; 
    // if(p>0) minz=n*d;
    // if(p<1) minz=n*d;
    minz=min(minz,(n%2)*d+a+dfs(n/2,a,b,c,d,m));
    int p=2-(n%2);
    if(p!=2) minz=min(minz,p*d+a+dfs((n+p)/2,a,b,c,d,m));
    minz=min(minz,(n%3)*d+b+dfs(n/3,a,b,c,d,m));
    p=3-(n%3);
    if(p!=3) minz=min(minz,p*d+b+dfs((n+p)/3,a,b,c,d,m));
    minz=min(minz,(n%5)*d+c+dfs(n/5,a,b,c,d,m));
    p=5-(n%5);
    if(p!=5) minz=min(minz,p*d+c+dfs((n+p)/5,a,b,c,d,m));
    m[n]=minz;
    return m[n];
}
int32_t main()
{
    FIO
    w(t){
        mii m;
        int n,a,b,c,d;
        cin>>n>>a>>b>>c>>d;
        cout<<dfs(n,a,b,c,d,m)<<"\n";
    }
    return 0;

}

Measured memory_bytes: 4592
"""
線形探索
O(n)かかる
"""
def LinearSerch(S, T):
    count = 0
    for i in T:
        for j in S:
            if i == j:
                count += 1
                break
            else:
                pass
    
    return count

n = int(input())
s = list(map(int, input().split()))
q = int(input())
t = list(map(int, input().split()))

print(LinearSerch(s, t))




Measured memory_bytes: 6548
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

k, = map(int, readline().split())

from collections import deque
INF = 1<<30
res = [INF]*k
res[1] = 1

q = deque([(1,1)])
while q:
    dv,v = q.popleft()
    if res[v] < dv: continue
    #if v==goal: break
    for to,cost in [(10*v%k,0),((v+1)%k,1)]:
        #print(to,cost)
        if dv + cost < res[to]:
            res[to] = dv + cost
            if cost: q.append((res[to],to))
            else: q.appendleft((res[to],to))
    #print(res)
    
print(res[0])



Measured memory_bytes: 14964
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdint.h>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

void solve(long long N, long long M, std::vector<long long> A) {
  ll sum = 0;
  for (auto a : A) {
    sum += a;
  }
  cout << max(-1ll, N - sum) << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  std::vector<long long> A(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, M, std::move(A));
  return 0;
}


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

int main(){
    int n,i;
  long long sum=0;
    cin>>n;
    for(i=1;i<=n;i++){
        if(i%3==0 || i%5==0)
            continue;
            else
            sum+=i;
        }
        cout<<sum<<"\n";
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int a,b,c;
    cin >>a>>b>>c;
    if(c>=a && c<=b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { x.modm(y.modpow(mod - 2)); }

void main()
{
	auto N = RD;

	writeln((N+1)/2);
	stdout.flush;
	debug readln;
}

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

int main() {
	int a, b;
	cin >> a >> b;
	a -= b;
	if(a){
		if(a < 0){
			cout << "a < b" << endl;
		}else{
			cout << "a > b" << endl;
		}
	}else{
		cout << "a == b" << endl;
	}
	return 0;
}

Measured memory_bytes: 3092
#include<iostream>
#include<string>
#include<vector>

int main(){
  int N,count=0;
  std::cin>>N;
  std::vector<int>l(N);
  for(int i=0;i<N;i++){
    std::cin>>l[i];
  }
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      for(int k=j+1;k<N;k++){
        if(l[i]+l[j]>l[k]&&l[k]+l[j]>l[i]&&l[k]+l[i]>l[j]&&l[i]!=l[k]&&l[i]!=l[j]&&l[j]!=l[k]){
          //std::cout<<l[i]<<":"<<l[j]<<":"<<l[k]<<std::endl;
          count++;
        }
      }
    }
  }
  std::cout<<count<<std::endl;
  return 0;
}



Measured memory_bytes: 3576
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using Graph = vector<vector<int>>;
using Wgraph = vector<vector<pair<int, long long int>>>;
constexpr long long int INF = 1001001001001001LL;
constexpr long long int MOD = 1000000007LL;
constexpr double PI = 3.1415926535897932;
constexpr long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
constexpr long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = 1; i <= (n); i++)
#define DREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define SREP(i,s,t) for(int i = s; i < t; i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define PB push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

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

  double ans = 0.0;
  double cnt = 0.0;
  vector<int> p(n);
  for(int i = 0; i < n; i++) p[i] = i;

  do{
    cnt += 1.0;
    for(int i = 0; i < n - 1; i++) {
      int id = p[i];
      int jd = p[i + 1];
      ans += pow((x[id] - x[jd]) * (x[id] - x[jd]) + (y[id] - y[jd]) * (y[id] - y[jd]), 0.5);
    }
  }while(next_permutation(ALL(p)));
  
  printf("%.10f\n", ans / cnt);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
const int maxn=1e6+10;
const int mod=1e9+7;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	string a,b;
	cin>>a>>b;
	int n=a.size();
	int cnt=0;
	for(int i=0;i<n;i++)
    {
        if(a[i]!=b[i])
            cnt++;
    }
    cout<<cnt<<'\n';







}


Measured memory_bytes: 3728
#include <iostream>
#include <cmath>
using namespace std;
int main (void) {
    int a, b, c;
    int d;

    cin >> a >> b >> c >> d;

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

    return 0;
}


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

using namespace std;

int main()
{
        int w,h,x,y,r;
        cin >> w >> h >> x >> y >> r;
        if(0<=x-r && x+r<=w && 0<=y-r && y+r<=h) cout << "Yes" << endl;
        else cout << "No" << endl;

        return 0;
}

Measured memory_bytes: 3092
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int N; cin >> N;
	vector<int>d(N); rep(i, 0, N) { cin >> d[i]; }
	sort(all(d));
	int M = d.back();
	vector<int>x(M + 1, 0);
	rep(i, 0, N) {
		x[d[i]]++;
	}
	int ans = 0;
	int c = 0;

	rep(i, 0, M + 1) {
		c += x[i];
		if (2 * c == N) {
			ans++;
		}
	}
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <algorithm>
#define maxn 100005
using namespace std;
int n,a[maxn];
bool cmp(int x,int y)
{
	return x>y;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		if(i+1>a[i+1])
		{
			int ans=0;
			for(int j=i+1;a[j]==i;j++) ans++;
			if(((a[i]-i)&1)||(ans&1)) printf("First");
			else printf("Second");
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 4176
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

const int MOD = 1e9 + 7;

inline int add(int x, int y){
	int res = x + y;	
	while(res >= MOD)res-=MOD;
	return res;
}

inline int mul(int x,int y){
	return (1LL * x * y) % MOD;
}

int modpow(int x,int p){
	int res = 1;
	while(p){
		if(p&1)gmul(res,x);
		gmul(x,x);
		p/=2;
	}
	return res;
}

inline int invert(int x){
	return modpow(x,MOD - 2);
}

const int N = 1e6;

int fac[N], inv[N];

void init(int n){
	fac[0] = inv[0] = 1;
	for(int i = 1;i < n; ++i){
		fac[i] = mul(fac[i-1], i);	
		inv[i] = invert(fac[i]); 
	}
}

int comb(int n,int k){
	return mul(fac[n],mul(inv[k], inv[n-k]));	
}

struct frac{
	__int128 a,b;
	frac(ll _a, ll _b){
		a = _a;	
		b = _b;
		if(a < 0 && b < 0){
			a=-a;
			b=-b;
		}
		if(b < 0 && a > 0){
			a = -a;
			b = -b;
		}
	}
	bool operator<(const frac &other) const{
		return a * other.b < other.a * b;
	}
};

map<frac,int> m;

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	int alone = 0,as=0,bs=0;
	rep(i,0,n){
		ll a,b;
		cin >> a >> b;
		if(a == 0 && b == 0){
			++alone;
		}
		else if(a == 0){
			++as;	
		}
		else if(b == 0){
			++bs;
		}
		else{
			frac f = frac(a,b);
			++m[f];
		}
	}
	ll ans = 1;
	if(as || bs || m.size()){
		for(auto &c:m){
			frac other = frac(-c.first.b,c.first.a);
			if(c.first.a < 0){
				int val = modpow(2,c.second);
				auto it = m.find(other);
				if(it != m.end()){
					gadd(val, modpow(2,it->second));
					gadd(val, MOD-1);
				}
				gmul(ans, val);
			}
			else{
				auto it = m.find(other);
				if(it == m.end()){
					gmul(ans, modpow(2,c.second));		
				}
			}
		}
		gmul(ans, add(add(modpow(2,as),modpow(2,bs)),MOD-1));
		gadd(ans,MOD-1);
	}
	else ans = 0;
	gadd(ans,alone);
	cout << ans << '\n';
}


Measured memory_bytes: 22212
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int Q = in.nextInt();
            String S = in.next();

            int s[] = new int[N + 1];
            int count = 0;
            for (int i = 2; i <= N; i++) {
                if (S.charAt(i - 1) == 'C' && S.charAt(i - 2) == 'A') {
                    count++;
                }
                s[i] = count;
            }

            for (int i = 0; i < Q; i++) {
                int l = in.nextInt();
                int r = in.nextInt();
                out.println(s[r] - s[l]);
            }
        }

    }
}



Measured memory_bytes: 73384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5 + 5, INF = 0x3f3f3f3f, M = 2e6 + 5;
//
const ll LNF = 0x3f3f3f3f3f3f3f3f;
#define rep(i, l, r) for (int i = l; i <= r; i++)
#define per(i, r, l) for (int i = r; i >= l; i--)
#define repe(i, u) for (int i = head[u]; i; i = nxt[i])
int n, a[1025][1025], vis[1025];
bool flag;
bool ok() {
  for (int i = 1; i <= n; i++)
    if (a[i][0] != n) return 0;
  return 1;
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n - 1; ++j) cin >> a[i][j];
    a[i][0] = 1;
  }
  for (int z = 0; z <= 0x3f3f3f3f; z++) {
    if (ok()) {
      cout << z << '\n';
      return 0;
    }
    flag = 0;
    memset(vis, 0, sizeof vis);
    for (int i = 1; i <= n; i++) {
      if (vis[i] || a[i][0] == n) continue;
      int x = a[i][a[i][0]];
      if (!vis[i] && !vis[x] && a[x][a[x][0]] == i) {
        a[i][0]++;
        a[x][0]++;
        vis[i] = vis[x] = 1;
        flag = 1;
      }
    }
    if (!flag) {
      cout << -1 << '\n';
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 4352
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H;
long long int ans;


int main() {
	ios::sync_with_stdio(false);
	cin >> N >> K;
	long long int num[100001] = {};
	for (int i = 0; i < N; i++) {
		int a, b;
		cin >> a >> b;
		num[a] += b;
	}
	for (int i = 0; i < 100001; i++) {
		ans += num[i];
		if (ans >= K) {
			cout << i << endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
x,y,z,k = map(int, input().split())
a = sorted(list(map(int, input().split())),reverse=True)
b = sorted(list(map(int, input().split())),reverse=True)
c = sorted(list(map(int, input().split())),reverse=True)

sumAB = sorted([ai + bi for ai in a for bi in b],reverse=True)[:k]
sumABC = sorted([ci + abi for ci in c for abi in sumAB],reverse = True)[:k]

for i in range(k):
    print(sumABC[i])

Measured memory_bytes: 185656
package main

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

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func main() {
	a, b := nextInt(), nextInt()
	length := a - 2*b
	if length < 0 {
		length = 0
	}
	fmt.Println(length)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
namespace QiFeng233{
	long long n,k;
	long long min(long long a,long long b){
		return a<b?a:b;
	}
	void solve(){
		scanf("%lld%lld",&n,&k);
		printf("%lld",min(n%k,k-n%k));
	}
}
signed main(){
	QiFeng233::solve();
	return 0;
}

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

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

	int A[110] = {0};
	for (int i = 0; i < K; ++i)
	{
		int d;
		cin >> d;
		for (int j = 0; j < d; ++j)
		{
			int a;
			cin >> a;
			A[a - 1]++;
		}
	}

	int treated = 0;
	for (int i = 0; i < N; i++)
	{
		if (A[i] == 0)
		{
			treated++;
		}
	}

	cout << treated << endl;

	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main() {
  int n;
  string s;
  cin >> n >> s;
  int tmp = 0;
  int ans = 0;
  rep (i, s.size()) {
    if (s[i] == 'I') tmp++;
    else tmp--;
    ans = max(tmp, ans);
  }
  P(ans);
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			String s = sc.next();
			int n = s.length();
			String new_str1 = s.substring(n-1, n);
			if(new_str1.equals("s")) {
				System.out.println(s + "es");
			}
			else {
				System.out.println(s + "s");
			}
		}
	}

}

Measured memory_bytes: 38496
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream &operator << (ostream& out,const pair<S,T>& o){
    out << "(" << o.first << "," << o.second << ")"; return out;
}
/*
 Atcoder 100~200点代
 アな問題が多いので,まとめる
*/
// https://abc042.contest.atcoder.jp/tasks/abc042_a
//void solve(){ ll A,B,C; cin >> A >> B >> C; if(A == 5 && B == 5 && C == 7){ cout << "YES" << endl; return;} if(A == 5 && B == 7 && C == 5){ cout << "YES" << endl; return;} if(A == 7 && B == 5 && C == 5){ cout << "YES" << endl; return;} cout << "NO" << endl; return ; }
// https://abc043.contest.atcoder.jp/tasks/abc043_a
//void solve(){ ll N; cin >> N; cout << N*(N+1)/2 << endl; }
// https://abc044.contest.atcoder.jp/tasks/abc044_a
//void solve(){ll N,K,X,Y;cin>>N>>K>>X>>Y; cout<<X*min(N,K)+Y*max(0LL,N-K)<<endl;}
// https://abc045.contest.atcoder.jp/tasks/abc045_a
//void solve(){ll a,b,h;cin>>a>>b>>h;cout<<(a+b)*h/2<<endl;}
// https://abc046.contest.atcoder.jp/tasks/abc046_a
//void solve(){ ll a,b,c; cin >> a >> b >> c; set<ll> s; s.insert(a); s.insert(b); s.insert(c); cout << s.size() << endl; }
// https://abc047.contest.atcoder.jp/tasks/abc047_a
//void solve(){ll a,b,c;cin>>a>>b>>c;if(a==b+c||b==a+c||c==a+b)cout<<"Yes"<<endl;else cout<<"No"<<endl;}
// https://abc048.contest.atcoder.jp/tasks/abc048_a
//void solve(){string s1,s2,s3;cin>>s1>>s2>>s3;cout<<"A"<<s2[0]<<"C"<<endl;}
// https://abc049.contest.atcoder.jp/tasks/abc049_a
//void solve(){char c;cin>>c;string s="aiueo";if(s.find(c)!=string::npos)cout<<"vowel"<<endl;else cout<<"consonant"<<endl;}
// https://abc050.contest.atcoder.jp/tasks/abc050_a
//void solve(){ll A,B;char op;cin>>A>>op>>B;if(op=='+')cout<<A+B<<endl;else cout<<A-B<<endl;}
// https://abc051.contest.atcoder.jp/tasks/abc051_a
void solve(){string s;cin>> s;cout<<s.substr(0,5)<<" "<<s.substr(6,7)<<" "<<s.substr(14)<<endl;}
// https://abc052.contest.atcoder.jp/tasks/abc052_a
//void solve(){}
// https://abc053.contest.atcoder.jp/tasks/abc053_a
//void solve(){}
// https://abc054.contest.atcoder.jp/tasks/abc054_a
//void solve(){}

// Main function
int main(void) {cin.tie(0); ios::sync_with_stdio(false); solve(); return 0; }


Measured memory_bytes: 256
N,M,C = map(int,input().split())
B_ = list(map(int,input().split()))
A_ = [list(map(int,input().split())) for i in range(N)]
ans = 0
for i in range(N):
  sum_n = 0
  for j in range(M):
    sum_n += A_[i][j]*B_[j]
  if sum_n+C > 0:
    ans += 1
print(ans)

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

using namespace std;

int main(void)
{
    long long int n, d, x, y;
    cin >> n >> d;
    int count = 0;
    for(int i = 0; i < n; i++){
        cin >> x >> y;
        if(x*x + y*y <= d*d){
            count++;
        }
    }
    
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3644