akhauriyash/Code-Regression huggingface dataset:
/// a.cpp

# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < __typeof(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < pll >
# define pb push_back
# define pdd pair < db , db >
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    ll a,b;
    fi>>a>>b;
    if (abs(a - b) <= 1)
        puts("Brown");
    else
        puts("Alice");
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <string.h>
#include <map>
#include <bitset>

#define Z class
#define ln cout<<'\n'
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (n); ++i)
//ASCII a=97, A=65
// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
// sort(vec.begin(), vec.end()); std::greater<>()
// reverse(vec.begin(), vec.end());
// scanf("%s",s);
// printf("%d\n",end-start+1);
// ceil (a + (b - 1)) / b

//===== グラフ受け取り =====//
/*
    int N, M; cin >> N >> M;
    Graph G(N);
    for (int i = 0; i < M; ++i) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);

        // 無向グラフの場合は以下を追加
        // G[b].push_back(a);
    }
    
    // == 重み付きグラフ == //
    
    struct Edge {
        int to; 
        int weight; 
        Edge(int t, int w) : to(t), weight(w) { }
    };
    using Graph = vector<vector<Edge>>;
    int main() {
        int N, M; cin >> N >> M;
        Graph G(N);
        for (int i = 0; i < M; ++i) {
            int from, to, weight;
            cin >> from >> to >> weight;
            G[from].push_back(Edge(to, weight));
        }
    }
*/    

using namespace std;
// using Edge = pair<int, int>;
// using Graph = vector<vector<Edge>>;
// using pll = pair<long long, long long>;

template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;


bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) { 
    return (a.second < b.second); 
} 



ll total_t = 0;

int main(){
    int N; cin >> N;
    pair<int, int> p[N];
    string res = "Yes";
    
    rep (i, N){
        int A, B; cin >> A >> B;
        p[i] = make_pair(A, B);
    }
    sort(p, p+N, sortbysec);
    
    rep (i, N) {
        total_t += p[i].first;
        if(total_t > p[i].second){
            res = "No";
            break;
        }
    }
    cout << res << endl;
}






Measured memory_bytes: 1792
def statecheck(state,kS,p):
  status = True
  i = 0
  for ks in kS:
    check_num = 0
    for s in ks[1:]:
      check_num = (check_num + state[s-1])
    if p[i] != check_num%2:
      status = False
      break
    i+=1
  return status

N, M= (int(i) for i in input().split())

kS = [list(map(int, input().split())) for _ in range(M)]
p = [int(i) for i in input().split()]

ans = 0

for i in range(2**N):
  state = list(format(i, 'b').zfill(N))
  state = list(map(int,state))
  if statecheck(state,kS,p):
    ans += 1

print(ans)


Measured memory_bytes: 3064
#include<stdio.h>
int main(){
	int i,n,h=0,m=0,s=0;
	scanf("%d",&i);
	while(i/3600){
		h++;
		i-=3600;
	}
	while(i/60){
		m++;
		i-=60;
	}
	printf("%d:%d:%d\n",h,m,i);
} 


Measured memory_bytes: 2732
import numpy as np
 
N=int(input())    
listA = list(map(int,input().split()))
 
minA = min(listA)
 
while True:
   minA = min(listA)
   minApos = np.argmin(listA)
   listA = [x % minA for x in listA]
   listA[minApos] = minA
   listA= [x for x in listA if x >0]
   if len(set(listA))==1:
       print(minA)
       break

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

typedef long long ll;

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<ll> sum(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + a[i];
    sum[i] %= k;
  }
  vector<ll> vec(n + 1, 0);
  // i-sum[i]%k
  for (int i = 1; i <= n; i++) {
    vec[i] = ((i - sum[i]) % k + k) % k;
  }
  unordered_map<ll, int> map;
  ll ans = 0;
  for (int i = 1; i < min(k, n + 1); i++) {
    // (0,k)
    map[vec[i - 1]]++;
    ans += map[vec[i]];
  }
  if (k > n) {
    cout << ans << endl;
    return 0;
  }
  for (int i = k; i <= n; i++) {
    // (i-k.i)
    map[vec[i - k]]--;
    map[vec[i - 1]]++;
    ans += map[vec[i]];
  }
  cout << ans << endl;
}


Measured memory_bytes: 13256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/

int a, b;

