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

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

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

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

int main(){
    string S,T;cin>>S>>T;
    int ans=0;
    for(int i=0;i<3;i++){
        if(S[i]==T[i])ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<long long> vl;
typedef vector<vector<ll>> vll;
typedef vector<bool> vb;
typedef set<int> si; 
typedef queue<int> qi;
typedef stack<int> sti;
typedef priority_queue<int> pqi;
#define fori(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,b,a) for(int i = (b); i >= (a); --i)
#define all(a) (a).begin(), (a).end()
//#define __builtin_popcountll bitCountLL
//#define __builtin_popcount bitCount
//__builtin_ctz 末尾0的个数, __builtin_clz 前导0的个数
//__builtin_ffs 最后一个1的位置
mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());
//std::uniform_int_distribution<long long> rg(1,1e18);
#define maxn 100005
#define Mod 1000000007
const int INF = 2e9;
const ll ML = 4e18;
vi edges[maxn];
void dfs(int i, vi& vis) {
    vis[i] = 1;
    for(int j: edges[i]) {
        if(!vis[j]) dfs(j, vis);
    }
}
void solve() {
    int n, m;
    cin >> n >> m;
    fori(i,0,m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    int ans = -1;
    vi vis(n, 0 );
    fori(i,0,n) {
        if(!vis[i]) {
            dfs(i,vis);
            ans++;
        }
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	//cout.precision(30); cout << fixed;
	//freopen("D:\\data_in.txt", "r", stdin);
   
    solve();
   
    /*
    clock_t start,finish;
    start = clock();
    
    finish = clock();
    cout << "\n" << (double)(finish - start) / (double)(CLOCKS_PER_SEC) * 1000 << "ms" << endl;
    */
    return 0;
}

/***************************************************************
 question:
 idea:
 tag:
 record:
 ***************************************************************/


Measured memory_bytes: 9584
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;

int main(){
  int N, input, ans;
  cin >> N;
  map<int, int> m;
  ans = 0;
  for(int i = 0; i < N; i++){
    cin >> input;
    m[input-1]++;
    m[input]++;
    m[input+1]++;
    ans = max(m[input-1], ans);
    ans = max(m[input], ans);
    ans = max(m[input+1], ans);
  }
  cout << ans << endl;
  
  return 0;
}

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

using namespace std;
int main(){
	
	int k,a,b;
	cin>>k>>a>>b;
	
	int rem=a/k;
	if((rem+1)*k<=b||a%k==0||b%k==0)
	 cout<<"OK";
	else
	cout<<"NG";

return 0;	 
}


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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  LL h, w;
  scanf("%lld %lld", &h, &w);

  LL ans = min(h, w);
  LL x, y;
  if (h % 3 == 0 || w % 3 == 0) ans = 0;
  else {
    REP (i, 4) {
      if (i < 2) {
        x = h;
        y = w;
      } else {
        x = w;
        y = h;
      }
      LL d = x / 3;
      if (i % 2 == 0) d += 1;
      LL a = max({d * y, (x - d) * (y / 2), (x - d) * (y - y / 2)}) - min({d * y, (x - d) * (y / 2), (x - d) * (y - y / 2)});
      ans = min(ans, a);
    }
  }
  cout << ans << endl;
}


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

int calc0(string s){
    int res=0,n=s.size(),now=1;
    for (int i=0;i<n;i+=2){
        now*=s[i]-'0';
        if (i==n-1||s[i+1]=='+'){
            res+=now; now=1;
        }
    }
    return res;
}

int calc1(string s){
    int res=0,n=s.size();
    for (int i=0;i<n;i+=2){
        if (i&&s[i-1]=='*') res*=s[i]-'0';
        else res+=s[i]-'0';
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; int n; cin >> S >> n;
    int a=calc0(S),b=calc1(S);
    int m=(a==n?1:0)+(b==n?2:0);
    string result="IMLU";
    cout << result[m] << '\n';
}


Measured memory_bytes: 3252
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>
// #include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
// using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

typedef vector<int> vec;
typedef vector<vec> mat;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}



int main(void) {
    int N, M; cin >> N >> M;
    string S; cin >> S;
    reverse(S.begin(), S.end());
    int crt = 0;
    int next = crt;
    vector<int> ans;
    for (int i = 0; i <= N; i++) {
        if (S[i] == '0') {
            next = i;
        }
        if (i - crt == M || i == N) {
            if (next == crt) {
                ans.push_back(-1);
                break;
            } else {
                ans.push_back(next - crt);
                crt = next;
            }
        }
    }
    reverse(ans.begin(), ans.end());
    if (ans[0] == -1) {
        cout << -1 << endl;
    } else {
        for (auto i : ans) {
            cout << i << " ";
        }
        cout << endl;
    }
}

Measured memory_bytes: 1080
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int d = scanner.nextInt();
        int x = scanner.nextInt();
        int[] aList = new int[n];
        int consumedNum = 0;
        for (int i = 0; i < n; i++) {
            aList[i] = scanner.nextInt();
        }

        for (int i = 0; i < n; i++) {
            int counter = 0;
            while(true){
               if(aList[i] * counter + 1 > d){
                   break;
               }
               consumedNum++;
               counter++;
            }
        }
        System.out.println(consumedNum + x);
    }
}


