akhauriyash/Code-Regression huggingface dataset:
x = list(map(int,(input().split())))
y = list(map(int,(input().split())))
z = list(map(int,(input().split())))
count1 =  0
count2 =  0
count3 =  0
count4 =  0

num = x + y + z

for i in range(len(num)):
    
    if num[i] == 1:
        count1 += 1
        if count1 >=3:
            print("NO")
            exit()
    if num[i] == 2:
        count2 += 1
        if count2 >=3:
            print("NO")
            exit()
    if num[i] == 3:
        count3 += 1
        if count3 >=3:
            print("NO")
            exit()
    if num[i] == 4:
        count4 += 1
        if count4 >=3:
            print("NO")
            exit()

print("YES")



Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll A[N];
    REP(i, 0, N) {
        cin >> A[i];
    }
    ll pre[N], suf[N];
    pre[0] = A[0];
    REP(i, 1, N) {
        pre[i] = gcd(pre[i - 1], A[i]);
    }
    suf[N - 1] = A[N - 1];
    PER(i, N - 2, -1) {
        suf[i] = gcd(suf[i + 1], A[i]);
    }
    ll ans = 0;
    REP(i, 0, N) {
        ll num;
        if (i == 0) {
            num = suf[1];
        } else if (i == N - 1) {
            num = pre[N - 2];
        } else {
            num = gcd(pre[i - 1], suf[i + 1]);
        }
        ans = max(ans, num);
    }
    cout << ans << endl;
}


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


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long  int n,sum=0;
    cin>>n;
    while(1)
    {
      sum+=1000;
      if(n<=sum)
      {
        cout<<sum-n;
        break;
      }
    }
  }

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define nmax_def 110000
#define Cmax_def 2200
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

int main() {
	ll N;
	cin >> N;
	ll ans = pow(10, 18);
	for (int i = 1; i < 2000000; i++) {
		if (N % i == 0) {
			ll j = N / i;
			ll anstmp = i + j - 2;
			if (anstmp < ans)
				ans = anstmp;
		}
	}
	cout << ans << endl;

	return 0;
}

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

int main()
{
    int n,num=0;
    cin>>n;
    int s[n];
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
        if(i%2==0&&s[i]%2!=0)
            num++;
    }
    cout<<num<<endl;
}


