akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<vector>
#include<math.h>
#include<algorithm>

using namespace std;
typedef long long ll ;

int main()
{
       ll n;
       cin>>n;
       vector<ll>a(n+1,0);
       for(ll i=1;i<=n;i++)
       {
           for(ll j=i;j<=n;j=j+i)
           {
               a[j]++;
           }
       }
       ll sum=0;
        for(ll i=1;i<=n;i++)
       {
           sum =sum+ i*(ll)a[i];
       }
       cout<<sum<<endl;
   
   return 0;
}

Measured memory_bytes: 81400
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextInt();
        long b = sc.nextInt();
        long c = sc.nextInt();
        long d = sc.nextInt();
        List<Long>str = new ArrayList<>();
        str.add(a*c);
        str.add(a*d);
        str.add(b*c);
        str.add(b*d);
        Collections.sort(str,Collections.reverseOrder());
        System.out.println(str.get(0));
    }
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    string S;
    cin >> S;
    bool ok = false;
    rep(i, 3) if (S[i] == '7') ok = true;
    puts(ok ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
ll const MOD=1000000007;

string S;
ll K;

int main(){
    cin>>S>>K;

    bool flag=true;
    rep(i,S.size()) flag&=(S[0]==S[i]);

    ll ans=0;
    if(flag){
        ans=K*S.size()/2;
        cout<<ans<<endl;
        return 0;
    }

    ll cnt=1;
    rep(i,S.size()-1){
        if(S[i]==S[i+1]) cnt++;
        else{
            ans+=cnt/2;
            cnt=1;
        }
    }
    ans+=cnt/2;
    ans*=K;
    
    if(S[0]==S[S.size()-1]){
        int l=0,r=0;
        rep(i,S.size()){
            if(S[i]==S[0]) l++;
            else break;
        }
        rep(i,S.size()){
            if(S[S.size()-1-i]==S[S.size()-1]) r++;
            else break;
        }
        ans+=(K-1)*((l+r)/2-l/2-r/2);
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long ul;
// #define int long long

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // 値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)  // 直後の要素をパディング
#define space_pad(num) setfill(' ') << std::right << setw(num)  // 直後の要素をパディング

// func declaration
template <class T> void print2DVec(vector< vector<T> >&);
template <class T> void calcVec(vector<T>&, int, char);
int char_to_int(const char);

// const
const int INF = 10000000;

/*MEMO
・辞書順
abc < abcd, atcoder < atlas
・イテレータ
std::vector<int>::iterator とタイプするのは面倒なので、
 通常は型推論の auto を使用する。
 auto iter = max_element(ALL(vec));
・2次元配列
vector<vector<int>> vec = {{1, 2, 3}, {4, 5, 6}}
・20×10の配列
vector<vector<int>> vec(20, vector<int>(10, 0));
・(n, m)の多次元配列
vector< vector<int> > vec(n, vector<int>(m, 0))  // 0で初期化
*/

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

    // input
    string str;
    
    // calculation
    for (int i = 0; i < 3; ++i) {
        cin >> str;
        cout << str.at(i);
    }
    cout << "\n";
    
    
    
    
    return 0;
}


// function
template <class T> void print2DVec(vector< vector<T> >& vec) {
    REP(i, vec.size()) {
        REP(j, vec.front().size()) {
            cout << vec.at(i).at(j);
        }
        cout << endl;
    }
}

template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    switch (ch) {
        case '+':
            REP(i, vec.size()) vec.at(i) += num; break;
        case '-':
            REP(i, vec.size()) vec.at(i) -= num; break;
        case '*':
            REP(i, vec.size()) vec.at(i) *= num; break;
        case '/':
            REP(i, vec.size()) vec.at(i) /= num; break;
        case '%':
            REP(i, vec.size()) vec.at(i) %= num; break;
        default:
            cout << "Incorrect Operator" << endl;
    }
}

int char_to_int(const char c) {
    if('0' <= c && c <= '9') return (c - '0');
    return -1;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define in freopen("input.txt", "r", stdin)
#define out freopen("output.txt", "w", stdout)  
#define rep(i,n) for(ll (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (ll (i)=(a); (i)<=(b); ++(i))
#define INF 0xFFFFFF
#define endl '\n'
#define pp printf("Case %d: \n",t)
const unsigned int mod = 1e9+7;
const int mx=1000005;
const int maxInt = 2147483647;

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll n;
    cin >> n;
    ll a[n];
    ll bir=0;
    ll iki=0;
    rep(i,n-1){
    	cin >> a[i];
    	if(i%2)iki+=a[i];
    	else bir+=a[i];
    }
    cin >> a[n-1];
    ll x=2*(iki-bir);
    ll ilk=((2*a[n-1])-x)/2;
    rep(i,n){
    	cout << ilk << " ";
    	ilk=2*a[i]-ilk;
    }
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

#ifdef MY_DEBUG_FLAG
template<typename T> void debug(T a) { cerr << a << ' '; }
template<typename T, typename U> void debug(pair<T, U> a) { cerr << a.first << ' ' << a.second << ' '; }
template<typename T> void debug(vector<T> a) { for(auto it : a) debug(it);}
template<typename T> void debug(set<T> a) { for(auto it : a) debug(it);}
#define db(a) cerr << "DEBUG ( " << #a << " == "; debug(a); cerr << ")\n"
#else
#define db(...)
#endif

#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false), cout.tie(nullptr), cin.tie(nullptr)
#define sz(a) ((int)(a).size())
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define dec(i,n,a) for(int i=(n); i>=(a); i--)
#define clr(a,v) memset(a, v, sizeof(a))
#define all(a) (a).begin(),(a).end()

constexpr int inf = 0x3f3f3f3f;
constexpr int MAXN = 110;
constexpr int MAXK = 1e5 + 10;
constexpr int mod = 1000000007;

int main() {
	int n, K; scanf("%d %d", &n, &K);
	vi a(n+1); rep(i,1,n+1) scanf("%d", &a[i]);
	
	vector<ll> dp(K+1), pref(K+1, 1);
	dp[0] = 1;

	for(int i = 1; i <= n; i++) {
		for(int j = 0; j <= K; j++) {
			// dp[i][j] gets the sum of the last a[i] values, because we can give
			// to that children any value between [0..a[i]]
			dp[j] = pref[j];
			if(j - a[i] - 1 >= 0) dp[j] -= pref[j - a[i] - 1];
			if(dp[j] < 0) dp[j] += mod;
		}

		pref[0] = dp[0];
		rep(j,1,K+1) pref[j] = (pref[j-1] + dp[j])%mod;
	}

	printf("%lld\n", dp[K]);
}


Measured memory_bytes: 4840
def checkMM(i):
    if i >= 1 and i <= 12:
        result = 1
    else:
        result = 0
    return result

def checkYY(i):
    if i >= 0 and i <= 99:
        result = 1
    else:
        result = 0
    return result


s = input()

s1 = int(s[:2])
s2 = int(s[2:])

result = 'NA'

if checkMM(s1) and checkYY(s2):
    result = 'MMYY'


if checkYY(s1) and checkMM(s2):
    if result == 'MMYY':
        result = 'AMBIGUOUS'
    else:
        result = 'YYMM'

print(result)

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

int main() {
  ll l, r;
  cin >> l >> r;
  ll ans = 2018;
  if (r - l >= 2 * 2019) {
    rep(i, 2019) rep(j, 2019) ans = min(ans, (ll)i * j % 2019);
  } else if (r - l >= 2019) {
    vector<int> cnt(2019, 0);
    for (ll i = l; i <= r; ++i) ++cnt[l % 2019];
    rep(i, 2019) rep(j, 2019) {
      if (i == j && cnt[i] == 1) continue;
      ans = min(ans, (ll)i * j % 2019);
    }
  } else {
    for (ll i = l; i <= r; ++i) {
      for (ll j = i + 1; j <= r; ++j) {
        ans = min(ans, i * j % 2019);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>

int main(){
	int req, a, b, c;
	scanf("%d",&req);

	for(;req--;){
	scanf("%d%d%d",&a,&b,&c);
	if((a*a+b*b==c*c)||(b*b+c*c==a*a)||(a*a+c*c==b*b))
		puts("YES");
	else
		puts("NO");
	}
}


Measured memory_bytes: 1916
s = input()

ans = 0
ans_l = []
k = 1
S = s[0:1]
sn = ""
while 1:
    if k >= len(s):
        break
    sn += s[k:k+1]
    if sn != S:
        ans_l.append(S)
        ans += 1
        S = sn
        sn = ""
    k +=1
  #  print(sn,S)
ans_l.append(S)
ans += 1
#print(ans_l)
print(ans) 

Measured memory_bytes: 54092
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>

using namespace std;

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

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

using namespace std;

typedef unsigned __int128 TYPE;
const int BASE=128;
TYPE HIGH=((TYPE)1)<<(BASE-1);
int N;
int A[100000];
TYPE B[(100000+BASE-1)/BASE+3];
char S[100000];

void orb(int n)
{
    for(int i=0; i*BASE<n; i++)
        B[i]|=(B[i]>>1)|((B[i+1]&1)<<(BASE-1));
}

void andb(int n)
{
    for(int i=0; i*BASE<n; i++)
        B[i]&=(B[i]>>1)|((B[i+1]&1)<<(BASE-1));
}

bool solve()
{
    for(int i=0; i<N-1; i++)
    {
        if(S[i]=='M')
            orb(N-i);
        else
            andb(N-i);
    }
    return B[0]&1;
}

int main()
{
    scanf("%d", &N);
    for(int i=0; i<N; i++)
        scanf("%d", A+i);
    scanf("%s", S);
    int lo=1, mid, hi=N;
    while(lo<hi)
    {
        mid=(lo+hi+1)/2;
        for(int i=0; i*BASE<N; i++)
            B[i]=0;
        for(int i=0; i<N; i++)
            B[i/BASE]|=((TYPE)(A[i]>=mid))<<(i%BASE);
        if(solve())
            lo=mid;
        else
            hi=mid-1;
    }
    printf("%d\n", lo);
    return 0;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using ll=long long;
using ld=long double;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;

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;}



int main(){
    int N, M; cin >> N >> M;
    vi A(N);
    for(auto &x : A) cin >> x;
    vi B(M), C(M);
    for(int i=0; i<M; i++){
        cin >> B[i] >> C[i];
    }

    priority_queue<pii, vector<pii>, less<pii>> pque;
    for(int i=0; i<N; i++){
        pque.push({A[i], 1});
    }
    for(int i=0; i<M; i++){
        pque.push({C[i], B[i]});
    }

    ll ans=0;
    int cnt=0;
    while(cnt != N){
        auto p=pque.top();
        pque.pop();
        ans+=(ll)p.first*min(N-cnt, p.second);
        cnt+=min(N-cnt, p.second);
    }
    cout << ans << endl;
    return 0;
}

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

int n;
int a[1000000];
ll get_h(ll m)
{
    ll res = 0;
    rep(i, n)
        res += abs(a[i] - m);
    return res;
}

int main()
{
    cin >> n;
    rep(i,n) cin >> a[i];
    rep(i,n) a[i] -= i + 1;

    int a_min, a_max;
    rep(i,n)
    {
        if (i == 0)
            a_min = a_max = a[0];
        else
        {
            a_min = min(a_min, a[i]);
            a_max = max(a_max, a[i]);
        }
    }

    while(a_max - a_min > 1)
    {
        int a13 = (a_max - a_min) / 3 + a_min;
        int a23 = (a_max - a_min) * 2 / 3 + a_min;

        ll h13 = get_h(a13);
        ll h23 = get_h(a23);

        if(h13 < h23)
            a_max = a23 - 1;
        else
            a_min = a13 + 1;
        // cout << a_min << ' ' << a_max << ' ' << h13 <<' ' << h23 << endl;

    }

    ll ans;
    if (a_max == a_min)
        ans = get_h(a_max);
    else
        ans = min(get_h(a_max), get_h(a_min));
    // cout << a_max << ' ' << a_min << ' ' << get_h(a_max) << endl;
    
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
class Graph{
    int V;
    map<int,list<int>> adjlist;
    map<int,bool> visited;
    public:
    Graph(int v)
    {
        V=v;
    }
    void addedge(int u,int v)
    {
        adjlist[u].push_back(v);
        adjlist[v].push_back(u);
    }
    void mark_visited(int n)
    {
        for(int i=0;i<n;i++)
        visited[i+1] = false;
    }
    void component(map<int,bool> &visited,int src)
    {
        queue<int> q;
        q.push(src);
        visited[src] = true;
        while(!q.empty())
        {
            int node = q.front();
            q.pop();
            for(auto val:adjlist[node])
            {
                if(visited[val] == false)
                {
                    q.push(val);
                    visited[val] = true;
                }
            }
        }
    }
    int allvisited(int n)
    {  int cnt = 0;
    mark_visited(n);
      for(int i=1;i<=n;i++)
    {
        if(visited[i]==false)
        {
            component(visited,i);
            cnt++;
        }
    }
    return cnt;
    }
};
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,x,y; cin>>n>>m;
    Graph g(n);
    for(int i=0;i<m;i++)
    {cin>>x>>y; g.addedge(x,y);}
    cout<<g.allvisited(n)-1;

    return 0;
}

Measured memory_bytes: 22408
use std::io::*;
use std::str::*;

fn read<T: FromStr>(s: &mut StdinLock) -> Option<T> {
    let s = s
        .by_ref()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let stdin = stdin();
    let x = read::<i32>(&mut stdin.lock()).unwrap();
    let a = read::<i32>(&mut stdin.lock()).unwrap();

    if x >= a {
        println!("10")
    } else {
        println!("0")
    }
}


Measured memory_bytes: 4352
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, Q = LI()
    edge, P, X = [], [], []
    ans = [0 for _ in range(N)]
    for _ in range(N-1):
        _a, _b = LI()
        edge.append((_a-1, _b-1))
    edge = sorted(edge, key=lambda x:x[0])
    for _ in range(Q):
        _p, _x = LI()
        ans[_p-1] += _x
    for i in range(N-1):
        a_nodenum = edge[i][0]
        b_nodenum = edge[i][1]
        ans[b_nodenum] += ans[a_nodenum]
    for i in ans:
        print(i, end=" ")
    print()
main()



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

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

using ll = long long;

void recalc_seat_cost(vector<vector<ll>>& seat_cost,vector<vector<bool>>& is_occupied, ll x, ll y){
    // assign seat_cost at (x,y) to the lowest cost of 4 neighbors
    const ll dx[] = {1,0,-1,0};
    const ll dy[] = {0,1,0,-1};
    ll cost = seat_cost[x][y];
    if(is_occupied[x][y]){
        for(int i=0; i<4; i++){
            if(cost+1 < seat_cost[x+dx[i]][y+dy[i]]){
                seat_cost[x+dx[i]][y+dy[i]] = cost+1;
                recalc_seat_cost(seat_cost, is_occupied, x+dx[i], y+dy[i]);
            }
        }
    }else{
        for(int i=0; i<4; i++){
            if(cost < seat_cost[x+dx[i]][y+dy[i]]){
                seat_cost[x+dx[i]][y+dy[i]] = cost;
                recalc_seat_cost(seat_cost, is_occupied, x+dx[i], y+dy[i]);
            }
        }
    }
}

int main(){
    ll n;
    cin >> n;
    vector<ll> p(n*n);
    for(int i=0; i<n*n; i++){
        cin >> p[i];
    }

    vector<vector<ll>> seat_cost(n+2,vector<ll>(n+2,0));
    vector<vector<bool>> is_occupied(n+2,vector<bool>(n+2,true));

    for(ll i=1; i<=(n+1)/2; i++){
        for(ll m=1; m<=(n+1)/2; m++){
            seat_cost[i][m]         = std::min(i-1,m-1);
            seat_cost[n-i+1][m]     = std::min(i-1,m-1);
            seat_cost[i][n-m+1]     = std::min(i-1,m-1);
            seat_cost[n-i+1][n-m+1] = std::min(i-1,m-1);
 
        }
    }
    for(int i=0; i<n+2; i++){
        is_occupied[i][0] = false;
        is_occupied[0][i] = false;
        is_occupied[i][n] = false;
        is_occupied[n][i] = false;
    }
    
    ll ans = 0;
    for(int i=0; i<n*n; i++){
        ll myself = p[i];
        ll myX = (myself-1) % n + 1;
        ll myY = (myself-1) / n + 1;

        ans += seat_cost[myX][myY];
        is_occupied[myX][myY] = false;

        // search for lowest costly route to outside
        recalc_seat_cost(seat_cost, is_occupied, myX, myY);
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 42068
#include<bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 32);
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#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;
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;
 
#define Endl endl
 
/*--------------------template--------------------*/
 
 
int main() {
    cin >> n >> m;
    for (int i = 0; i <= m / 10000;i++)
    {
        for (int j = 0; j <= (m - i * 10000) / 5000;j++)
        {
            ll a = (m - i * 10000 - j * 5000);
            if(a%1000==0&&a/1000+j+i==n){
                cout << i << " " << j << " " << a / 1000 << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#define REP(i, x, n) for(int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
using namespace std;
typedef long long int lli;
typedef pair<lli, lli> Pii;
const int INF = 10^9 +11555;
int main(){
    // vector
    // vc.push_buck(x)
    // sort(vc.begin(),vc.end())
    int n,q;
    string s;
    cin >> n;
    cin >>s;
    cin >> q;
    vector<set<int>> is(26);
    rep(i,n) is[s[i] - 'a'].insert(i);
    int temp[3];
    char temp2;
    int ans;
    rep(i,q){
        cin >> temp[0];
        if (temp[0] == 2){
            cin >> temp[1] >> temp[2];
            ans = 0;
            rep(j,26){
                auto it = is[j].lower_bound(temp[1]-1);
                if(it != is[j].end() && *it <= temp[2]-1) ans ++;
            }
            cout<< ans <<endl;
        }
        else{
            cin >> temp[1] >> temp2;
            temp[1]--;
            is[s[temp[1]] - 'a'].erase(temp[1]);
            s[temp[1]] = temp2;
            is[temp2 - 'a'].insert(temp[1]);
        }
    }
    return 0;
}

Measured memory_bytes: 24196
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

int main(){
    double r; cin >> r;
    cout << 2 * r * 3.141592 << endl;
}

Measured memory_bytes: 3784
a,b=map(int,input().split())
if b-a>=2019:
    print(0)
    exit()
d=[]
for i in range(a,b+1):
    if i%2019==0:
        print(0)
        exit()
    for j in range(a,b+1):
        if i<j:
            d.append((i*j)%2019)
print(min(d))

Measured memory_bytes: 204516
"""path = "/Users/hemmishinichi/PycharmProjects/AtCoder/ABC/ABC172/b08.txt"
with open(path) as f:
    l_strip = [s.strip() for s in f.readlines()]
    N, M, K = map(int, l_strip[0].split())
    A = [int(i) for i in l_strip[1].split()]
    B = [int(i) for i in l_strip[2].split()]
"""
N, M, K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

time = 0
num_A = 0

for i in range(N):
    if time + A[i] > K:
        break
    else:
        time += A[i]
        num_A += 1
ans = num_A

i = 0
while i < M:
    #print(ans)
    while i < M and time + B[i] <= K:
        time += B[i]
        i += 1
    ans = max(num_A+i, ans)
    if i == M-1:
        break
    elif num_A > 0:
        num_A -= 1
        time -= A[num_A]
    else:
        break

print(ans)



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

int main() {
  int64_t K;
  string S;
  cin>>S>>K;
  int64_t N=S.size(),Z=0,P=1;
  vector<int> p;
  for(int i=1;i<N;i++){
    if(S.at(i-1)==S.at(i)){
      P++;
    }
    else{
      p.push_back(P);
      P=1;
    }
  }
  p.push_back(P);
  if(p.size()==1){
    Z+=N*K/2;
  }
  else if(S.at(0)==S.at(N-1)){
    for(int i=1;i<p.size()-1;i++){
      Z+=p.at(i)/2*K;
    }
    Z+=p.at(0)/2+p.at(p.size()-1)/2;
    Z+=((p.at(0)+p.at(p.size()-1))/2)*(K-1);
  }
  else{
    for(int i=0;i<p.size();i++){
      Z+=p.at(i)/2*K;
    }
  }
  cout<<Z<<endl;
}




Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

class Main {
    public static void main(final String[] args) throws Exception {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            List<String> firstRow = Arrays.asList(br.readLine().split(" "));

            int cityCount = Integer.parseInt(firstRow.get(0));
            int pathCount = Integer.parseInt(firstRow.get(1));

            List<Integer> pathList = new ArrayList<>();
            for (int i = 0; i < pathCount; i++) {
                List<String> inputRow = Arrays.asList(br.readLine().split(" "));
                pathList.add(Integer.parseInt(inputRow.get(0)));
                pathList.add(Integer.parseInt(inputRow.get(1)));
            }

            List<Integer> ansList = new ArrayList<>();
            for (int i = 1; i <= cityCount; i++) {
                ansList.add(0);
                for (int j = 0; j < pathList.size(); j++) {
                    if (i == pathList.get(j)) {
                        ansList.set(i - 1, ansList.get(i - 1) + 1);
                    }
                }
            }

            for (int i = 0; i < ansList.size(); i++) {
                System.out.println(ansList.get(i));
            }
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
        using namespace std;
         
        int main() {
          		unsigned long long N;
          int M;
          cin >> N >> M;
          long long A;
          unsigned long long sum = 0;
          for (int i= 0;i<M;++i){
            cin >> A;
            sum += A;
          }
          if(N < sum){
            cout << "-1";
          }else{ 
            cout << N-sum;
           }
        }

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using intl = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define repd(i, n) for(intl i = (intl)(n); i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define repid(i, a, b) for(intl i = (intl)(a); i >= (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin,(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define int intl
#define itn intl
#define double ld
#define pb push_back
#define mp make_pair
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld eps = 1.0e-14;//-9
void fp(bool flag){
    if(flag)cout << "Yes" << endl;
    else cout << "No" << endl;
}
void fp(bool flag, string s, string t){
    if(flag)cout << s << endl;
    else cout << t << endl;
}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl digit10(intl a){
    if(!a)return 1;
    intl b = 0;
    while(a){
        a /= 10;
        b++;
    }
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    bool a,b;
    char c;
    cin >> c;
    a = (c == 'H');
    cin >> c;
    b = (c == 'H');
    char d[2] = {'D','H'};
    if(b)cout << d[a] << endl;
    else cout << d[!a] << endl;
    return 0;
}

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

using namespace std;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
#define pb push_back
#define ll long long
#define lson node<<1
#define rson (node<<1)+1

const int maxn=1e4+10;
const ll mod=1e9+7;
const double pi=acos(-1);

ll s[maxn];
int main()
{
    for(ll x=1; x*x<maxn; x++)
        for(ll y=1; y*y+x*x<maxn; y++)
            for(ll z=1; z*z+x*x+y*y<maxn; z++)
                if(z*z+x*x+y*y+z*x+z*y+x*y<maxn)
                {
                    ll k=z*z+x*x+y*y+z*x+z*y+x*y;
                    s[k]++;
                }
    int n;
    cin>>n;
    for(int i=1; i<=n; i++)
        printf("%lld\n",s[i]);
    return 0;
}



Measured memory_bytes: 3724
n, k = gets.split.map(&:to_i)
dests = gets.split.map{|it| it.to_i - 1}

visit_index = {}
curr = 0
roop_size = 0
roop_starts_at = 0
n.times{|i|
    visit_index[curr] = i
    if visit_index.has_key?(dests[curr])
        roop_size = i - visit_index[dests[curr]] + 1
        roop_starts_at = visit_index[dests[curr]]
        break
    end
    curr = dests[curr]
}
if k > roop_starts_at
    k = (k - roop_starts_at) % roop_size + roop_starts_at
end
curr = 0
k.times{|i|
    curr = dests[curr]
}
puts curr + 1


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

int x=200000,y=0,i;
string a;


int main(){
    cin>>a;
    for(i=0;i<=a.length()-1;i++){
        if(a[i]=='A'&&i<=x){
            x=i;
        }
    }
    for(i=0;i<=a.length()-1;i++){
        if(a[i]=='Z'&&i>=y){
            y=i;
        }
    }
    cout<<y-x+1;
}

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

int mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<bool>> map(N, vector<bool>(N, false));
    for (int i = 0; i < M; i++)
    {
        int p, q;
        cin >> p >> q;
        p--, q--;
        map[p][q] = true, map[q][p] = true;
    }

    vector<int> list;
    for (int i = 1; i < N; i++)
        list.push_back(i);

    int ans = 0;
    do
    {
        auto tmp = list;
        tmp.push_back(0);
        bool x = true;
        for (int i = 0; i < N - 1; i++)
            if (!map[tmp[i]][tmp[i + 1]])
                x = false;

        if(x)
            ans++;
    } while (next_permutation(list.begin(), list.end()));
    cout << ans;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
int N, M;
	cin >> N >> M;
	ce(N*(N-1)/2+M*(M-1)/2)

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 300050
#define ll long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
#define ll long long
#define SIZE N
using namespace std;
int n,m,ar[N];
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for(int i=0;i<n;i++)
        cin>>ar[i];
    sort(ar,ar+n);
    reverse(ar,ar+n);
    int sum = 0;
    for(int i=0;i<n;i++)
        sum += ar[i];
    int req = sum/(4*m);
    if(sum%(4*m)==0)req--;
  	
    if(ar[m-1]>req)cout<<"Yes";
    else cout<<"No";
    
        return 0;
}


Measured memory_bytes: 256
"""
尺取り方で行ける。
"""

from itertools import accumulate
N = int(input())
A = [0]+list(map(int,input().split()))
accumA = list(accumulate(A))
r = 1
tmp = 0
ans = 0
for l in range(1,N+1):
    while r <= N:
        if tmp^A[r] == accumA[r]-accumA[l-1]:
            tmp ^= A[r]
            r += 1
        else:
            tmp -= A[l]
            ans += r-l
            break
    else:
        tmp -= A[l]
        ans += r-l
print(ans)

Measured memory_bytes: 103120
#include<cstdio>
using namespace std;
int main(){
    while(1){
        int a,b;
        scanf("%d%d",&a,&b);
        if(a == 0 && b == 0) break;
        int sum = b - a;
        int x,y,z;
        x = sum/1000;
        y = (sum%1000)/500;
        z = (sum%500)/100;
        printf("%d %d %d\n",z,y,x);
    }

    return 0;
}

Measured memory_bytes: 1028
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#define mem(i,a) memset(i,a,sizeof(i))
#define PI acos(-1.0)
#define DMAX 100005
#define MOD 20190823
#define eps 1e-8
#define mp make_pair
#define INF 1000000000+9
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
template<class T> inline void read(T &f){
	f=0;
    T x=1;
    char ch=getchar();
    while(ch<48 || ch>57) {
        if(ch=='-') {
            x=-1;
        }
        ch=getchar();
    }
    while(ch<=57 && ch>=48) {
        f=f*10+ch-'0';
        ch=getchar();
    }
    f*=x;
}
ll n;
string s;
string base;
string ans;
int main(){
	read(n);
	cin>>s;
	for(ll i=65;i<=90;i++){
		base=base+char(i);
	}
	for(ll i=65;i<=90;i++){
		base=base+char(i);
	}
	for(ll i=0;i<s.size();i++){
		s[i]=base[ll(s[i])-65+n];
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
sys.setrecursionlimit(10**7)


def BFS(s):
    color=["white" for _ in range(n)]
    D=[float("inf") for _ in range(n)]

    color[s]="gray"
    D[s]=0
    queue=deque([s])

    while len(queue)!=0:
        u=queue.popleft()
        for i,j in M[u]:
            if color[i]=="white":
                queue.append(i)
                color[i]="gray"
                D[i]=D[u]+j
        color[u]="black"

    return max(enumerate(D), key=lambda x:x[1])


n=int(input())
M=[[] for _ in range(n)]
for i in range(n-1):
    s,t,w=map(int,input().split())
    M[s].append((t,w))
    M[t].append((s,w))

add,ans=BFS(0)
print(max(ans,BFS(add)[1]))


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

int main(){
    int x, n, i, k, j, p;
    while(1){
        p = 0;
        cin >> n >> x;
        if(n == 0){
            break;
        }
        for(i = 1; i < n; i++){
            for(j = i + 1; j < n; j++){
                for(k = j + 1; k <= n; k++){
                    if(i + j + k == x){
                        p++;
                    }
                }
            }
        }
        cout << p << endl;
    }
}


Measured memory_bytes: 3036
import numpy as np

H, W = map(int,input().split())
S = [list(input()) for _ in range(H)]
S = np.array(S)
S = (S == '.') * 1

R = np.array([[0 for i in range(W)] for n in range(H)])
L = np.zeros((H, W), dtype=int)
U = np.zeros((H, W), dtype=int)
D = np.zeros((H, W), dtype=int)

for i in range(W):
    if i == 0:
        L[:, 0] = S[:, 0]
        R[:, W - 1] = S[:, W - 1]
    else:
        L[:, i] = L[:, i - 1] * S[:, i] + S[:, i]
        R[:, W - i - 1] = R[:, W - i] * S[:, W - i - 1] + S[:, W - i - 1]
for i in range(H):
    if i == 0:
        U[i] = S[i]
        D[H - 1] = S[H - 1]
    else:
        U[i] = U[i - 1] * S[i] + S[i]
        D[H - i - 1] = D[H - i] * S[H - i - 1] + S[H - i - 1]

print(np.max(R + L + U + D) - 3)

Measured memory_bytes: 263496
#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, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;

ll cost[10][10];
ll cnt[10];
int main() {
    cin >> H >> W;
    rep(i, 10){
        rep(j, 10){
            cin >> cost[i][j];
        }
    }
    rep(i, 10){
        cnt[i] = 0;
    }
    rep(i, H){
        rep(j, W){
            cin >> A;
            if(A != -1) cnt[A]++;
        }
    }
    rep(k, 10){
        rep(i, 10){
            rep(j, 10){
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
    }
    ll sum = 0;
    rep(i, 10){
        sum += cnt[i]*cost[i][1];
    }
    cout << sum;
}


Measured memory_bytes: 256
#[macro_use]
mod utils {
    macro_rules! input {
        ($($r:tt)*) => {
            let stdin = std::io::stdin();
            let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
            let mut next = move || -> String{
                bytes
                    .by_ref()
                    .map(|r|r.unwrap() as char)
                    .skip_while(|c|c.is_whitespace())
                    .take_while(|c|!c.is_whitespace())
                    .collect()
            };
            input_inner!{next, $($r)*}
        };
    }
    macro_rules! input_inner {
        ($next:expr) => {};
        ($iter:expr, ) => {};
 
        ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
            let $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
        ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
            let mut $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
    }
    macro_rules! read_value {
        ($next:expr, ( $($t:tt),* )) => {
            ( $(read_value!($next, $t)),* )
        };
        ($next:expr, [ $t:tt ; $len:expr ]) => {
            (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        };
        ($next:expr, chars) => {
            read_value!($next, String).chars().collect::<Vec<char>>()
        };
        ($next:expr, usize1) => {
            read_value!($next, usize) - 1
        };
        ($next:expr, $t:ty) => {
            $next().parse::<$t>().expect("Parse error")
        };
    }
}


fn main(){
    input!{
        s: i32,
    }
    if s % 2 == 0 {
        println!("{}", s / 2);
    }else {
        println!("{}", (s / 2) + 1);
    }

}

Measured memory_bytes: 4352
N = int(input())
S = input()

def main():
    s = list(S)
    ans = 0
    for i in range(N):
        x = s[:i]
        y = s[i:]
        intersection = set(x) & set(y)
        ans = max(ans, len(intersection))
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.trim().split_whitespace();
    let n: i64 = iter.next().unwrap().parse().unwrap();
    let s = n / 7 + 1;
    let f = n / 4 + 1;
    let mut ans = 0;
    for number_s in 0..s {
        for number_f in 0..f {
            if 7 * number_s + 4 * number_f == n {
                ans += 1;
            }
        }
    }

    if ans >= 1 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <tuple>
#include <cmath>
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;

#define rep(i, m) for(ll i=0;i<(m);i++)
#define rep1(i, m) for(ll i=1;i<=(m);i++)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

ll N;
ll A[310][310];
ll d[310][310];
const ll INF = 10000000039LL;
int main() {
   cin >> N;
   rep(i, N) {
      rep(j, N) {
         cin >> A[i][j];
         d[i][j] = INF;
         d[i][j] = A[i][j];
      }
   }
   rep(i, N) {
      rep(j, N) {
         rep(k, N) {
            d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
         }
      }
   }
   bool isrealizible = true;
   rep(i, N) {
      rep(j, N) {
         isrealizible &= (d[i][j] >= A[i][j]);
      }
   }
   if (!isrealizible) {
      cout << -1 << endl;
      return 0;
   }
   ll ans = 0;
   rep(i, N) {
      for (int j=i+1;j<N;j++) {
         bool canRemove = false;
         rep(k, N) {
            if (i == k || j == k) continue;
            if (d[i][j] == d[i][k] + d[k][j]) {
               canRemove = true; break;
            }
         }
         if (!canRemove) ans += A[i][j];
      }
   }
   cout << ans << endl;
}

Measured memory_bytes: 1664
#include<iostream>

#include<cmath>
#include<string>
#include <algorithm> 

using namespace std;

# define p(s) cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) cout << (j ? "Yes" : "No") << endl;

string lpad(string l,int s,int n){
    string temp = to_string(n);
    string res = "";
    int loop = s - temp.size();
    while(loop--) res+=l;

    return res+temp;
}

int main()
{
    int a,b;
    cin >> a >> b ;

    Yes((a*b)%2!=0)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<(S)<<endl
#define ck(a,b) (0<=(a)&&(a)<b)
using namespace std;

int main(){
	int t,N;
	int dx[6]={1,1,0,-1,-1,0};
	int dy[6]={0,1,1,0,-1,-1};
	while(cin>>t>>N && (t!=0||N!=0)){
		int visited[121][121]={0};
		int tx,ty,ans=0;
		queue<pair<int,int>> q;
		REP(i,0,N){
			cin>>tx>>ty;
			visited[ty+60][tx+60]=-1;
		}
		int sx,sy;
		cin>>sx>>sy;
		q.push({sx+60,sy+60});
		visited[sy+60][sx+60]=1;
		while(!q.empty()){
			int nowx=q.front().first,nowy=q.front().second;
			q.pop();
			REP(k,0,6){
				int nextx=nowx+dx[k],nexty=nowy+dy[k];
				if(visited[nexty][nextx]==-1||visited[nexty][nextx]!=0) continue;
				visited[nexty][nextx]=visited[nowy][nowx]+1;
				if(visited[nexty][nextx]<=t)		q.push({nextx,nexty});
			}
		}
		REP(i,0,121)	REP(j,0,121)	if(visited[i][j]>0)	ans++;

		p(ans);
	}
	return 0;
}

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

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

	for (int i = 0; i < str.size(); i++) {
		for (int j = i + 1; j < str.size(); j++) {
			if (str[i] == str[j]) {
				cout << "no" << endl;
				return 0;
			}
		}
	}
	cout << "yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
   int i, x;
   for(i=0; i<10000; i++){
       scanf("%d", &x);
       if(x==0){
           break;
       }
       printf("Case %d: %d\n", i+1, x);
   }
   return 0;
    
}


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

int main()
{   int n,k,x,y,sum;
    scanf("%d",&n);
    scanf("%d",&k);
    scanf("%d",&x);
    scanf("%d",&y);
    if(n<=k)
        sum=n*x;
    else
        sum=k*x+(n-k)*y;
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
	vector<int> vec(3); int num; cin >> num;
	for (int i = 0; i < num; i++) {
		for (int j = 0; j < 3; j++) { cin >> vec[j]; }
		sort(vec.begin(), vec.end());
		if (pow(vec[0], 2) + pow(vec[1], 2) == pow(vec[2], 2)) {
			cout << "YES" << endl;
		}
		else { cout << "NO" << endl; }
	}
	return 0;
}


Measured memory_bytes: 3112
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*pi*/double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll i,fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=0,i=0;while(n/10>0){i++;d++;}return d;}
llfor;ll ans=0;////////////////////////////////////////////////////////////
int main(){
 string s,t;
 cin>>s>>t;
 cout<<t<<s<<endl;
 return 0;}

Measured memory_bytes: 3600
#include "bits/stdc++.h"
using namespace std;
int main(){
        int n;
        cin >> n;
        int cnt = 0;
        if(n == 1)
        cout << 1 << endl;
        else{
        while(n != 1){
            n /= 2;
            cnt ++;
        }
        int ans = 1;
        for(int i = 0; i < cnt; i++){
            ans *= 2;
        }
        cout << ans << endl;
        }
    return 0;
}


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

using namespace std;


int main(int argc, char const *argv[])
{
	int R;
	cin>>R;
	if(R < 1200)
		cout<< "ABC";
	else if( R < 2800)
		cout<< "ARC";
	else
		cout<< "AGC";
	
	return 0;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {
	
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	printf("%d\n", min(c, b / a));
	
	Please AC;
}


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

using namespace std;

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

#define int ll

main(){
	int h,w,n;

	cin >> h >> w >> n;

	int d = max(h,w);

	if(n%d==0){
		cout << n / d << endl;
	}else{
		cout << n/d + 1 << endl;
	}

	return 0;
}

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

int main() {
 int X;
 cin >> X;
 vector<bool> vec(X+1);
 vec.at(1) = 1;
  int Y  = 1;
  for(int b = 2;b<40;b++){
    Y = b;
    while(Y<=X){
    Y *= b;
    if(Y <= X) vec.at(Y) = 1;
    }
  }
  for(int i = X;i>0;i--){
    if(vec.at(i) == 1){
      cout << i <<endl;
      break;
    }
  }
}


Measured memory_bytes: 256
s = input()
n = len(s)
flag = True
for i in range(n):
    if s[i] != s[n-i-1]:
        flag = False

n2 = (n - 1) // 2
for i in range(n2):
    if s[i] != s[n2-i-1]:
        flag = False

n3 = (n + 3) // 2 - 1

for i in range(n3,n):
    if s[i] != s[n-i-1]:
        flag = False

if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38384