Measured memory_bytes: 21844
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a_pre = -1
ans = 0
for ai in a:
    ans += b[ai - 1]
    if ai == a_pre + 1:
        ans += c[a_pre - 1]
    a_pre = ai
print(ans)


Measured memory_bytes: 3060
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main(A, K):
    l, r = 0, 1 << 30

    def test(x):
        return np.sum((A + x - 1) // x - 1) <= K

    while l + 1 < r:
        m = (l + r) // 2
        if test(m):
            r = m
        else:
            l = m
    return r

N, K = map(int, readline().split())
A = np.array(read().split(), np.int64)

print(main(A, K))

Measured memory_bytes: 39968
// https://beta.atcoder.jp/contests/agc029/submissions/3795448

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int n = s.length();
        String[] ss = new String[n];
        int a = 0;
        long b = 0;

        for (int i = 0; i < n; i++) {
            ss[i] = s.substring(i, i + 1);
        }

        for (int j = 0; j < n; j++) {
            if ("W".equals(ss[j])) {
                a ++;
                b = b + (j + 1);
            }
        }
       

        long wa = 0;
        for (int k = 0; k <= a; k++) {
            wa = wa + k;
        }
        
        System.out.println(b - wa);
    }

}


Measured memory_bytes: 37260
#include<iostream>
using namespace std ;
int main ()
{
    int n,x,f=0,s=0,arr[200005];
    cin >> n ;
    for(int i=0;i<n;i++)
    {
        cin >> x ;
        arr[i]=x;
        if(x>=f)
        {
            s=f;
            f=x;
        }
        else if (x>s)
        {
            s=x;
        }
    }
    //cout << f << " " << s << endl;
    for(int j=0;j<n;j++)
    {
        if(arr[j]==f){cout << s << endl;}
        else{cout << f << endl;}
    }
}


Measured memory_bytes: 2432
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <list>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define sz(x) int(x.size())

typedef long long ll;

using namespace std;

/*******-c++14 don't include-*******/
template<typename T>
T gcd(T a, T b){if( b == 0)return a; return gcd(b, a%b); }
template<typename T>
T lcm(T a, T b){return a*b/gcd(a,b); }
void printArr(int *a, int len){for(int i=0; i<len; i++){if(i)cout << " ";cout << a[i];}cout << endl;}
/*******---------------------*******/

static const int INTINF = (2147483647);
static const ll LLINF = (1ll<<32);
static const int MAX = 100001;

int arr[MAX];
int m[MAX];
int res[MAX];

int main(int argc, const char * argv[]) {
    // input from txt
    /////////
    //write//
    /////////
    
    int n, q;
    cin >> n;
    rep(i, n){
        cin >> arr[i];
    }
    cin >> q;
    rep(i, q){
        cin >> m[i];
    }
    
    
    fill(res, res+MAX, 0);
    res[0] = 1;
    rep2(i, 0, n){
        int tmp = arr[i];
        for(int j=MAX; j>=0; j--){
            if(res[j]){
                res[j+tmp] = 1;
            }
        }
    }
    rep(j, q){
        if(res[m[j]]){
            cout << "yes" << endl;
        }
        else{
            cout << "no" << endl;
        }
    }
    
    
    return 0;
}



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