Measured memory_bytes: 3568
/*

Coded and Decoded by : Yash Kapoor

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

// s.find_by_order(index);
// s.order_of_key(value);

#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair
#define pll pair<ll, ll>
#define vl vector<ll>
#define sl set<ll>
#define vll vector<pll>
#define ml map<ll, ll>
#define mll map<pll, ll>
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define sz(x) (ll) x.size()
#define dl '\n'
#define elasped_time  1.0 * clock() / CLOCKS_PER_SEC
#define why (ll)1000000007
//#define why (ll)998244353
#define lp(i, a, b) for (ll i = a; i < b; ++i)
#define lpr(i, a, b) for (ll i = a; i >= b; i--)
#define lpd(i, x) for (auto i : x)
#define ios                                                                                                            \
  ios_base::sync_with_stdio(false);                                                                                    \
  cin.tie(0);                                                                                                          \
  cout.tie(0);

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

ll inf = 1e18;
ld pi = 3.141592653589;
ll mod = why;
ll fast_power(ll base, ll power)
{
  ll result = 1;
  while (power) {
    if (power % 2)
      result = (result * base) % mod;
    base = (base * base) % mod;
    power /= 2;
  }
  return result;
}

ll inverse(ll base, ll mod) { return fast_power(base, mod - 2); }
int test = 1;
vl adj[200005];
vl visited(200005);
ll n;
ll dp[1001][1001];
void solve() {
  ll h,w; cin >> h >> w;
  vector<string> a(h);
  memset(dp,0,sizeof dp);
  lp(i,0,h) cin >> a[i];
  lp(i,0,h){
    lp(j,0,w){
      if(i == 0 and j == 0){
        dp[i][j] = 1;
      }
      else if(a[i][j] == '.'){
        if(i == 0){
        dp[i][j] = dp[i][j-1]%mod;
      }
      else if(j == 0){
        dp[i][j] = dp[i-1][j]%mod;
      } else 
        dp[i][j] = (dp[i-1][j]%mod + dp[i][j-1]%mod)%mod;
      } else {
        dp[i][j] = 0;
      }
    }
  }
  cout << dp[h-1][w-1];
} 

int main()
{
  // #ifndef ONLINE_JUDGE 
  //   freopen("input.txt", "r", stdin);
  //   freopen("output.txt", "w", stdout);
  // #endif
  ios 
  ll t = 1;
  //cin >> t;
  while (t--) 
  {
    //cout << "Case #" << test++ << ": ";
    solve();
  }
  //cerr<<endl<<"समय गुज़रा : "<<elasped_time<<dl;
}

Measured memory_bytes: 18532
#include <iostream>
#include <vector>
#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() {
  int N, dp[100005], Q;
  ll sum = 0;
  ll ans[100005];
  cin >> N;
  rep(i,N) {
    int a;
    cin >> a;
    dp[a]++;
    sum += a;
  }
  cin >> Q;
  rep(i,Q) {
    int b, c;
    cin >> b >> c;
    int cur = dp[b];
    dp[b] = 0;
    dp[c] += cur;
    sum += (c - b) * cur;
    ans[i] = sum;
  }
  rep(i,Q) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 4232
#include<bits/stdc++.h>
using namespace std;
int main(){
  string z;
  cin>>z;
  int x=z.length(),y;
  vector<int> w(26);
  for(y=0;y<x;y++){
    w.at(z.at(y)-'a')++;
    if(w.at(z.at(y)-'a')==2){
      cout<<"no"<<endl;
      return 0;
    }
  }
  cout<<"yes"<<endl;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;

 
lint fac[MAX], finv[MAX], inv[MAX];

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
  

  int main(){
      lint N,Q;
      lint count=0;
      string s;
      cin>>N>>s;
      rep(i,N-2){
          if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')count++;
      }
      cout<<count;
  
  }
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second

int m, n, dp[1001][1001];

int edit(int i, int j, string &s, string &t) {
    if(j == n) return 0;
    if(i == m) return 1001;

    if(dp[i][j] != -1) return dp[i][j];

    if(s[i] == t[j]) return dp[i][j] = min(edit(i + 1, j + 1, s, t), edit(i + 1, 0, s, t));

    return dp[i][j] = min(1 + edit(i + 1, j + 1, s, t), edit(i + 1, 0, s, t));
}

int main() {
    string s, t; cin>>s>>t;
    m = s.length(), n = t.length();

    for(int i=0; i<m; i++) for(int j=0; j<n; j++) dp[i][j] = -1;

    printf("%d\n", edit(0, 0, s, t));
    return 0;
}

Measured memory_bytes: 7708
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n; cin>>n;
  for (int i=1; i<=9; ++i)
    for (int j=1; j<=9; ++j)
      if (i*j==n) {
        cout<<"Yes\n"; return 0;
      }
  cout<<"No\n"; return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup cin.tie(0);ios::sync_with_stdio(false);
#define eb emplace_back
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int main()
{
    ciosup;
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    REP(i,n) cin >> l[i];
    int pos=0,ans=1;
    REP(i, n)
    {
        pos += l[i];
        if (pos <= x) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
)

func main(){
	var num_s string
	var ans, num_i int
	for{
		fmt.Scan(&num_s)
		if num_s == "0"{
			break
		}
		ans = 0
		for _, i := range num_s{
			num_i, _ = strconv.Atoi(string(i))
			ans += num_i
		}
		fmt.Println(ans)
	}
}


Measured memory_bytes: 1124
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n := scanInt()
	a := scanInts(n)
	sort.Ints(a)
	ans := a[n-1]
	k := n - 2
	for i := 0; i < n-1; i++ {
		if k == 0 {
			break
		}
		if k > 1 {
			ans += a[n-2-i] * 2
			k -= 2
		} else {
			ans += a[n-2-i]
			k--
		}
	}
	fmt.Fprintln(wr, ans)
}


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

int main(){
  string s;
  cin >> s;
  int l=s.size();
  vector<int> v;
  rep(i,l){
    if(s[i]=='A') v.push_back(0);
    if(s[i]=='B') v.push_back(1);
    if(s[i]=='C'){
      if(i>0)if(s[i-1]=='B'){
        v.back()=2;
      }
      if(i>0)if(s[i-1]!='B') v.push_back(3);
      if(i==0) v.push_back(3);
    }
  }
  int vl=v.size();
  ll ans=0;
  int a=0;
  for(int i=vl-1;i>=0;i--){
    if(v[i]==2){
      a++;
    }
    if(v[i]==0) ans+=(ll)a;
    if(v[i]==1 or v[i]==3) a=0;
  }
  cout << ans <<endl;
  return 0;
}

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

int main() {
    vector<int> a(3);
    for(auto &e : a) cin >> e;
    sort(a.begin(), a.end());
    // 2 3 6
    int d = a[2] - a[1];
    int ans = d;
    a[0] += d;
    a[1] += d;
    // 5 6 6
    d = a[1] - a[0];
    ans += (d + 1) / 2 + d % 2;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;import java.util.Collections;

 
public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try {
	    ArrayList<Data> list=new ArrayList<>();
	    int count=Integer.parseInt(reader.readLine());
	    int duplicate=0;
	    for(int i=0;i<count;i++){
	    String str=reader.readLine();
	    String s[]=str.split(" ");
	    int w=Integer.parseInt(s[0]);
	    int h=Integer.parseInt(s[1]);
	    int c=Integer.parseInt(s[2]);

	    Data data=new Data(w,h,c);
	    for(int j=0;j<list.size();j++){
		if(list.get(j).search(data)){
			duplicate++;
			break;
		}
	    }
	    list.add(data);
	    }
	    
	    System.out.println(duplicate);
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    static class Data{
	int num[]=new int[3];
	public Data(int a,int b,int c){
	    num[0]=a;
	    num[1]=b;
	    num[2]=c;
	}
	public boolean search(Data d){
	    int tr=0;
	    for(int i=0;i<3;i++){
		for(int j=0;j<3;j++){
		    if(d.num[i]==num[j]){
			tr++;
		    }
		}
	    }
	    if(tr==3){
		return true;
	    }
	    return false;
	}
    }
}



Measured memory_bytes: 27844
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;
constexpr double EPS = 1e-10;

ll dp[10100];
ll v[101], w[101];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    ll N, W; cin >> N >> W;
    REP(i,N) cin >> v[i] >> w[i];
    REP(i,10100) dp[i] = INF;
    
    dp[0] = 0;
    for(int i=0; i < N; ++i) {
        for(int j=10100; j >= v[i]; --j) {
            chmin(dp[j], dp[j-v[i]] + w[i]);
        }
    }

    ll ans = 0;
    REP(i,10100) if(dp[i] <= W) ans = i;
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3288
fun main(args: Array<String>) {
    val s = readLine()!!
    val t = readLine()!!

    val map1 = mutableMapOf<Char, Char>()
    val map2 = mutableMapOf<Char, Char>()

    var ans = true

    for (i in s.indices) {
        if (map1.containsKey(s[i]) && map1[s[i]] != t[i]) ans = false
        if (!map1.containsKey(s[i])) map1[s[i]] = t[i]
        if (map2.containsKey(t[i]) && map2[t[i]] != s[i]) ans = false
        if (!map2.containsKey(t[i])) map2[t[i]] = s[i]
    }

    println(if (ans) "Yes" else "No")
}


Measured memory_bytes: 36976
#include<stdio.h>

int max(int x, int y){
    int a,b,c;
    a = x+y;
    b = x-y;
    c = x*y;
    int d;
    if(a>b){
        d = a;
    }else{
        d = b;
    }
     if(d>c){
        d = d;
    }else{
        d = c;
    }
    return d;
}

int main(void){
    int x,y,z;
    scanf("%d",&x);
    scanf("%d",&y);
    z = max(x,y);
    printf("%d",z);
    return 0;
}

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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9 + 7;


signed main(){
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i = 0; i < h; ++i){
        cin >> s[i];
        for(int j = 0; j < 3; ++j)
            s[i] += '.';
    }
    reverse(s.begin(), s.end());
    for(int i = 0; i < 3; ++i){
        string t = "";
        for(int j = 0; j < w + 3; ++j)
            t += '.';
        s.emplace_back(t);
    }

    /*
    for(auto& x : s)
        cout << x << endl;
    */

    auto f = [&](double rot){
        double x = 0;
        double y = 0;
        bool fl = s[0][0] == '#';
        int cnt = fl;

        while(x <= h && y <= w){
            // y = x * rot
            double xx = ceil(x + 1e-9);
            double xy = xx * rot;

            double yy = ceil(y + 1e-9);
            double yx = yy / rot;

            if(xx < yx){
                x = xx;
                y = xy;
            }else{
                x = yx;
                y = yy;
            }
            bool nex = s[int(x + 1e-9)][int(y + 1e-9)] == '#';
            cnt += fl ^ nex;
            fl = nex;
        }
        return cnt;
    };
    int ma = 0;
    set<double> se;
    for(int i = 1; i <= h + 1; ++i)
        for(int j = 1; j <= w + 1; ++j)
            if(i && j){
                if(s[i][j] != s[i - 1][j - 1] || s[i][j - 1] != s[i - 1][j]){
                    int cnt = (s[i][j] == '#') + (s[i - 1][j - 1] == '#')
                            + (s[i - 1][j] == '#') + (s[i][j - 1] == '#');
                    if(cnt == 2 || cnt == 0 || cnt == 4)
                        continue;
                    if(cnt == 1 && (s[i][j] == '#' || s[i - 1][j - 1] == '#'))
                        continue;
                    if(cnt == 3 && !(s[i][j] == '#' && s[i - 1][j - 1] == '#'))
                        continue;
                    se.emplace(1.0 * j / i);
                    se.emplace(1.0 * j / i - 1e-8);
                    se.emplace(1.0 * j / i + 1e-8);
                }
            }
    se.emplace(1);
    for(auto& rot : se){
        int ret = f(rot);
        ma = max(ma, ret);
    }
    cout << ma / 2 + 1 << endl;
}