int main() {
    cin >> a;
    cin >> b;
    if (a > 8 || b > 8) cout << ":(";
    else cout << "Yay!";    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
 
void doit()
{
	long long  n;
	cin >> n;
	
	long long cnt =0;
	long long maxi=0 ;
	
	map< long long, long long > v;
	
	for(int i =1;i <=n ;i++)
	{
		int f,temp=i,l =i%10;
		
		while( temp >= 10)
			temp =temp/10;
		
		f =temp;
		v[ f*10 + l]++;
	}
	map< long long, long long > :: iterator it;
	for(it= v.begin() ;it!= v.end() ;it++)
	{
		int f,temp=it->first,l =(it->first)%10;
		if(l==0 || it->second==0)
			continue;
		//cout<< it->first<<" "<<it->second<<endl;
		while( temp > 10)
			temp =temp/10;
		
		f =temp;
		
		cnt += v[it->first] * v[l*10+f];
		
	}
	cout<<cnt;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	int t=1;
	//cin >>t;
	
	while(t--)
		doit();
	
	return 0;
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
#include<cctype>

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()

using namespace std;

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

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int a,b,n;
vii memo(18,vi(18));

int solve(int x,int y,int cnt){
	int res1,res2;
	if(memo[y][x] != -1) return memo[y][x];
	if(x > a || y > b || cnt == a + b - 2) return memo[y][x] = x == a && y == b;
	res1 = memo[y][x] = solve(x,y + 1,cnt + 1);	//テ・ツ個療」ツ?ォティツ。ツ古」ツ?湘・ツ?エテ・ツ青?
	res2 = memo[y][x] = solve(x + 1,y,cnt + 1);	//テヲツ敖アテ」ツ?ォティツ。ツ古」ツ?湘・ツ?エテ・ツ青?
	return memo[y][x] = res1 + res2;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	while(1){
		rep(i,memo.size()){
			rep(j,memo[i].size())
				memo[i][j] = -1;
		}

		cin >> a >> b;
		if(a == 0 && b == 0) break;
		cin >> n;
		rep(i,n){
			int x,y;
			cin >> x >> y;
			memo[y][x] = 0;	
		}

		int ans = solve(1,1,0);

		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <string>
 
using namespace std;
 
long add(const string& numbers, const int bitsOfPlusPosition);
 
int main() {
    string numbers;
    cin >> numbers;
    
    long answer = 0;
    for (int bits = 0; bits < (1 << (numbers.size() - 1)); ++bits) {
        answer += add(numbers, bits);
    }
    cout << answer << endl;       
}
 
long add(const string& numbers, const int bitsOfPlusPosition) {
    const int DECIMAL_BASE = 10;
    long sum = 0;
    long term = 0;
    for (size_t i = 0U; i < numbers.size(); ++i) {
        term *= DECIMAL_BASE;
        term += numbers.at(i) - '0';
        if (bitsOfPlusPosition & (1 << i) || i == numbers.size() - 1) {
            sum += term;
            term = 0;
        }
    }
    return sum;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll N,K; cin >> N >> K;
  ll ans=0;
  ans = min(N % K,abs(N % K - K));
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>


#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
// rep(i,1,10) is from 1 to 9 and rep(I,10,1) is from 9 to 1
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define pf push_front
#define eb emplace_back 
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define mod2 998244353
#define mi multiset<int>
#define mii multiset<pii>
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define vout(a) for(auto x:a) cout<<x<<" ";
#define PI 3.14159265358979323846

// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>


// using namespace __gnu_pbds;
using namespace std;

int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}

bool comp(int a, int b) 
{ 
    return (a < b); 
} 

int modp(int a,int n)
{
    n=n%(mod-1);
    a=a%mod;
    int res=1;
    while(n>0)
    {
        if(n&1) res=(res*a)%mod;
        a=(a*a)%mod;
        n>>=1;
    }
    return res;
}

vi adj[200005],parent(200005,0);
vector<bool> vis(200005,false);
// // map<int,int> lvlcnt;



void dfs(int s)
{
    vis[s]=true;
    for(int u:adj[s])
    {
        if(!vis[u])
        {
            vis[u]=true;
            dfs(u);
        }
    }
}


void solve()
{
    int t,n,m,i,k,l,r,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U;
    // int b=0;
    cin>>n>>m;
    while(m--)
    {
        cin>>u>>v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    queue<int> q;
    q.push(1);
    vis[1]=true;
    parent[1]=0;
    while(!q.empty())
    {
        u=q.front();
        q.pop();
        for(int v:adj[u])
        {
            if(!vis[v])
            {
                vis[v]=true;
                q.push(v);
                parent[v]=u;
            }
        }
    }
    rep(i,2,n+1) if(parent[i]) count++;
    if(count!=n-1)
    {
        cout<<"No";
        return;
    }
    cout<<"Yes\n";
    rep(i,2,n+1) cout<<parent[i]<<"\n";
}



signed main()
{
    #ifndef ONLINE_JUDGE 
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 16056
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,a,b;
	cin>>n>>a>>b;
	int s=n*a;
	if(s>=b)
	{
		cout<<b<<endl;
		return 0;
	}
	if(s<b)
	{
		cout<<s<<endl;
		return 0;
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

/*
テストケース全てに目を通す
テストケースが2個以下だったらなんかある
N最小のコーナーケースがないか調べる
制約をしっかりと確認する（1からNまでの順列、全て異なる値などの制約も含め）
制約のn*mとn,mを読み違えない
操作の逆順を考える
オーバーフローしないか確かめる
Codeforcesではscanfを使う
modの引き算には+modをする
エラー出力は消す
エラー出力を消せ！！！！！
数値の区切り位置を誤読しない
cout << fixed;
cout << setprecision(n) << ans;
 */
string gen(int x){
    string s="000000";
    rep(i,6){
        int p=x%10;
        s[5-i]='0'+p;
        x/=10;
    }
  	return s;
}

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> pre[n];
    //rep(i,n)pre.pb(mod);
    vector<pii> pe(m);
    rep(i,m){
        int p,y;
        cin >> p >> y;
        p--;
        pe[i]={p,y};
        pre[p].pb(y);
    }
    rep(i,n){
        sort(all(pre[i]));
    }
    rep(i,m){
        int p=pe[i].F;
        int y=pe[i].S;
        auto itr=lower_bound(all(pre[p]),y);
        int num=itr-pre[p].begin();
        num++;
        string s,t;
        s=gen(p+1);
        t=gen(num);
        cout << s << t << endl;
    }


    
}

/*
*/



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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(num) scanf("%d",&num)
#define sff(num1,num2) scanf("%d %d",&num1,&num2)
#define sfff(num1,num2,num3) scanf("%d %d %d",&num1,&num2,&num3);
#define sl(num) scanf("%lld",&num)
#define sll(num1,num2) scanf("%lld %lld",&num1,&num2)
#define slll(num1,num2,num3) scanf("%lld %lld %lld",&num1,&num2,&num3);
#define rep(i,n) for(i=1;i<=n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define pb push_back
#define mpp make_pair
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
#define TIME cerr<<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<"s\n";
typedef long long int ll;
using namespace std;
int main()
{
    unordered_map<char,int>mp;
    string a;
    cin>>a;
    bool chk=false;
    int i;
    rep0(i,a.size())
        mp[a[i]]++;
    //db(mp.size());
    if(mp.size()!=2)
    {
        puts("No");
        return 0;
    }
    for(auto it=mp.begin();it!=mp.end();it++)
    {
        if(it->se!=2)
        {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
}


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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b){
    cout << c << "\n";
  }else if(a==c){
    cout << b << "\n";
  }else{
    cout << a << "\n";
  }
return 0;
}


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

#ifdef DEBUG
#define FAST ;
#else
#define FAST ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define cerr
#endif
#define _ <<' '<<
#define Fr(i, s, e) for(auto i = s; i < e; ++i)
#define All(v) v.begin(),v.end()
#define Ft first
#define Sd second
using ll = long long;
using pii = pair<int, int>;
constexpr ll MOD = 998'244'353;

int n, m, q;
vector<tuple<int,int,int,int>> abcd;
int calc(int dep = 0) {
    static vector<int> v{};
    int rt = 0;
    if (v.size() == n) {
        for(auto &[a,b,c,d]: abcd)
            if (v[b]-v[a] == c) rt += d;
    } else {
        v.emplace_back(v.empty() ? 1 : v.back());
        for(; v.back() <= m; v.back()++)
            rt = max(rt, calc(dep+1));
        v.pop_back();
    }
    return rt;
}

signed main() {
    FAST;

    cin >> n >> m >> q;
    abcd.resize(q);
    for(auto &[a,b,c,d]: abcd) {
        cin >> a >> b >> c >> d;
        a--; b--;
    }
    cout << calc() << endl;

}


Measured memory_bytes: 3584
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat() float64 {
	sc.Scan()
	f, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func main() {
	n := nextInt()
	min := 1000000
	ans := 0
	for i := 0; i < n; i++ {
		p := nextInt()
		if p <= min {
			min = p
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2048
n = int(input())
ans = 10**12
List = []
for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        List.append(i)
for i in range(len(List)):
    s = List[i] + n / List[i] - 2
    ans = min(ans, s)
print(int(ans))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <numeric>
#include <string>
using namespace std;

int main(void){
    int N;
    cin >> N;
    vector<vector<int>> D(N, vector<int> (2)); 
    for(int i=0; i<N; i++){
        cin >> D[i][0] >> D[i][1];
    }
    
    vector<int> check(N);
    for(int i=0; i<N; i++){
        if(D[i][0] == D[i][1]) check[i]=1;
        else check[i]=0;
    }
    
    int ans=0;
    for(int i=0; i<N-2; i++){
        if(check[i]*check[i+1]*check[i+2]==1) ans=1;
    }
    
    if(ans==0) cout << "No" << endl;
    else cout << "Yes" << endl;
    
    return 0;
}


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

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7;

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  vector<int> ac(N + 1, 0);
  for (int i = 1; i < N; ++i) {
    ac[i + 1] = ac[i];
    if (S[i - 1] == 'A' && S[i] == 'C') ac[i + 1]++;
  }
  for (int i = 0; i < Q; ++i) {
    int l, r;
    cin >> l >> r;
    cout << ac[r] - ac[l] << endl;
  }
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
    static int N;

    private static void init() {
        Scanner scanner = new Scanner(System.in);
        N = scanner.nextInt();
        int n = N;
        int sum = 0;

        while (0 < N) {
            sum += N % 10;
            N /= 10;
        }

        if(n % sum == 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

        scanner.close();
    }


    public static void main(String args[]) {
        init();
    }
}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";


    void Solve()
    {
        var K = cin.Nextlong;
        //long MAX = 10000000000000000;
        //long N = K / MAX + 1;
        //long T = K - K / MAX * MAX;

        /* WriteLine(N);
         for (int i = 0; i < N; i++)
         {
             if (i != 0) Write(" ");
             Write(T / N);
         }
         WriteLine();*/
        long N = 50;
        long A = (K + 2450) / 50;
        long D = (K + 2450) % 50;

        WriteLine(N);
        for (int i = 0; i < N; i++)
        {
            if (i != 0) Write(" ");
            if (i < D) Write(A + 1);
            else Write(A - D);
        }

        WriteLine();

    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 11216
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a > b) System.out.println("a > b");
    if(a == b) System.out.println("a == b");
    if(a < b) System.out.println("a < b");
    }
}



Measured memory_bytes: 26176
#include <stdio.h>
typedef long long int i64;
i64 n, a[1<<17], b[1<<17];
i64 solve(void) {
    i64 cnt = 0;
    for(i64 i = n - 1; i >= 0; i--) {
        i64 k = (a[i] + cnt) % b[i];
        cnt += k ? b[i] - k : 0;
    }
    return cnt;
}
int main(void) {
    scanf("%d", &n);
    for(i64 i = 0; i < n; i++)
        scanf("%lld%lld", &a[i], &b[i]);
    printf("%lld", solve());
    return 0;
}

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

int main(){
    while(1){
	int n;
	int max = 0, num = 0;
	cin >> n;
	if (n == 0) break;
	for (int i = 0; i < n; i++){
	    int p, d1, d2, d;
	    cin >> p >> d1 >> d2;
	    d = d1 + d2;
	    if (d > max){
		max = d;
		num = p;
	    }
	}
	cout << num << " " << max << endl;
    }
}

Measured memory_bytes: 0
n , k= map(int, input().split())
ab = []

for i in range(n):
    ab.append(list(map(int, input().split())))

ab = sorted(ab)

count = 0
for i in range(n):
    count += ab[i][1]
    if count >= k:
        print(ab[i][0])
        exit()





Measured memory_bytes: 28640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<tuple<string,int,int>> list(n);
    for(int i=1; i<n+1; i++){
        string a;
        int b;
        cin >> a >> b;

        list.at(i-1) = make_tuple(a,-b,i);
    }
        sort(list.begin(),list.end());
        
        for (auto t: list){
           cout << get<2>(t) << endl;
        }
    
}

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

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=m-1;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define INF 1000000001
#define MOD 1000000007

using namespace std;



int main() {
	vector<int> x,y,a;
	int w, h, n;
	cin >> w >> h >> n;
	REP(i, n) {
		int x1, y1, a1;
		cin >> x1 >> y1>> a1;
		x.push_back(x1);
		y.push_back(y1);
		a.push_back(a1);
	}
	int minx = 0, maxx = w, miny = 0,maxy = h;
	REP(i, n) {
		switch (a[i]) {
		case 1:
			if (minx < x[i]) minx = x[i];
			break;
		case 2:
			if (maxx > x[i]) maxx = x[i];
			break;
		case 3:
			if (miny < y[i]) miny = y[i];
			break;
		case 4:
			if (maxy > y[i]) maxy = y[i];
			break;
		}
	}
	int s = (maxx - minx)*(maxy - miny);
	if (maxx-minx<0||maxy-miny<0)cout << 0 << endl;
	else	cout <<s << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//typedef long long int ll;
using namespace std;
using ll = long long;
using ld = long double;
using Vc = vector <char>;
using Vs = vector <string>;
using Vll = vector <ll>;
using Vi = vector <int>;
using Sll = set <ll>;
using Ss = set <string>;
using Sc = set <char>;
using Si = set <int>;
using MiVi = map<int,Vi>;
using MllVll = map<ll,Vll>;
using Mllll = map<ll,ll>;
using Mii = map<int,int>;
using MllSll = map<ll,Sll>;
using Mlls = map<ll,string>;
using Pllll = pair<ll,ll>;
using Pii = pair<int,int>;
 
 
#define nl cout<<endl
#define ns cout<<" "
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
#define forAuto(i,x) for(auto i: x)
#define forRange(i,l,h) for(int i=l;i<h;i++)
#define all(x) x.begin(),x.end()
#define append push_back
 
 
template<class T>
T gcd(T a,T b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
      
}
ll bigmod(ll a, ll b, ll c)
{
    if(b==0) return 1;
    
    if(b%2==0)
    {
        ll x=bigmod(a,b/2,c);
        return (x*x)%c;
    }
    else return (a%c * bigmod(a,b-1,c))%c;
}
 
void vsInput()
{
    #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
    #endif // ONLINE_JUDGE
}
template<class T1,class T2>
T2 sum(T1 a,T2 ans){ans=0;forAuto(i,a)ans+=i;return ans;}
 
template<class T>
void printC(T a){forAuto(i,a)cout<<i<<" ";cout<<endl;}
 
template<class T1,class T2>
void printP(pair<T1,T2> i){cout<<"{"<<i.first<<",";cout<<i.second<<"} ";}
 
template<class T1,class T2>
void printG(map<T1,T2> a){forAuto(i,a){cout<<i.first<<" -> ";printC(i.second);}}
 
template<class T1,class T2>
void printWG(map<T1,T2> a){forAuto(i,a){cout<<i.first<<" -> ";forAuto(j,i.second)printP(j);nl;}}
 
void value() {}
template <class T1, class... T2>
void value(T1& var1, T2&... var2) { cin>>var1; value(var2...); }
 
void print() {}
template <class T1, class... T2>
constexpr void print(const T1& var1, const T2& ... var2) { cout<<var1;ns; print(var2...); }
 
 
template<class T1,class T2>
void printM(map<T1,T2> a){forAuto(i,a){cout<<i.first<<" -> ";cout<<i.second; nl;}}
 
Vll Vinput(ll n){Vll a;forRange(i,0,n){ll x;cin>>x;a.append(x);}return a;}
 
bool cmp(const ll &a, const ll &b)
{ return a<b; }
 
 
#define CPN 700007
#define M 1000000007
const int inf=1e18+5;
 
 
//----------------------------CODE----------------------------//
 





 
void code()
{
    ll n,w;
    cin>>n>>w;
    
    Vll value(n);
    Vll weight(n);
    
    forRange(i,0,n)
    cin>>weight[i]>>value[i];
    
    ll dp[n+1][w+1];
    memset(dp,0,sizeof(dp));
    
    forRange(i,1,n+1)
    forRange(j,1,w+1)
    {
        if(weight[i-1]>j)
            dp[i][j]=dp[i-1][j];
        else
            dp[i][j]=max(dp[i-1][j],dp[i-1][j-weight[i-1]]+value[i-1]);
        
    }
    
    print(dp[n][w]);
    
    
}
 
 
 
    
 
 
 
 
 
 
 
 
 
 
 
 
 
 
//--------------------------------END-----------------------------//
int main()
{
    //vsInput();
    
    fast;
    ll t=1;
    //cout << fixed << setprecision(10);
    
    //cin>>t;
    
    while(t) {
        t--;
        code();
    }
 
    return 0;
}


Measured memory_bytes: 82440
#include <iostream>
#include <algorithm>

int main ()
{
  int n;
  std::cin >> n;
  int R[200001];

  for(int j=0; j<n; ++j){
    std::cin >> R[j];
  }

  int maxv = R[1] - R[0];
  int minv = R[0];
  for(int j=1; j<=n-1; ++j){
    maxv = std::max(maxv, R[j]-minv); // 最大利益
    minv = std::min(minv, R[j]);
    //std::cout << maxv << std::endl;
  }

  std::cout << maxv << std::endl;

  return 0;
}



Measured memory_bytes: 3864
n,x,m=map(int,input().split())
ans=0
if n<=10**6:
    for i in range(n):
        ans+=x%m
        x*=x
        x%=m
    print(ans)
else:
    lis=[x]
    s={x}
    while 1:
        x*=x
        x%=m
        if x in s:
            num=x
            break
        lis.append(x)
        s.add(x)
    for i in range(len(lis)):
        if lis[i]==num:
            idx=i
    cnt=(n-idx)//(len(lis)-idx)
    idx2=(n-idx)%(len(lis)-idx)
    #print(lis)
    suma=0
    sumb=0
    for i in range(len(lis)):
        if i<idx:
            suma+=lis[i]
        else:
            sumb+=lis[i]
    ans+=suma+sumb*cnt
    for i in range(idx2):
        ans+=lis[idx+i]
    print(ans)

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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

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

    ll n = 1;
    int ans = 1;
    while (n * K <= N) {
        n *= K;
        ans++;
    }
    
    cout << ans << endl;
}

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

using namespace std;
typedef long long ll;
const ll MD = 1e9+7;

#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(a) a.begin(),a.end()
#define EACH(it,a) for(auto it=a.begin();it!=a.end();it++)


int main() {
	
	while(true){
		int n;cin >> n;if(n==0)break;
		vector<pair<int,int>> segs;//right,c

		segs.push_back(make_pair(0,-1));segs.push_back(make_pair(1e9+50,-1));
		vector<int> ls;
		ls.push_back(0);ls.push_back(1e9+50);

		REP(i,n){
			string s;cin >> s;
			if(s=="W"){
				int l,s;cin >> l >> s;
				
				for(int j=1;j<segs.size();j++)if(segs[j].second==-1){
					if(s<segs[j].first-segs[j-1].first){//set
						pair<int,int> p=make_pair(segs[j-1].first+s,l);
						segs.push_back(p);
						ls.push_back(p.first);
						sort(ALL(segs));sort(ALL(ls));break;
					}else{
						s-=segs[j].first-segs[j-1].first;
						segs[j].second=l;
					}
				}
			}else if(s=="D"){
				int l;cin >> l;
				REP(j,segs.size())if(segs[j].second==l){
					segs[j].second=-1;
				}
			}else{
				int p;cin >> p;
				
				int vi=upper_bound(ALL(ls),p)-ls.begin();
				cout << segs[vi].second <<endl;
			}
		}
		cout <<endl;
	}

}

Measured memory_bytes: 1340
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,i=0,i2=0;
while(1){
	cin >>b >>a;
	if (a==0 && b==0) break;
	for (i=0; i<b; i++){
		for (i2=0; i2<a; i2++){
		cout<<"#";
		}
	cout<<"\n";
	}
cout<<"\n";
};
return 0;
}


Measured memory_bytes: 3084
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 210000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
// long long C(int a,int b){
// 	if(a<b||b<0)return 0;
// 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
// }
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ

int main(){
	int a;scanf("%d",&a);
	if(a<1200)printf("ABC\n");
	else if(a<2800)printf("ARC\n");
	else printf("AGC\n");
}

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;

    string S;
    cin >> S;
    if(S[0]==S[1] or S[1]==S[2] or S[2]==S[3]) cout << "Bad" << endl;
    else cout << "Good" << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
const int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    string S;
    cin >> S;
    bool ans=false;
    rep(i,3) if(S[i]=='7') ans=true;
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3608
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N):
    if i == N-1:
        ans += B[A[i]-1]
    else:
        if A[i+1] - A[i] == 1:
            ans += C[A[i]-1]
        ans += B[A[i]-1]
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(1){
   if (x->left!=NIL){
    x=x->left;
    return x;
  }
   else{
     break;
   }
  }
}

Node treeMaximum(Node x){
  while(1){
   if (x->right!=NIL){
    x=x->right;
    return x;
  }
   else{
     break;
   }
  }
}

Node treeSearch(Node u, int k){
  while (u != NIL && k !=  u->key){
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

Node treeSuccessor(Node x){

}

void treeDelete(Node z){
  Node y; 
  Node x; 



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(1){
  if(x==NIL){
      break;
    }
    else{
      y=x;
      if(x->key < z->key){
    x=x->right;
      }
      else{
    x=x->left;
      }
    }
  }
  z->parent=y;
  if(y==NIL){
    root=z;
  }
  else{
  if(z->key < y->key){
    y->left=z;
  }
  else{
    y->right=z;
  }
  }
}

void inorder(Node u){
  if( u == NIL ) return ;
  inorder( u->left );
  printf(" %d",u->key);
  inorder( u->right );
}
void preorder(Node u){
  if( u == NIL ) return ;
  printf(" %d",u->key);

  preorder( u->left );
  preorder( u->right );
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}


Measured memory_bytes: 20548
#include <iostream>
#include <vector>
#include <cctype>
#include <string>
#include <cassert>
#include <algorithm>
using namespace std;
string S;
int cur = 0;
int number();
int parse();
int sen();
int main(){
  int n;cin >> n;
  for(int i = 0;i < n;i++){
    cur = 0;
    cin >> S;
    cout << parse() << endl;
  }
  return 0;
}
int parse(){
  assert(S[cur] == '[');
  cur++;
  int tmp =  sen();
  cur++;
  return tmp;
}

int sen(){
  int num;
  if(S[cur] >= '0' && S[cur] <= '9'){
    num = number();
    //cur++;
    return num/2+1;
  }
  assert(S[cur] == '[');
  vector<int> tmp;
  while(S[cur] == '['){
    tmp.push_back(parse());
  }
  sort(tmp.begin(),tmp.end());
  int s = tmp.size();
  int ans = 0;
  for(int i =0 ;i <= s/2;i++){
    ans += tmp[i];
  }
  return ans;
}
int number(){
  assert(isdigit(S[cur]));
  int num = 0;
  while(isdigit(S[cur])){
    num = num*10 + (S[cur]-'0');
    cur++;
  }
  return num;
}

Measured memory_bytes: 1276
#![allow(unused_imports)]
use num::Integer;
use proconio::*;
use std::collections::VecDeque;
use std::ops::*;

fn main() {
   input! {
      n: usize,
      k: usize
   }
   let mut ans = Mint::new(0);
   let mut dp = vec![Mint::new(0); k+1];
   for i in (1..=k).rev() {
      let mut val = Mint::new((k/i) as i64).pow(n);
      for j in 2..=k/i {
         val -= dp[i*j];
      }
      dp[i] = val;
      ans += Mint::from(i)*dp[i];
   }
   println!("{}", ans.x);
}

const MOD: i64 = 1000000007;
#[derive(Copy, Clone, Debug)]
struct Mint {
   x: i64,
}
impl Mint {
   fn new(x: i64) -> Self {
      Mint { x: x }
   }
   fn pow(self, n: usize) -> Self {
      let mut x = Mint::new(1);
      let mut r = self;
      let mut n = n;
      while n > 0 {
         if n & 1 == 1 {
            x *= r;
         }
         r *= r;
         n >>= 1;
      }
      x
   }
   fn inv(self) -> Self {
      self.pow((MOD - 2) as usize)
   }
}
impl AddAssign for Mint {
   fn add_assign(&mut self, rhs: Mint) {
      self.x += rhs.x;
      self.x %= MOD;
   }
}
impl Add for Mint {
   type Output = Mint;
   fn add(self, other: Mint) -> Self {
      let mut res = self;
      res += other;
      res
   }
}

impl SubAssign for Mint {
   fn sub_assign(&mut self, rhs: Mint) {
      self.x -= rhs.x;
      if self.x < 0 {
         self.x += MOD;
      }
   }
}
impl Sub for Mint {
   type Output = Mint;
   fn sub(self, other: Mint) -> Self {
      let mut res = self;
      res -= other;
      res
   }
}
impl MulAssign for Mint {
   fn mul_assign(&mut self, rhs: Mint) {
      self.x *= rhs.x;
      self.x %= MOD;
   }
}
impl Mul for Mint {
   type Output = Mint;
   fn mul(self, other: Mint) -> Self {
      let mut res = self;
      res *= other;
      res
   }
}
impl DivAssign for Mint {
   fn div_assign(&mut self, rhs: Mint) {
      *self *= rhs.inv();
   }
}
impl Div for Mint {
   type Output = Mint;
   fn div(self, other: Mint) -> Self {
      let mut res = self;
      res *= other;
      res
   }
}
impl From<i64> for Mint {
   fn from(num: i64) -> Self {
      Mint { x: num }
   }
}
impl From<i32> for Mint {
   fn from(num: i32) -> Self {
      Mint { x: num as i64 }
   }
}
impl From<usize> for Mint {
   fn from(num: usize) -> Self {
      Mint { x: num as i64 }
   }
}


Measured memory_bytes: 2800
#include <cmath>
#include <cstdio>

#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  string su, sl;
  cin >> su;
  cin >> sl;

  ll inf = 1000000007;

  ll cnt =1;
  ll istart;
  bool isBefTate;
  if(su[0]==sl[0]){
    cnt *= 3;
    isBefTate = true;
    istart =1;
  }
  else{
    cnt *= 6;
    isBefTate = false;
    istart = 2;
  }
  for (int i = istart; i < n; ++i) {
    if(su[i]==sl[i]){
      if(isBefTate) cnt*=2;
      isBefTate=true;
    }else{
      ++i;
      if (isBefTate) cnt *= 2;
      else cnt *= 3;
      isBefTate = false;
    }
    if(cnt>=inf) cnt =cnt % inf;
  }
  cout << cnt%inf << endl;

  return 0;
}

Measured memory_bytes: 256
S = input()

alphabet_list = [
    "a",
    "b",
    "c",
    "d",
    "e",
    "f",
    "g",
    "h",
    "i",
    "j",
    "k",
    "l",
    "m",
    "n",
    "o",
    "p",
    "q",
    "r",
    "s",
    "t",
    "u",
    "v",
    "w",
    "x",
    "y",
    "z",
    ]

for s in S:
    if s in alphabet_list:
        alphabet_list.remove(s)
if len(alphabet_list) == 0:
    print("None")
else:
    print(alphabet_list[0])

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){

int N;
cin >> N;

vector<int> A1(N), A2(N);
REP(i, N) cin >> A1.at(i);
REP(i, N) cin >> A2.at(i);

vector<int> sum1(N + 1), sum2(N + 1);
sum1.at(0) = 0;
sum2.at(0) = 0;
for(int i = 1; i < N + 1; i++){ 
     sum1.at(i) = sum1.at(i - 1) + A1.at(i - 1);
     sum2.at(i) = sum2.at(i - 1) + A2.at(i - 1);
}
// print(sum1.at(N));
int ans = 0;
for(int i = 1; i < N + 1; i++){ 
     ans = max(ans,sum1.at(i) + (sum2.at(N) - sum2.at(i - 1)));
}

print(ans);


}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>

#include<cmath>
#include<map>
#include<string>
#include<vector>
#include<algorithm> 

using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) std::cout << (j ? s1 : s2) << endl;
# define YES(j) std::cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define rep(n,i) for(i = 0 ; i < n ; i++)

int main()
{
    int x,y,z;cin >> x >> y >> z;
    p((x-z)/(y+z))
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		String a = "Good";
		for(i=1;i<s.length();i++) {
			if(s.charAt(i-1)==s.charAt(i)) {
				a = "Bad";
				break;
			}
		}
		System.out.println(a);
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
    #define all(x) (x).begin(), (x).end()
    typedef long long ll;
    #define MOD 1000000007
    using namespace std;
    ll gcd(ll a, ll b) {
        if(a < b)
            return gcd(b, a);
        ll r = 1;
        while(r != 0) {
            r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
    ll modpow(ll a, ll n, ll mod = MOD) {
        ll res = 1;
        while(n > 0) {
            if(n & 1)
                res = res * a % mod;
            a = a * a % mod;
            n >>= 1;
        }
        return res;
    }
    ll absll(ll a) {
        if ( a >= 0 ) return a;
        return -a;
    }
    ll sign(ll n) {
        if(n >= 0) {
            return 1;
        } else {
            return -1;
        }
    }
    int main() {
        int n;
        cin >> n;
        map<pair<ll, ll>, ll> cnt;
        for(int i = 0; i < n; i++) {
            ll a, b;
            cin >> a >> b;
            if(a == 0 && b == 0) {
                cnt[make_pair(0, 0)]++;
            } else if(a == 0 && b != 0) {
                cnt[make_pair(0, 1)]++;
            } else if(a != 0 && b == 0) {
                cnt[make_pair(1, 0)]++;
            } else {
                if ( a < 0 ) {
                    a *= -1;
                    b *= -1;
                }
                if ( a == 0 && b < 0 ) b *= -1;
                long long int g = gcd( a, b );
                a /= g;
                b /= g;
                cnt[ make_pair( a, b ) ]++;
            }
        }
        ll ans = 1;
        for(auto e : cnt) {
            if(e.second == 0) {
                continue;
            }
            if(e.first == make_pair(0LL, 0LL)) {
                continue;
            }
            pair<ll,ll> ort;
            if(e.first == make_pair(0LL, 1LL)) {
                ort = make_pair(1, 0);
            } else if(e.first == make_pair(1LL, 0LL)) {
                ort = make_pair(0, 1);
            } else {
                long long int ddx = e.first.second;
                long long int ddy = -e.first.first;
                if ( ddx < 0 ) {
                    ddx *= -1;
                    ddy *= -1;
                }
                if ( ddx == 0 && ddy < 0 ) ddy *= -1;
                ort = make_pair( ddx, ddy );
            }
            ans *= modpow(2, e.second) + modpow(2, cnt[ort]) - 1;
            ans %= MOD;
            cnt[ort] = 0;
            cnt[e.first] = 0;
        }
        cout << (cnt[make_pair(0, 0)] + ans - 1 + MOD) % MOD << endl;
    }

Measured memory_bytes: 28588
#include<iostream>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;

string f(ll n)
{
	if (n == 0) return"";
	n--;
	return f(n / 26) + string(1, 'a' + n % 26);
}

int main()
{
	ll n;
	cin >> n;
	cout << f(n);
}

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

int main(void){
    int a,b;
    char c;
    cin>>a>>b>>c;
    for(int i=0;i<b;i++){
        for(int j=0;j<a;j++){
            if(i==b/2&&j==a/2){cout<<c;continue;}
            if(i==0||i==b-1){
                if(j==0||j==a-1) cout<<"+";
                else cout<<"-";
            }else{
                if(j==0||j==a-1)cout<<"|";
                else cout<<".";
            }
        }    
        cout<<endl;
        
    }
}


Measured memory_bytes: 3060
#include<cstdio>
using namespace std;
int kugi[5010*5020/2];
int lim[5010];
int main(void)
{
	int i,j,n,m,wk;
	int a,b,x,cnt;
	
	lim[0]=2;
	for(i=1;i<5010;i++)	{
		lim[i]=lim[i-1]+i+2;
	}
	
	scanf("%d %d",&n,&m);
	for(i=0;i<n+3;i++)	{
		for(j=0;j<=i+1;j++)	{
			kugi[i+lim[i]+j]=0;
		}
	}
	for(i=0;i<m;i++)	{
		scanf("%d %d %d",&a,&b,&x);
		kugi[a+lim[a]+b]++;
		kugi[a+lim[a]+b+1]--;
		kugi[(a+x+1)+lim[a+x+1]+b]--;
		kugi[(a+x+2)+lim[a+x+2]+b+1]++;
		kugi[(a+x+1)+lim[a+x+1]+b+x+2]++;
		kugi[(a+x+2)+lim[a+x+2]+b+x+2]--;
	}
	
	for(i=1;i<n+3;i++)	{
		for(j=0;j<n+3;j++)	{
			kugi[(i+j)+lim[i+j]+j+2]+=kugi[(i+j-1)+lim[i+j-1]+j+1];
			if(i+j>=n+3) break;
		}
	}
	
	
	
	
	for(i=1;i<n+3;i++)	{
		for(j=i;j<n+3;j++)	{
			kugi[j+lim[j]+i]+=kugi[(j-1)+lim[j-1]+i];
		}
	}
	for(i=1;i<n+3;i++)	{
		for(j=1;j<=i+1;j++)	{
			kugi[i+lim[i]+j]+=kugi[i+lim[i]+j-1];
		}
	}

	cnt=0;
	for(i=1;i<=n;i++)	{
		for(j=1;j<=i;j++)	{
			if(kugi[i+lim[i]+j]>0)	cnt++;
		}
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 50020