int main(){
  int h,w; cin >> h >> w;
  std::vector<string> a(h);
  for (int i = 0; i < h; i++) {
    std::cin >> a[i];
  }

  //出力してokな行と列を決定するパート
  std::vector<bool> row(h,false),column(w,false);
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (a[i][j] == '#') {
        row[i] = true; column[j] = true;//一個でも#があれば出力ok
      }
    }
  }

  //出力してokかどうかを判定しつつ出力するパート
  for (int i = 0; i < h; i++) {
    if (row[i]) {//ここは出力してokな行ですか？を判定
      for (int j = 0; j < w; j++) {
        if (column[j]) {//ここは出力してokな列ですか？を判定
          std::cout << a[i][j];
        }
      }
      std::cout << '\n';
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;


int main(void){
  int n,k,i;
  string s;
  
  cin >> n >> s >> k;
  
  for (i=0;i<n;i++){
    if (s[i]!=s[k-1]) s[i]='*';
  }
  
  cout << s << endl;
  
  return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
w = [int(input()) for _ in range(n)]

def check(p):
    i = 0
    for _ in range(k):
        s = 0
        while s + w[i] <= p:
            s += w[i]
            i += 1
            if i == n:
                return True
    return False

ng, ok = 0, 10**9
while ok-ng > 1:
    mid = (ng+ok)//2
    if check(mid):
        ok = mid
    else:
        ng = mid
print(ok)


Measured memory_bytes: 9560
#include<stdio.h>
int main(void){
int n,i;
  int no=0;
  scanf("%d", &n);
  int a[n];
  for(i=0;i<n;i++){
  scanf("%d", &a[i]);
  }
for(i=0;i<n;i++){
if(a[i]%2==0){
  if( a[i]%5!=0 && a[i]%3!=0 ){
  no++;
  }
}
} 
 if(no!=0){
 printf("DENIED\n");
 }
  else if(no==0){
  printf("APPROVED\n");
  }
}

Measured memory_bytes: 1660
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<utility>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(int i=0;i<j;i++)
#define rep1(i,j) for(int i=1;i<=j;i++)
#define rep0d(i,j) for(int i=j-1;i>=0;i--)
#define MAX 1000000007

using namespace std;


int main() {
	int n,m;
	cin >> n>>m;
	vector<int> vec(n+1,0);
	rep1(i,n){
		cin >> vec[i];
		vec[i]+=vec[i-1];
	if(vec[i]>m){
		cout<<i;
		return 0;
	}
	}
	cout<<n+1;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define all(s) s.begin(),s.end()
#define present(c,x) ((c).find(x) != (c).end())
const double EPS = 1e-8;
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

bool dp[3005][3005];
int main(){
	int a,b,c,d,e,f; 
	scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);  
  double bst =-1;
  int bsttot,bstsu;
  dp[0][0]=true;
  REP(i,f+1) REP(j,f+1){
  	if(dp[i][j]){
  		if(i!=0){
  			double cmp = 100.0*j/i;
  			int w = i-j;
  			//printf("%d %d\n",i,j);
  			if(j*100<=e*w){
					if(cmp>bst){
						bsttot=i; bstsu=j;
						bst = cmp;
					}
				}
  		}
  		if(i+100*a<=f){
  			dp[i+100*a][j]=true;

  		}
  		if(i+100*b<=f){
  			dp[i+100*b][j]=true;

  		}
  		if(i+c<=f){
  			dp[i+c][j+c]=true;
  		}
  		if(i+d<=f){
  			dp[i+d][j+d]=true;
  		}
  	}
  }
  printf("%d %d\n",bsttot,bstsu); 
  return 0;
}


Measured memory_bytes: 8576
N = int(input())
h = [int(i) for i in input().split()]
c = [0]*N

c[0]=0
c[1]=abs(h[1]-h[0])
for i in range(2,N):
    c[i] = min(abs(h[i]-h[i-1])+c[i-1],abs(h[i]-h[i-2])+c[i-2])

print(c[N-1])

Measured memory_bytes: 13800
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

const long mod = 998244353;

void solve(){
	long n = read.to!long;
	long a = read.to!long;
	long b = read.to!long;
	long k = read.to!long;
	
	long[] perm = new long[](n + 1);
	foreach(i; 0 .. n + 1){
		if(i == 0) perm[i] = 1;
		else perm[i] = perm[i - 1] * i % mod;
	}
	log("perm:", perm);
	
	long[] inv = new long[](n + 1);
	foreach(i; 0 .. n + 1){
		if(i <= 1) inv[i] = 1;
		else inv[i] = inv[mod % i] * (mod - mod / i) % mod;
	}
	log("inv:", inv);
	
	long[] invperm = new long[](n + 1);
	foreach(i; 0 .. n + 1){
		if(i <= 1) invperm[i] = 1;
		else invperm[i] = invperm[i - 1] * inv[i] % mod;
	}
	log("invperm:", invperm);
	log("product:", (n + 1).iota.map!(i => perm[i] * invperm[i] % mod));
	
	long ans = 0;
	for(long i = 0; i <= n; i ++){
		if(i * a > k) break;
		if((k - i * a) % b != 0) continue;
		long j = (k - i * a) / b;
		if(j > n) continue;
		long p1 = perm[n] * (invperm[i] * invperm[n - i] % mod) % mod;
		long p2 = perm[n] * (invperm[j] * invperm[n - j] % mod) % mod;
		ans += p1 * p2 % mod, ans %= mod;
	}
	
	ans.writeln;
}



Measured memory_bytes: 9084
// https://atcoder.jp/contests/abc120/tasks/abc120_a

#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 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int main()
{
  int A, B, C;
  cin >> A >> B >> C;

  cout << min(B / A, C) << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <map>
#include <unordered_map>
#include <set>
#include <vector>
#include <cstring>
#include <cmath>
#include <utility>
#include <cstdlib>
#include <algorithm>
#include <time.h>
#include <iostream>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <random>
#include <iterator>
#include <cassert>
#include <cstdint>
#include <string>
#pragma comment(linker, "/STACK:10000000000")

using namespace std;

#define LLD "%I64d"

void print_str(const char* s)
{
	while (*s != 0)
	{
		putchar(*s);
		s++;
	}
}

template<typename T> void scan(T &t)
{
	cin >> t;
}

template<> void scan<int>(int &t)
{
	scanf("%d", &t);
}

template<> void scan<long long>(long long &t)
{
	scanf(LLD, &t);
}

template<> void scan<string>(string &t)
{
	cin >> t;
}

template<> void scan<char*>(char* &t)
{
	scanf("%s", t);
}

template<> void scan<char>(char &t)
{
	t = getchar();
	while (t <= 32)
		t = getchar();
}

template<typename T> void scan(vector<T> &t)
{
	for (int i = 0; i < t.size(); i++)
	{
		scan(t[i]);
	}
}


template<typename T, typename... Ts> void scan(T& t, Ts&... ts)
{
	scan(t);
	scan(ts...);
}

template<typename T> void print(T t)
{
	cout << t;
}

template<> void print<string>(string s)
{
	print_str(s.c_str());
}

template<> void print<int>(int t)
{
	printf("%d", t);
}

template<> void print<long long>(long long t)
{
	printf(LLD, t);
}

template<> void print<char>(char t)
{
	putchar(t);
}

template<> void print<const char*>(const char* t)
{
	print_str(t);
}

template<typename T, typename V> void print(pair<T, V> t)
{
	printf("(");
	print(t.first);
	printf(", ");
	print(t.second);
	printf(")");
}

template<typename T, typename... Ts> void print(T t, Ts... ts)
{
	print(t);
	print(ts...);
}

#define TASK "nocross"
#define X first
#define Y second

const int INF = 1e9;
const long long LINF = 3e18;
const int maxN = 1e5 + 100;
const int maxM = 58;
const int K = 10000;
const int SIZE = (1 << 18);
const int mb = 30;
const long long MOD = 1e9 + 7;
const long long P = 127;
const double EPS = 1e-8;

mt19937_64 random_generator;

long long random(long long l, long long r)
{
	uniform_int_distribution<long long> dist(l, r);
	long long res = dist(random_generator);
	return res;
}

namespace solution
{
}

namespace bruteforce
{
}

void init(bool testing = false)
{

}

void gen(int seed)
{
}

int a[maxN];

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen(TASK".in", "r", stdin);
	//freopen(TASK".out", "w", stdout);
#endif

	long long n;
	scan(n);
	long long res = 1;

	for (long long i = 1; i <= n; i++)
	{
		res = (res * i) % MOD;
	}

	print(res);

	return 0;
}

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

//macro-----------------------------------------------------------------------------------------
#define rep(i,a,b) for(int i=a;i<b;i++)
#define int long long

const int inf = 100100100100100;
const int mod = 1000000007;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};


//io_method
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void print(const T& n){cout << n << endl;}
void print(vector<int> arr){cout << arr[0];rep(i,1,arr.size()) cout << " " << arr[i];cout << endl;}
void print(pair<int, int> p){cout << p.first << " " << p.second;}
void print(vector<vector<int>> arr){rep(i,0,arr.size()){print(arr[i]);}}
void print(set<int> s){for(auto e = s.begin(); e != s.end(); e++){cout << *e << " ";}cout << endl;}
void print(map<int, int> mp){cout << "{";for(auto e = mp.begin(); e != mp.end(); e++){cout << "(" << e -> first << " " << e -> second << ")";}cout << "}" << endl;}

//main------------------------------------------------------------------------------------------

signed main(){


    int n = input();

    vector<vector<int> > arr;

    rep(i,0,n){
        int x,y,h; cin >> x >> y >> h;
        arr.push_back({x,y,h});
    }

    rep(i,0,101){
        rep(j,0,101){
            rep(h,-220, 220){
                int hei = arr[0][2] + h;
                if(hei < 1) continue;

                bool isfind = true;
                rep(k,0, n){
                    if(arr[k][2] == 0 && hei - abs(i - arr[k][0]) - abs(j - arr[k][1]) <= 0|| hei - abs(i - arr[k][0]) - abs(j - arr[k][1]) == arr[k][2]){
                        continue;
                    }else{
                        isfind = false;
                        break;
                    }
                }
                if(isfind){
                    cout << i << " " << j << " " << hei << endl;
                    return 0;
                }
            }
        }
    }









}   

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
from bisect import bisect_left
n,q=map(int,input().split())
STX=[tuple(map(int,input().split())) for _ in range(n)]
STX.sort(key=lambda x: x[2])
D=[int(input()) for _ in range(q)]
Ans=[-1]*q; Jump=[-1]*q
for s,t,x in STX:
    l=bisect_left(D,s-x)
    r=bisect_left(D,t-x)
    while l<r:
        s=Jump[l]
        if s==-1:
            Ans[l]=x
            Jump[l]=r
            l+=1
        else:
            l=s
print(*Ans,sep='\n')

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


int main() {
  int a,b;
  cin >> a >> b;
  int ans = max({a+b,a-b,a*b});
  cout << ans << endl;
}


Measured memory_bytes: 3616
import math

a, b, x = map(int, input().split(' '))

x = x / a


def f(t):
    tan = math.tan(t)
    if tan <= b / a:
        return (a * b) - (a * a * tan / 2)
    else:
        return b * (b / tan) / 2


left = 0.0
right = math.pi / 2

for i in range(10000):
    theta = (left + right) / 2
    if f(theta) >= x:
        left = theta
    else:
        right = theta

print(left / math.pi * 180)


Measured memory_bytes: 9448
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

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

  vec<ll> A(N);
  REP(i, N) cin >> A[i];

  vec<ll> C(200'000, 0);
  REP(i, N) C[A[i]]++;
  C.erase(remove_if(ALL(C), [](ll c) { return c == 0; }), end(C));
  ll k = C.size();
  if (k <= K) {
    cout << 0 << endl;
    return 0;
  }
  sort(ALL(C));
  ll res = 0;
  for (const auto e : C) {
    res += e;
    if (--k <= K) {
      break;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 6372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<long long> vll;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   ll a,b,c;
   ll cnt=0;
   cin>>a>>b>>c;
   if(a==0)
   {
       cout<<b/c+1<<endl;
   }
   else
   {
       cout<<b/c-(a-1)/c<<endl;
   }
   return 0;
}


Measured memory_bytes: 256
import java.util.*;

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val x = Integer.parseInt(sc.next())
    val y = Integer.parseInt(sc.next())
    val a = Integer.parseInt(sc.next())
    val b = Integer.parseInt(sc.next())
    val c = Integer.parseInt(sc.next())
    val p = LongArray(a)
    val q = LongArray(b)
    val r = LongArray(c)
    repeat(a){p[it] = sc.nextLong()}
    repeat(b){q[it] = sc.nextLong()}
    repeat(c){r[it] = sc.nextLong()}
    val aa = p.sortedBy{it*-1}.take(x).toLongArray()
    val bb = q.sortedBy{it*-1}.take(y).toLongArray()
    val apple = ( aa + bb + r).sortedBy{it*-1}.take(x+y)
    println(apple.sum())
}


Measured memory_bytes: 133304
//
//  atcoder_abc173_c.cpp
//  CF-1
//
//  Created by Avaneendra Alugupalli on 8/4/20.
//  Copyright © 2020 Avaneendra Alugupalli. All rights reserved.
//

#include <iostream>
#include <vector>
#include <bits/stdc++.h>

using namespace std;

int main () {
    int h;
    int w;
    int k;
    int ans = 0;
    
    cin >>  h >> w >> k;
    vector<vector<char>> grid(h, vector<char>(w));
    
    for (int i = 0; i < h ; i++) {
        for (int j = 0; j < w; j++) {
            cin >> grid[i][j];
        }
    }
    for (int mask1 = 0; mask1 < (1 << (h)); mask1++) {
        for (int mask2 = 0; mask2 < (1 << (w)); mask2++) {

            int count = 0;
            
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    
                    if (!(mask1 & (1 << i)) && !(mask2 & (1 << j))) {
                        if (grid[i][j] == '#') {
                            count++;
                        }
                    }
                }
            }
            if (count == k)
                ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int l;
  cin >> l;
  double ans = l * l * l / 27.0;
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
const long long mod = 1000000007;
#define ll long long
#define P pair<int, int>
#define dump(x)                             \
    if (dbg) {                              \
        cout << #x << " = " << (x) << endl; \
    }
bool dbg = false;
long long gcd(long long a, long long b){
   if (a % b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a % b));
   }
}
long long lcm(long long a, long long b){
   return (a / gcd(a, b))* b;
}
//---------------------------------------------------------------------------------------------------
/*ここからいじる*/
//---------------------------------------------------------------------------------------------------
void solve(){
}
int main(){
    int l;
    cin >> l;
    double L;
    L = l / 3.0;
    double ans = L * L * L;
    cout << fixed << setprecision(10);
    cout << ans << endl;
    solve();
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
main()
{
   int a,b,ml,c=-1;
   scanf("%d %d",&a,&b);
   if(a>=1 && a<=9 && b>=1 && b<=9)
   {
         ml=a*b;
         printf("%d\n",ml);
   }
   else if(a>=1 && a<=9 && b>=10 && b<=20)
   {
      printf("%d\n",c);
   }
   else if(a>=10 && a<=20 && b>=1 && b<=9)
   {
      printf("%d\n",c);
   }
   else if(a>=10 && a<=20 && b>=10 && b<=20)
   {
      printf("%d\n",c);
   }

   return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<bits/stdc++.h>
#include<string>
#include<time.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first    
#define se second
void solve()
{
    ll n,i,j,k;
    cin>>n;
    ll a[n],b[n],c[n];
    for(i=0;i<n;i++)
        cin>>a[i]>>b[i]>>c[i];
    ll dp[3][n];
    dp[0][0]=a[0];
    dp[1][0]=b[0];
    dp[2][0]=c[0];
    for(i=1;i<n;i++)
    {
        dp[0][i]=a[i]+max(dp[1][i-1],dp[2][i-1]);
        dp[1][i]=b[i]+max(dp[0][i-1],dp[2][i-1]);
        dp[2][i]=c[i]+max(dp[1][i-1],dp[0][i-1]);        
    }
    cout<<max(dp[0][n-1],max(dp[1][n-1],dp[2][n-1]));
}
int main(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif  
    clock_t tStart = clock();
    ll t,k;
    // cin>>t;
    // while(t--)
        solve();
    // printf("\nTime taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    return 0;
}       

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) for(int i=0;i<=(n);++i)
#define ALL(v) (v).begin(),(v).end()

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

int n,m,r,R[8];
ll fld[200][200];

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

	REP(i,200) REP(j,200) fld[i][j]=(i==j?0:LINF);
	cin>>n>>m>>r;
	REP(i,r) cin>>R[i];
	REP(i,m) {
		int a,b,c; cin>>a>>b>>c; a--;b--;
		fld[a][b]=c; fld[b][a]=c;
	}
	REP(k,n) REP(i,n) REP(j,n) fld[i][j]=min(fld[i][j],fld[i][k]+fld[k][j]);
	ll ans=LINF;
	sort(R,R+r);
	do {
		ll sum=0;
		REP(i,r-1) sum+=fld[R[i]-1][R[i+1]-1];
		ans=min(sum,ans);
	} while(next_permutation(R,R+r));
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 640
N=int(input())
S=input()
S=[1 if S[i]=='o' else -1 for i in range(N)]

#0番目は羊のパターン
tmp=[0]*N
tmp[0]=1
if S[0]==1: #0番目の両隣は同種
  #0番目の両隣は羊
  tmp[1]=1
  tmp[N-1]=1
  
  for i in range(2, N-1):
    tmp[i]=tmp[i-1]*tmp[i-2]*S[i-1]
    
  if tmp[N-1]==tmp[N-2]*tmp[N-3]*S[N-2] and tmp[0]==tmp[N-1]*tmp[N-2]*S[N-1]:
    ans=['S' if tmp[i]==1 else 'W' for i in range(N)]
    print(''.join(ans))
    exit()
    
  #0番目の両隣は狼
  tmp[1]=-1
  tmp[N-1]=-1
  
  for i in range(2, N-1):
    tmp[i]=tmp[i-1]*tmp[i-2]*S[i-1]
    
  if tmp[N-1]==tmp[N-2]*tmp[N-3]*S[N-2] and tmp[0]==tmp[N-1]*tmp[N-2]*S[N-1]:
    ans=['S' if tmp[i]==1 else 'W' for i in range(N)]
    print(''.join(ans))
    exit()
  
else: #0番目の両隣は異種
  #1番目が羊, N-1番目が狼
  tmp[1]=1
  tmp[N-1]=-1
  
  for i in range(2, N-1):
    tmp[i]=tmp[i-1]*tmp[i-2]*S[i-1]
    
  if tmp[N-1]==tmp[N-2]*tmp[N-3]*S[N-2] and tmp[0]==tmp[N-1]*tmp[N-2]*S[N-1]:
    ans=['S' if tmp[i]==1 else 'W' for i in range(N)]
    print(''.join(ans))
    exit()
  
  #1番目が狼, N-1番目が羊
  tmp[1]=-1
  tmp[N-1]=1
  
  for i in range(2, N-1):
    tmp[i]=tmp[i-1]*tmp[i-2]*S[i-1]
    
  if tmp[N-1]==tmp[N-2]*tmp[N-3]*S[N-2] and tmp[0]==tmp[N-1]*tmp[N-2]*S[N-1]:
    ans=['S' if tmp[i]==1 else 'W' for i in range(N)]
    print(''.join(ans))
    exit()
  
#0番目は狼のパターン
tmp=[0]*N
tmp[0]=-1
if S[0]==-1: #0番目の両隣は同種
  #0番目の両隣は羊
  tmp[1]=1
  tmp[N-1]=1
  
  for i in range(2, N-1):
    tmp[i]=tmp[i-1]*tmp[i-2]*S[i-1]
    
  if tmp[N-1]==tmp[N-2]*tmp[N-3]*S[N-2] and tmp[0]==tmp[N-1]*tmp[N-2]*S[N-1]:
    ans=['S' if tmp[i]==1 else 'W' for i in range(N)]
    print(''.join(ans))
    exit()
    
  #0番目の両隣は狼
  tmp[1]=-1
  tmp[N-1]=-1
  
  for i in range(2, N-1):
    tmp[i]=tmp[i-1]*tmp[i-2]*S[i-1]
    
  if tmp[N-1]==tmp[N-2]*tmp[N-3]*S[N-2] and tmp[0]==tmp[N-1]*tmp[N-2]*S[N-1]:
    ans=['S' if tmp[i]==1 else 'W' for i in range(N)]
    print(''.join(ans))
    exit()
  
else: #0番目の両隣は異種
  #1番目が羊, N-1番目が狼
  tmp[1]=1
  tmp[N-1]=-1
  
  for i in range(2, N-1):
    tmp[i]=tmp[i-1]*tmp[i-2]*S[i-1]
    
  if tmp[N-1]==tmp[N-2]*tmp[N-3]*S[N-2] and tmp[0]==tmp[N-1]*tmp[N-2]*S[N-1]:
    ans=['S' if tmp[i]==1 else 'W' for i in range(N)]
    print(''.join(ans))
    exit()
  
  #1番目が狼, N-1番目が羊
  tmp[1]=-1
  tmp[N-1]=1
  
  for i in range(2, N-1):
    tmp[i]=tmp[i-1]*tmp[i-2]*S[i-1]
    
  if tmp[N-1]==tmp[N-2]*tmp[N-3]*S[N-2] and tmp[0]==tmp[N-1]*tmp[N-2]*S[N-1]:
    ans=['S' if tmp[i]==1 else 'W' for i in range(N)]
    print(''.join(ans))
    exit()
  
print(-1)

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

int main() {
    int n, sum = 0;
    cin >> n;
    vector<string> str(n);
    vector<int> time(n);
    rep(i, n) cin >> str.at(i) >> time.at(i);
    string target;
    cin >> target;
    bool flag = false;
    rep(i, n) {
        if(flag) sum += time.at(i);
        if(str.at(i) == target) flag = true;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
n = int(input())
mo_9 =  [1]
mo_6 = [1]
roku = 1
while 6**roku <= n:
  mo_6.append(6**roku)
  roku += 1
kyuu = 1
while 9**kyuu <= n:
  mo_9.append(9**kyuu)
  kyuu += 1
mo_6 = list(reversed(mo_6))
mo_9 = list(reversed(mo_9))
ans = 10**6 +1
for i in range(n+1):
  a = i
  b = n-i
  ans_temp =  0
  for j in mo_6:
    ans_temp +=  a//j
    a =  a % j
  for j in mo_9:
    ans_temp += b//j
    b =  b % j
  ans = min(ans, ans_temp)
print(ans)

Measured memory_bytes: 3064
#include<cstdio>

int main(){
    int i,j,n,count[100];
    for(int i = 0; i < 100; i++){
        count[i] = 0;
 	}
    char ch;
    while(scanf("%c",&ch)!=EOF){
        if(ch>='a' && ch<='z'){
            count[ch-'a']++;
        }
        else if(ch>='A'&& ch<='Z'){
            count[ch-'A']++;
        }
    }
    for(j=0;j<26;j++){
        printf("%c : %d\n",j+'a',count[j]);
    }
    return 0;
}


Measured memory_bytes: 2740
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int main(){
  int n;
  cin>>n;
  vector<int> vec(n);
  rep(i,n){
    int d;
    scanf("%d", &d);
    vec[d-1]=i;
  }

  rep(i,n) printf("%ld%c",(long)30000*i+1 , ((i==n-1)?'\n':' '));
  rep(i,n) printf("%ld%c",(long)30000*(n-i)+vec[i]+1 , ((i==n-1)?'\n':' '));

  return 0;
}


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

char index(int c){
	switch(c){
	case 0: return '+';
	case 1: return '-';
	case 2: return '*';
	}
}

int san(int a, int ch, int b){
	switch(ch){
	case 0: return a + b;
	case 1: return a - b;
	case 2: return a * b;
	}
}

bool judge(int a, int b, int c, int d)
{	int t, t1, t2;
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 3; k++){
				t = san(a,i,b);
				t1 = san(t,j,c);
				t2 = san(t1,k,d);
				if(t2 == 10){
					cout << "(((" << a << " " <<  index(i) << " " << b
						<< ")" << " " << index(j) << " "<< c << ")" << " "
						<< index(k) << " "<< d << ")";
					cout << endl;
					return true;
				}
			}
		}
	}
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 3; k++){
				t = san(a,i,b);
				t1 = san(c,k,d);
				t2 = san(t,j,t1);
				if(t2 == 10){
					cout << "((" << a << " " << index(i) << " " << b << ")"
						<< " " << index(j) << " " << "(" << c << " " 
						<< index(k) << " " << d << "))";
					cout << endl;
					return true;
				}
			}
		}
	}
	return false;
}

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

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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n, q;
	string s;
	cin >> n >> q >> s;

	vector<int> cnts(n);
	for (int i = 0; i < n - 1; i++) {
		if (s[i] == 'A' && s[i + 1] == 'C') {
			cnts[i + 1]++;
		}
	}

	for (int i = 1; i < n; i++) {
		cnts[i] += cnts[i - 1];
	}

	for (int i = 0; i < q; i++) {
		int l, r;
		cin >> l >> r;
		l--; r--;

		cout << cnts[r] - cnts[l] << endl;;
	}
	return 0;
}