Measured memory_bytes: 12748
#include<stdio.h>
#define MAX 100

void sort(int A[],int n){
  int i,j;
  int v,c=0;

  for(i=0;i<n;i++){
    for(j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
	v=A[j];
	A[j]=A[j-1];
	A[j-1]=v;
	c++;
      }
    }
  }

  for(i=0;i<n;i++){
    if(i==n-1)printf("%d\n",A[i]);
    else printf("%d ",A[i]);
  }
  printf("%d\n",c);
  
}

main(){
  int n;
  int i;
  int A[MAX];
  
  scanf("%d",&n);

  for(i=0;i<n;i++)scanf("%d",&A[i]);

  sort(A,n);

  return 0;
}



Measured memory_bytes: 2140
#include<stdio.h>
#define SIZE 100

int main(void){
    int n,i,j,k,l,cost=100000000000,p,q,count;
    int x[SIZE],y[SIZE];
    int xp[SIZE][SIZE],yq[SIZE][SIZE];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d%d",&x[i],&y[i]);
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            xp[i][j] = x[i] - x[j];
            yq[i][j] = y[i] - y[j];
        }
    }
    for(k=0;k<n;k++){
        for(l=0;l<n;l++){
            if(k!=l){
                count = 0;
                for(i=0;i<n;i++){
                    for(j=0;j<n;j++){
                        if(xp[i][j]==xp[k][l] && yq[i][j]==yq[k][l]){
                            count +=1;
                        }
                    }
                }
                if(n-count < cost){
                    cost = n-count;
                }
            }
        }
    }
    if(cost>50){
        cost=1;
        printf("%d",cost);
    }else{
        printf("%d",cost);
    }
    return 0;

}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    int m[100010]={0};
    if(s[0]=='A'&&s[1]=='C') m[0]=1;
    for(int i=2;i<n;i++){
        if(s[i-1]=='A'&&s[i]=='C') m[i-1]=m[i-2]+1;
        else m[i-1]=m[i-2];
    }
    
    int ans[100010];
    for(int i=0;i<q;i++){
        int l,r;
        cin>>l>>r;
        ans[i]=m[r-2]-m[l-2];
    }
    
    for(int i=0;i<q;i++) cout<<ans[i]<<endl;
}