Measured memory_bytes: 1488
#include <iostream>
#include <cassert>
#include <iomanip>
#include <utility>
#include <cmath>
#include <numeric>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
#include <string>

using namespace std;

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define repext(i, a, b) for (int i = a; i < b; i++)
#define reprev(i, n) for (int i = n - 1; i >= 0; i--)
#define repextrev(i, a, b) for (int i = b - 1; i >= a; i--)

#define repv(v, values) for (auto v : values)

#define vec_all(vec) vec.begin(), vec.end()
#define sum(vec) accumulate(vec_all(vec), 0)
#define srt(vec) sort(vec_all(vec))

// vectorデバッグ
template<typename T>
void dump_vec(vector<T> vec) {
    rep(i, vec.size()) {
        cout << i << ": " << vec[i] << endl;
    }
}

// --- notice ---
// intの和はllにしろ

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

    int digit_1, digit_2;
    ll tmp;
    int ans = 100;
    int tmp_digit;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            tmp = n / i;
            digit_1 = to_string(i).size();
            digit_2 = to_string(tmp).size();

            tmp_digit = max(digit_1, digit_2);
            if (ans > tmp_digit) {
                ans = tmp_digit;
            }
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<map>
#include<cstring>
#define inf 1<<30
using namespace std;
char s[200005];