Measured memory_bytes: 1872
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ld pi=3.14159265358979323;
const ll mod=998244353;
int n,l;
int t[3001];
int main(){
	ios::sync_with_stdio(false);
	cin >> n >> l;
	for(int i=1; i<=n ;i++){
		cin >> t[i];
	}
	if(n==3){
		ld ax=cos(2*pi*t[1]/l),ay=sin(2*pi*t[1]/l);
		ld bx=cos(2*pi*t[2]/l),by=sin(2*pi*t[2]/l);
		ld cx=cos(2*pi*t[3]/l),cy=sin(2*pi*t[3]/l);
		ld a=sqrt((bx-cx)*(bx-cx)+(by-cy)*(by-cy));
		ld b=sqrt((ax-cx)*(ax-cx)+(ay-cy)*(ay-cy));
		ld c=sqrt((bx-ax)*(bx-ax)+(by-ay)*(by-ay));
		cout<< fixed << setprecision(10) << (a*ax+b*bx+c*cx)/(a+b+c) << ' ' << (a*ay+b*by+c*cy)/(a+b+c) << endl;
		return 0;
	}
	sort(t+1,t+n+1);
	ld x=0,y=0;
	for(int i=1; i<=n ;i++){
		for(int j=i+1; j<=n ;j++){
			x+=cos(2*pi*(t[i]+t[j])/l/2)*((n-j+i-1)*(n-j+i-2)/2-(j-i-1)*(j-i-2)/2);
			y+=sin(2*pi*(t[i]+t[j])/l/2)*((n-j+i-1)*(n-j+i-2)/2-(j-i-1)*(j-i-2)/2);
		}
	}
	cout << fixed << setprecision(10) << x/(1.0*n*(n-1)*(n-2)*(n-3))*12 << ' ' << y/(1.0*n*(n-1)*(n-2)*(n-3))*12 << endl;
}

Measured memory_bytes: 384
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N = input()
    K = int(input())
    n_len = len(N)

    dp = [[[0] * (K + 2) for _ in [0, 0]] for _ in range(n_len + 1)]
    dp[0][0][0] = 1

    for i in range(n_len):
        ni = int(N[i])
        for isLess in [0, 1]:
            for not_0 in range(K+1):
                num = 10 if isLess else ni + 1
                dp[i+1][isLess or 0 < ni][not_0] += dp[i][isLess][not_0]
                for j in range(1, num):
                    dp[i+1][isLess or j < ni][not_0+1] += dp[i][isLess][not_0]

    print(dp[n_len][1][K] + dp[n_len][0][K])

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#define mod 1000000007

int main() {
    int n; std::cin >> n;
    std::vector<int> t(n);
    int sum = 0;
    for(int i = 0;i < n; i++) {
        std::cin >> t[i];
        sum += t[i];
    }

    int m; std::cin >> m;
    std::vector<int> p(m), x(m);
    for(int i = 0; i < m; i++) {
        std::cin >> p[i] >> x[i];
    }

    for(int i = 0;i < m; i++) {
      int ans = sum;
      std::cout << ans - t[p[i]-1] + x[i] << "\n"; 
    }


}

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

int main(int argc, char const *argv[]) {
  string s;
  cin >> s;

  int length = s.length();
  for (int i = 0; i < length; i += 2) {
    cout << s[i];
  }
  cout << "\n";
  return 0;
}


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

int main(){
    long long N, K;
    long long l, r;
    long long ans;
    long long m = 998244353;
    std::cin >> N >> K;
    vector<vector<long long>> kumiawase(K + 1, vector<long long>(N,0));
    kumiawase[0][0] = 1;
    vector<long long> n_k_list(K,0);

    vector<vector<long long>> list;
    for(int i = 0 ; i < K; i++){
        std::cin >> l >> r;
        list.push_back({l, r});
        n_k_list[i] = r - l + 1;//各連続区間の数
    }

    // for(int i = 0; i < list.size(); i++){
    //     std::cout << list[i] << " ";
    // }
    // std::cout << "\n";
    //動的計画法で解く。最悪NNになりそうだけど..
    //NNになった。。
    //Kこのグループごとに行を設ける。

    for(long long i = 1; i < N; i ++){
    //    std::cout << i << "\n";
        for(long long j = 0; j < K; j++ ){
            //Kごとにループを回す。
            //iよりうしろのn_kこの数の合計を出す。
            if(i <= n_k_list[j]){
                kumiawase[j + 1][i] = kumiawase[0][i-1] + kumiawase[j + 1][i-1];
                kumiawase[j + 1][i] = kumiawase[j + 1][i]%m;
            }else{
                kumiawase[j + 1][i] = kumiawase[0][i-1] + kumiawase[j + 1][i-1] - kumiawase[0][i-n_k_list[j]-1];
                kumiawase[j + 1][i] = kumiawase[j + 1][i]%m;
            }
            //列埋め完了
            //最後に0行目を算出する。
            if(i - list[j][0] >= 0){
                //レフト前のインデックスが欄外じゃなければそのいっこ右の値を足す。
                kumiawase[0][i] = kumiawase[0][i] + kumiawase[j + 1][i - list[j][0] + 1];
                kumiawase[0][i] = kumiawase[0][i]%m;
            }else{
                
            }
        }
//        std::cout << kumiawase[i] << " ";
 
    }

    if(kumiawase[0][N - 1] < 0){
        ans = kumiawase[0][N - 1] + m;
    }else{
        ans = kumiawase[0][N - 1];
    }
    
    
    std::cout << ans << "\n";

    // for(int j = 0; j < K + 1; j++){
    //     for(int i = 0; i < 6; i++){
    //         std::cout << kumiawase[j][i] << " ";
    //     }
    //     std::cout << "\n";
    // }

}

Measured memory_bytes: 21916
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //コンソールから入れる際に高速に入れる方法

        String strArr = br.readLine();
        int a=Integer.parseInt(strArr);
      	double x = Math.PI * a * 2;

        System.out.println(x);

        }
    }

Measured memory_bytes: 25488
#include<bits/stdc++.h>
using namespace std;
int v[510][510],n;
long long f[510][510],sp[510][510],ss[510][510],ans=1e18;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)for(int j=1;j<=n;++j)if(i^j)scanf("%d",v[i]+j);
	for(int i=1;i<=n;++i)for(int j=n;j>i;--j)
		ss[i][j]=ss[i-1][j]+ss[i][j+1]-ss[i-1][j+1]+v[j][i];
	for(int i=n;i;--i)for(int j=i+1;j<=n;++j)
		sp[i][j]=sp[i+1][j]+sp[i][j-1]-sp[i+1][j-1]+v[i][j];
	for(int i=0;i<=n;++i)for(int j=0;j<=n;++j)f[i][j]=1e18;
	for(int i=1;i<=n;++i)f[i][0]=sp[1][i];
	for(int i=1;i<n;++i)for(int j=0;j<i;++j)for(int k=i+1;k<=n;++k)
		f[k][i]=min(f[k][i],f[i][j]+ss[i][k+1]-ss[j][k+1]+sp[i+1][k]);
	for(int i=0;i<n;++i)ans=min(ans,f[n][i]);
	printf("%lld",ans);
} 

Measured memory_bytes: 7296
N=int(input())
A=list(map(int,input().split()))
ans=0
right=0
sum=0
for left in range(N):
    while(right<N and (sum^A[right])==(sum+A[right])):
        sum+=A[right]
        right+=1
    ans+=right-left
    if left==right:
        right+=1
    else:
        sum-=A[left]
print(ans)


Measured memory_bytes: 77772
#ABC124C/Coloring_Colorfully
def main():
    s = [int(x) for x in input()]
    cnt = 0
    if len(s) == 1:
        print("0")
        exit()
    for i in range(len(s)-1):   #タイルの枚数分ループ
        if s[i] == 1:   #もし,そのタイルが1で
            if s[i+1] == 1: #次のタイルが1だった場合
                s[i+1] = 0  #次のタイルを0にして
                cnt+=1  #cntに1を足す
        else:
            if s[i+1] == 0:
                s[i+1] = 1
                cnt+=1
    print(cnt)
main()

Measured memory_bytes: 45020
my $input_string = <STDIN>;
chomp($input_string);

my $flag = 0;
my %str = ();

while(length($input_string) != 0){
	$s = chop($input_string);
	$str{$s} += 1;
}

my @valuelist = values(%str);

foreach(@valuelist){
	if($_ > 1){
		print "no";
		exit;
	}
}

print "yes";


Measured memory_bytes: 512
fun main(args: Array<String>) {
    var (a, b, c) = readLine()!!.split(' ').map(String::toLong).sorted()
    var count = 0
    while (true) {
        if (a % 2 == 1L || b % 2 == 1L || c % 2 == 1L) {
            println(count)
            return
        } else if (a == b && b == c) {
            println(-1)
            return
        } else {
            count++
            val tempA = a
            val tempB = b
            val tempC = c
            a = (tempC + tempB) / 2
            b = (tempA + tempC) / 2
            c = (tempA + tempB) / 2
        }
    }
}