long long cnt[28];
int main()
{
    while(~scanf("%s", s))
    {
        memset(cnt,0,sizeof(cnt));
        long long x = strlen(s);
        long long ans = 0;
        for(int i = 0; i < x; i++)
            cnt[s[i] - 'a']++;
        for(int j = 0; j < 26; j++)
            ans += (x - cnt[j]) * cnt[j];
        printf("%lld\n", ans / 2 + 1);
    }
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int calc_gcd(ll x, ll y) {
    if (!y) {
        return x;
    }
    return calc_gcd(y, x % y);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X;
    cin >> X;
    cout << X * 360 / calc_gcd(X, 360) / X << endl;
    return 0;
}

Measured memory_bytes: 3572
def binarySearch(t, n, S):
    low = 0
    high = n-1
    while low <= high:
        mid = (low + high) // 2
        item = S[mid]
        if t == item:
            return True
        elif t < item:
            high = mid - 1
        else:
            low = mid + 1
    return False

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

c = 0
for t in T:
    if binarySearch(t, n, S):
        c += 1
print(c)



Measured memory_bytes: 16708
#include<stdio.h>
#include<algorithm>
using namespace std;
int x[200];
int y[200];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=1;i<a;i++){
			int b,c;scanf("%d%d",&b,&c);
			x[i]=x[b];
			y[i]=y[b];
			switch(c){
				case 0:x[i]--;break;
				case 1:y[i]--;break;
				case 2:x[i]++;break;
				case 3:y[i]++;break;
			}
		}
		int Xmin=99999;
		int Xmax=-99999;
		int Ymin=99999;
		int Ymax=-99999;
		for(int i=0;i<a;i++){
			Xmin=min(Xmin,x[i]);
			Xmax=max(Xmax,x[i]);
			Ymin=min(Ymin,y[i]);
			Ymax=max(Ymax,y[i]);
		}
		printf("%d %d\n",Xmax-Xmin+1,Ymax-Ymin+1);
	}
}