Measured memory_bytes: 38176
import java.util.Scanner;

fun main (args : Array<String>) {
  val input = Scanner(System.`in`)
  
  while (input.hasNext()) {
    val N = input.next()
    var digitSum = 0
    
    for (d in N) {
      digitSum += d - '0'
    }
    
    if (digitSum % 9 == 0) {
      println("Yes")
    } else {
      println("No")
    }
  }
}

Measured memory_bytes: 41048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int N;
    cin >> N;
    vector<int> A(N + 1);
    for (int i = 0; i < N + 1; ++i) cin >> A[i];
    if (N < 63 && (ll)A[N] > (1ll << N)) {
        cout << -1 << endl;
        return 0;
    }
    vector<ll> ma(N + 1), mi(N + 1);
    ma[N] = A[N];
    mi[N] = A[N];
    for (int i = N; i > 0; --i) {
        mi[i - 1] = max(1ll, (mi[i] + 1) / 2 + A[i - 1]);
        ma[i - 1] = ma[i] + A[i - 1];
        if (i < 63) ma[i - 1] = min(ma[i - 1], 1ll << (i - 1));
        if (mi[i - 1] > ma[i - 1]) {
            cout << -1 << endl;
            return 0;
        }
    }
    ll ans = 1;
    ll x = 1;
    for (int i = 1; i < N + 1; ++i) {
        x = min(x * 2, ma[i]);
        if (x < mi[i]) {
            ans = -1;
            break;
        }
        ans += x;
        x -= A[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 5092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  cout << setprecision(15);
  ll n; 
  cin >> n;
  string s;
  cin >> s;

  vector<ll> W(n);
  ll W_sum = 0;
  for (ll i = 0; i < n; ++i) {
    W[i] = W_sum;
    if (s[i] == 'W') W_sum++;
  }
  
  vector<ll> E(n);
  ll E_sum = 0;
  for (ll i = n-1; i >= 0; --i) {
    E[i] = E_sum;
    if (s[i] == 'E') E_sum++;
  }

  ll ans = n;
  for (ll i = 0; i < n; ++i) {
    ans = min(ans, W[i] + E[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5380
#include <vector>
#include <iostream>
using namespace std;
int main(){
    int q,p;
    int di;
    int f = 0,count;
    vector<int> devide,remain;
    vector<int>::iterator it;
    while((cin >> p >> q)) {
        devide.clear();
        remain.clear();
        while(true) {
            count = 0;
            f = 0;
            di = p/q;
            p = p%q*10;
            it = remain.begin();
            while(it != remain.end()) {
                ++count;
                if (*it == p) {
                    f = 1;
                    break;
                }
                ++it;
            }
            devide.push_back(di);
            if (p == 0 || f == 1) {
                break;
            }
            remain.push_back(p);
        }
        it = devide.begin()+1;
        while(it != devide.end()) {
            cout << *it;
            ++it;
        }
        cout << endl;
        if (f == 1) {
            int i;
            for(it = devide.begin()+1, i = 0; it != devide.end() ; ++it, ++i) {
                if (i < count-1) {
                    cout << " ";
                }
                else {
                    cout << "^";
                }
            }
            cout << endl;
        }
    }
}

Measured memory_bytes: 1220
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>

#define X first
#define Y second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())

// stoi(s): string to int
// stod(s): string to double

// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    }
    vsort(v);
    
    int min = INT_MAX;
    for (int i = 0; i + k - 1 < n; i++) {
        if (v[i+k-1] - v[i] < min) {
            min = v[i+k-1] - v[i];
        }
    }
    cout << min << endl;
}


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

using namespace std;

int main() {
  vector<int> d(4);
  for (int i = 0; i < 4; i++) {
    cin >> d[i];
  }
  sort(d.begin(), d.end());
  vector<int> ans{1, 4, 7, 9};
  puts(ans == d ? "YES" : "NO");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; for(auto v : V) os << v << " "; return os << "]"; }
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; for(auto s:S) os<<s<<" ";return os<<"}"; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) { return os << "(" << P.first << "," << P.second << ")";}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) { os << "{ "; for(auto m:M) os<<"("<<m.first<<":"<<m.second<<") "; return os<<"}"; }
#ifdef LMAO
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){ const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | "; __f(comma+1, args...); }
#else
    #define trace(...) 42
#endif
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define endl "\n"
#define tcase int tt; cin>>tt; while(tt--)
#define tcase2 int tt; cin>>tt; for(int qq=1;qq<=tt;qq++)
#define all(x) x.begin(), x.end()
typedef long long int ll;
typedef  unsigned long long int ull;
typedef long double ld;
const int MAX = 1000010;
const int MOD2 = 998244353;
const int MOD = 1000000007; 
const int INF = 1e8;    
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-7;
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)   
/*****************start************/
void solve()
{
    int n;
    cin>>n;
    vector<int> freq(n+2,0);
    for(int i=1;(i+1)*(i+1)+2<=n;i++)
    {
        for(int j=1;(j+1)*(j+1)+2<=n;j++)
        {
            for(int k=1;(k+1)*(k+1)+2<=n;k++)
            {
                int id=(i+j)*(i+j)+(i+k)*(i+k)+(j+k)*(j+k);
                id/=2;
                if(id<=n)
                freq[id]++;
            }
        }
    }
    for(int i=1;i<=n;i++)
        cout<<freq[i]<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);cout<<fixed<<setprecision(25);cerr<<fixed<<setprecision(10);
    auto start = std::chrono::high_resolution_clock::now();
    // tcase{
        solve();
    // }
    auto stop = std::chrono::high_resolution_clock::now(); 
    auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start); 
    // cerr << "Time taken : " << ((long double)duration.count())/((long double) 1e9) <<"s "<< endl;     
    return 0;
}