Measured memory_bytes: 1028
n, m = map(int,input().split())
s = input()
ans = []
p = n
while m < p:
    for i in range(m, 0, -1):
        if s[p - i] == "0":
            ans.append(i)
            break
        else:
            if i == 1:
                print(-1)
                exit()
            else:
                continue
    p -= i
ans.append(p)
k = len(ans)
for i in range(k):
    if i == k-1:
        print(ans[k-i-1])
    else:
        print(ans[k-i-1], end=" ")


Measured memory_bytes: 4848
n=int(input())
a=list(map(int,input().split()))
m=10**4
for i in range(n):
  b=a[:i+1]
  c=a[i+1:]
  
  if abs(sum(b)-sum(c))<m:
    m=abs(sum(b)-sum(c))
    
print(m)

Measured memory_bytes: 3060
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<iomanip>
#include<sstream>
#include<cmath>
#include<bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(long long int i = 1;i <=  n; i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
typedef long long int ll;
typedef long double ld;
const ll INF = (1LL << 60);
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    fill((T*)array, (T*)(array + N), val);
}
int main() {
    int n, m; string s,t;
    cin >> s >> t;
    if (s == t.substr(0, s.size())) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MAX=1e5+5;
ll mod=1e9+7;
#define pb push_back
#define se second
#define fi first
#define maxe max_element
#define mine min_element
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
vector<int> graph[205];
int color[205];
int nCk[100][100];
bool bipartite_jugding(int v, int c){
    color[v] = c;
    for(int i = 0; i < graph[v].size(); ++i){
        if(color[graph[v][i]] == c) return false;
        if(color[graph[v][i]] == 0 && !bipartite_jugding(graph[v][i], -c)){
            return false;
        }
    }
    return true;
}

 void combi() {
	for (int i = 0; i <= 99; ++i) nCk[i][0] = 1;
	for (int i = 1; i <= 99; ++i) for (int j = 1; j <= i; ++j) {
		nCk[i][j] = (nCk[i-1][j] + nCk[i-1][j-1]) % mod;
	}
}

long long expo(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*expo((x*x)%M,(n-1)/2,M))%M;

}

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

}