Measured memory_bytes: 3612
import sys
n = int(input())
wList = list(map(int,input().split()))
minInt = sum(wList)
for i in wList:
  minInt -= i * 2
  if minInt < 0:
    if -minInt > minInt + i * 2:
      print(minInt + i * 2)
    else:
      print(-minInt)
    sys.exit()

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

int main(){
  int n,K;
  cin >> n >> K;
  int x[n];
  int plus = 0,zero = 0,minus = 0;
  for(int i=0;i<n;i++){
    cin >> x[i];
    if(x[i] > 0){
      plus++;
    }else if(x[i] < 0){
      minus++;
    }else{
      zero++;
    }
  }
  
  int time = 0;
  int minTime = 1000000001;
  int width;
  //0以上から始まる区間
  if(minus+K-1 < n){
    minTime = min(minTime,x[minus+K-1]);
  }
  //0未満の区間
  if(minus+zero-K>=0){
    minTime = min(minTime,-x[minus+zero-K]);
  }
  //0をまたぐ区間
  for(int i=0;i<minus && i+K-1 < n;i++){
    if(x[i]<=0 && x[i+K-1]>=0){
      width = min(-x[i],x[i+K-1]);
      minTime = min(minTime,x[i+K-1]-x[i]+width);
    }
  }
  cout << minTime;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if((a == b && b == c) || (a != b && b != c && a != c)){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

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

int n;
string s;

int main()
{
	scanf("%d",&n);
	cin>>s;
	for(int i=0;i<s.size();++i) {
		if(s[i]+n>'Z') s[i]-=26;
		putchar(s[i]+n);
	}
}

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

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

fn main() {
    input! {
        n: u32,
        plans: [(i32, i32, i32); n],
    }
    let mut pt = 0;
    let mut px = 0;
    let mut py = 0;
    for (ct, cx, cy) in plans {
        let (dt, dx, dy) = (ct - pt, cx - px, cy - py);
        let dd = dx.abs() + dy.abs();
        if dt < dd || (dt - dd) % 2 != 0 {
            println!("No");
            return;
        }
        pt = ct;
        px = cx;
        py = cy;
    }
    println!("Yes");
}


Measured memory_bytes: 4460
#include <bits/stdc++.h>
#define INF 1000000000000000001
#define ll long long
#define pll pair<ll, ll>
using namespace std;

ll N, A, B, C;
ll mp(vector<ll>& which_stick, vector<ll>& L)
{
  ll res = -30;
  vector<ll> length(3, 0);
  for (ll i = 0; i < N; ++i)
  {
    if (which_stick.at(i) == 3)
    {
      continue;
    }
    res += 10;
    length.at(which_stick.at(i)) += L.at(i);
  }
  for (ll i = 0; i < 3; ++i)
  {
    if (length.at(i) == 0)
    {
      return INF;
    }
  }
  res += abs(A - length.at(0)) + abs(B - length.at(1)) + abs(C - length.at(2));
  return res;
}

void next(vector<ll>& which_stick)
{
  which_stick.at(N - 1) += 1;
  for (ll i = N - 1; i >= 0; --i)
  {
    if (which_stick.at(i) < 4)
    {
      return;
    }
    if (i == 0)
    {
      which_stick.at(0) = -1;
      return;
    }
    which_stick.at(i) %= 4;
    which_stick.at(i - 1) += 1;
  }
  return;
}

int main()
{
  cin >> N >> A >> B >> C;
  vector<ll> L(N);
  vector<ll> which_stick(N, 0);
  ll pattern = pow(4, N);
  for (ll i = 0; i < N; ++i)
  {
    cin >> L.at(i);
  }
  ll ans = INF;
  for (ll i = 0; i < pattern; ++i)
  {
    ans = min(ans, mp(which_stick, L));
    next(which_stick);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

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

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll n,a,b; cin >> n >> a >> b;
  
  cout << min(a,b) << ' ' << max(0LL,a+b-n) << endl;
  
  
}

Measured memory_bytes: 3604
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n, m;
    cin >> n >> m;
    int k;
    cin >> k;
    vector<int>a(n),b(m);
    rep(i,n)cin >> a[i];
    rep(i,m)cin >> b[i];
    int id = 0;
    int sum = 0;
    while(id < m and sum + b[id] <= k)sum += b[id++];
    int ans = id;
    for(int i = 0; i < n; i++){
        sum += a[i];
        while(sum>k and id>=1){
            sum -= b[--id];
        }
        if(sum>k)break;
        ans = max(ans, i + 1 + id);
    }
    cout << ans << endl;
}


Measured memory_bytes: 4816
#include <bits/stdc++.h>
#define ll long long
using namespace std;


ll mod = 1e9+7;

ll gcd(ll a,ll b){
	if(b==0)return a;return gcd(b,a%b);
}
ll expo(ll base,ll pow){
    ll ans = 1;
    while(pow!=0){
        if(pow&1==1){ans = ans*base;}
        base *= base;pow/=2;}return ans;
}
ll inv(ll x){return expo(x,mod-2);}

int arr[123456];


int main(){
    //freopen("ip.txt", "rt", stdin);
    //freopen("op.txt", "wt", stdout);
    int n;
    cin >> n;
    if(n/10 == 9 || n%10 == 9) cout << "Yes";
    else cout << "No";
}


Measured memory_bytes: 256
N, Y = map(int, input().split())
x, y, z = -1, -1, -1

for i in range(N + 1):
	for j in range(N + 1 - i):
		k = (Y - i * 10000 - j * 5000) / 1000
		if k == N - i - j:
			x, y = i, j
			z = int(k)
			break
	else:
		continue
	break

print(x, y, z)

Measured memory_bytes: 73676
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	for(int i = 0; i < 5; i++)
	{
		int x; cin >> x;
		if(!x)
		{
			cout << i + 1;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
long long int K;
long long int p[50];
int N;

int main()
{
    while(scanf("%lld",&K)==1)
    {
        N=50;
        long long int jieceng=K/50+N-1;
        K=K%50;
        for(int i=0;i<50;i++)
            if(i<K)
                p[i]=jieceng+N-K+1;
        else
            p[i]=jieceng-K;

        printf("50\n");
        for(int i=0;i<50;i++)
            printf("%lld ",p[i]);
            printf("\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>

using namespace std;

typedef long long ll;

ll p = 998244353;

ll fact[300005];

ll extgcd(ll a, ll b, ll& x, ll& y) {
  ll d = a;
  if (b != 0) {
    d = extgcd(b, a%b, y, x);
    y -= (a/b) * x;
  } else {
    x = 1; y = 0;
  }
  return d;
}

ll mod_inverse(ll a, ll m) {
  ll x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}

ll mod_fact(ll n, ll p, ll& e) {
  e = 0;
  if (n == 0) return 1;
  ll res = mod_fact(n/p, p, e);
  e += n/p;
  if (n / p % 2  != 0) return res * (p - fact[n % p]) % p;
  return res * fact[n % p] % p;
}

ll nCk(ll n,ll k) {
  if(n < 0 || k < 0 || n < k) return 0;
  ll e1, e2, e3;
  ll a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2), a3 = mod_fact(n - k, p, e3);
  if (e1 > e2 + e3) return 0;
  return a1 * mod_inverse(a2 * a3 % p, p) % p;
}

int main(){
  ll N, A, B, K;
  scanf("%lld%lld%lld%lld", &N, &A, &B, &K);
  fact[0] = 1;
  for (ll i = 0; i < N; i++) {
    fact[i+1] = (fact[i] * (i+1)) % p;
  }
  ll ans = 0;
  for (ll i = 0; i <= N; i++) { // the number of A
    ll temp = K - i * A;
    if (temp % B != 0) continue;
    ll j = temp / B; // the number of B
    if (j > N || j < 0) continue;
    ans += (nCk(N, i) * nCk(N, j) ) % p;
  }
  printf("%lld\n", ans % p);
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int A, B, Q; ll X;
ll S[int(1e5+5)], T[int(1e5+5)];

int SL, SR, TL, TR;

int Solve(){
  SL = 0; SR = A + 1;
  while (SR - SL > 1){
    int now = (SL + SR) / 2;
    if (S[now] <= X) SL = now;
    else SR = now;
  }
  TL = 0; TR = B + 1;
  while (TR - TL > 1){
    int now = (TL + TR) / 2;
    if (T[now] <= X) TL = now;
    else TR = now; 
  }

  return 0;
}

int main(){
  cin >> A >> B >> Q;
  S[0] = -1e10;
  for (int i = 1; i <= A; i++) cin >> S[i];
  S[A + 1] = 1e11;

  T[0] = -1e10;
  for (int i = 1; i <= B; i++) cin >> T[i];
  T[B + 1] = 1e11;

  for (int i = 0; i < Q; i++){
    cin >> X;
    Solve();

    ll ans = max(S[SR] - X, T[TR] - X);
    ans = min(ans, max(X - S[SL], X - T[TL]));

    ans = min(ans, (T[TR] - X) * 2 + (X - S[SL]));
    ans = min(ans, (X - S[SL]) * 2 + (T[TR] - X));
    ans = min(ans, (S[SR] - X) * 2 + (X - T[TL]));
    ans = min(ans, (X - T[TL]) * 2 + (S[SR] - X));

    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 5152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		for(int i=1;i<=n;i++) {
			for(int j=1;j<=n;j++) {
				if(i*j < n) {
					ans++;
				}
				else {
					break;
				}
			}
		}
		
		System.out.println(ans);
	}
}


Measured memory_bytes: 35624