int main(){
boost;
  solve();
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;


int main(){
  int n, m;
  cin >> n >> m;
  
  int a[n],sumVote=0;
  for (int i=0; i<n; i++){
    cin >> a[i];
    sumVote += a[i];
  }
  
  sort(a,a+n);
  
  long double threash;
  threash = (long double) sumVote/4/m;
  
  
//  cout <<threash<< endl;
//  cout <<a[n-2]<< endl;
//  cout <<a[n-1]<< endl;
  
  for (int i=0; i<m; i++){
    if (a[n-i-1] < threash){
        cout << "No";
        break;
    } 
    if (i == m-1){
        cout << "Yes";
    }
  }
    
  
  
  
  return 0;
}

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



int main(){
    long long q,h,s,d;
    long long n;
    cin >> q >> h >> s >> d >> n;

    if(n==1){
        //1Lあたりの値段
        q*=4;
        h*=2;
        long long ans = min(q,min(h,s));
        cout << n*ans << endl;
    }else{
        //2Lあたりの値段
        q*=8;
        h*=4;
        s*=2;

        long long ans = min(q,min(h,min(s,d)));
        if(n%2==1){
            if(ans==d){
                long long ans2 = min(q,min(h,s));
                ans2/=2;
                cout << (n/2)*ans + ans2;
            }else{
                ans/=2;
                cout << n*ans << endl;
            }
        }else{
            cout << (n/2)*ans << endl;
        }
    }

}



Measured memory_bytes: 3524