akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(void)
{
    int a,b;
    cin>>a>>b;
    if((a*b)&1)
    {
        cout<<"Odd"<<endl;
    }
    else
    {
        cout <<"Even"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int n,m,x,y,a[100],b[100];
	cin>>n>>m>>x>>y;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	
	for(int i=0;i<m;i++){
		cin>>b[i];
	}
	
	for(int z=x+1;z<=y;z++){
		int flag=1;
		for(int i=0;i<n;i++){
			if(z<=a[i]){
				flag=0;
			}
		}
		
		for(int j=0;j<m;j++){
			if(b[j]<z){
				flag=0;
			}
		}
		
		if(flag==1){
			cout<<"No War"<<endl;
			return 0;
		}
	}
	
	cout<<"War"<<endl;
	
}

Measured memory_bytes: 256
#include <stdio.h>

int A[1000000],n;

int dob(int);

int main()
{
  int i,q,k,sum = 0;

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

  scanf("%d",&q);
  for(i=0;i<q;i++)
    {
      scanf("%d",&k);
      if(dub(k)) sum++;
    }
  printf("%d\n",sum);

  return 0;
}

int dub(int key)
{
  int left = 0;
  int right = n;
  int mid;
  while(left<right)
    {
      mid = (left+right)/2;
      if(key==A[mid]) return 1;
      if(key > A[mid]) left = mid+1;
      else if (key <A[mid]) right=mid;
    }
  return 0;
}



Measured memory_bytes: 2088
#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int MAXN = (int) 2e2;
const int MAXR = (int) 8;
const int INF = (int) 1e9;

int dst[2][MAXN + 1][MAXN + 1];

int v[MAXR];

int dp[1 << MAXR][MAXR];

char lg[(1 << MAXR) + 1];

vector <int> bits;

int main() {
    //fstream cin("A.in");
    //ofstream cout("A.out");
    int n, i, j, m, r;
    ios::sync_with_stdio(false);
    cin >> n >> m >> r;
    for(i = 0; i < r; i++)
        cin >> v[i];
    for(i = 1; i <= m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        dst[0][a][b] = c;
        dst[0][b][a] = c;
    }
    for(i = 1; i <= n; i++)
        for(j = 1; j <= n; j++)
             if(i != j && dst[0][i][j] == 0)
                 dst[0][i][j] = INF;
    for(int k = 1; k <= n; k++)
        for(i = 1; i <= n; i++)
           for(j = 1; j <= n; j++)
               dst[k & 1][i][j] = min(dst[1 - k & 1][i][k] + dst[1 - k & 1][k][j], dst[1 - k & 1][i][j]);
    for(i = 1; i <= r; i++)
        lg[1 << i] = i;
    for(i = 0; i < r; i++)
        dp[1 << i][i] = 0;
    for(int conf = 1; conf < (1 << r); conf++)
       if(conf & (conf - 1)) {
           int cnf = conf;
           bits.clear();
           while(cnf > 0) {
                int lsb = (cnf & (-cnf));
                char bit = lg[lsb];
                bits.push_back(bit);
                cnf -= lsb;
           }
           for(auto it : bits) {
                dp[conf][it] = INF;
                for(auto it1 : bits)
                    if(it != it1)
                        dp[conf][it] = min(dp[conf][it], dp[conf ^ (1 << it)][it1] + dst[n & 1][v[it1]][v[it]]);
           }
       }
     int ans = dp[(1 << r) - 1][0];
     for(i = 0; i < r; i++)
        ans = min(ans, dp[(1 << r) - 1][i]);
     cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


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

//$%U%$, $%D%$/$%M%$/$%Y%$, $%h%$:$%m%$:$%s%$

using namespace std;

#define inn(n)         int n; cin >> n;
typedef long long      ll;
typedef vector<int>    vi;
typedef pair<int, int> pi;

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

    int arr[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    inn(n);
    cout << arr[n-1];
    	
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#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 <atomic>
#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>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 100100100;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int f(int n) {
  if (n % 2 == 0) {
    return n / 2;
  } else {
    return 3 * n + 1;
  }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int s;
    int count = 1;
    cin >> s;
    vector<int> m(100000);
    while (m[s - 1] == 0) {
      m[s - 1] = 1;
      s = f(s);
      count++;
    }

    cout << count << '\n';

    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll dp[222][101010];

int main(){
    int n,x;
    cin>>n>>x;
    int a[n];
    rep(i,n)cin>>a[i];
    sort(a,a+n);
    reverse(a,a+n);
    dp[0][x]=1;
    rep(i,n){
        int c=n-i-1;
        rep(j,101010){
            (dp[i+1][j]+=c*dp[i][j])%=mod;
            (dp[i+1][j%a[i]]+=dp[i][j])%=mod;
        }
    }
    ll ans=0;
    rep(i,101010)ans+=dp[n][i]*i%mod;
    cout<<ans%mod<<endl;
    return 0;
}

Measured memory_bytes: 159232
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test ll t; cin>>t; while(t--)
using namespace std;
int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
int main() 
{ 
	ll n;
	cin>>n;
	ll res=0,g;
	for(ll i=1; i<=n; i++){
		for(ll j=1; j<=n; j++){
			for(ll k=1; k<=n; k++){
				g=gcd(i,j);
				res+=gcd(g,k);
			}
		}
	}
	cout<<res<<endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  sort(a,a+n);
  cout<<a[n-1]-a[0]<<endl;
}

Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().toInt
  val a = (0 until n).map(_ => StdIn.readLine().toInt)
  val ap = Array.fill(n)(0)

  def solve(i: Int, cnt: Int): Int = {
    if (ap(i) == 1) -1
    else if (a(i) == 2) cnt + 1
    else {
      ap(i) = 1
      solve(a(i) - 1, cnt + 1)
    }
  }
  println(solve(0, 0))

}


Measured memory_bytes: 37824
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let vs: Vec<u16> = s.trim().split_whitespace().map(|token| token.parse().ok().unwrap()).collect();
    print!("{}", vs[0] * vs[1] / 2);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int gcd(int a, int b) {
    int tmp;
    if(a < b){
        tmp = a;
        a = b;
        b = tmp;
    }
    return b != 0 ? gcd(b, a % b) : a;
}

int main(){
    int k;
    cin >> k;
    ll ans = 0;
    reps(x,1,k+1){
        reps(y,1,k+1){
            reps(z,1,k+1){
                ans += gcd(gcd(x,y),z);
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>

using namespace std;

int main(void){

  int a,b,c,d;
  cin>>a;
  cin>>b;
  cin>>c;
  cin>>d;

  if(abs(c-a) <= d){

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

  return 0;
}


Measured memory_bytes: 764
#include<stdio.h>

int main(void) {

  int N;
  char S[110];
  scanf("%d",&N);
  scanf("%s",S);

  int x = 0;
  int max = 0;
  int i;
  for(i=0;i<N;i++){
    if(S[i]=='I'){
      x++;
    } else{
      x--;
    }
    if(x>max){
      max = x;
    }
  }
  
  printf("%d\n",max);

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
using namespace std;
int m1 = -1;
int m2 = -2;
int m3 = -3;
int m;

int main() {
    for (int i=0; i<10; i++) {
        cin >> m;
        if(m1 < m) {
            m3 = m2;
            m2 = m1;
            m1 = m;
        }
        else if(m2 < m) {
            m3 = m2;
            m2 = m;
        }
        else if(m3 < m) m3 = m;
    }
    cout << m1 << "\n" << m2 << "\n" << m3 << endl;

}



Measured memory_bytes: 3076
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String res = (S.charAt(0) == S.charAt(1)) || (S.charAt(1) == S.charAt(2)) || (S.charAt(2) == S.charAt(3)) ? "Bad" : "Good";
        System.out.println(res);
    }
}


Measured memory_bytes: 23124
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
	int n,a,b,ans=0;
	cin >> n >> a >> b;
	for(int i=1;i<=n;i++)
	{
		int t=i/10000+i/1000%10+i/100%10+i/10%10+i%10;
		if(t<=b&&t>=a)
			ans+=i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import static java.util.Arrays.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	void solve() {
		double x = sc.nextDouble();
		double h = sc.nextDouble();
		if (x == 0) return;

		double l = Math.sqrt(h * h + x * x / 4);
		double res = x * x + 2 * x * l;
		System.out.println(res);
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

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

int main(){
  int N,W;
  cin >> N >> W;
  vector<int> w(N),v(N);
  for (int i = 0; i < N; i++)
  {
    cin >> w[i] >> v[i];
  }

  const long long INF = 1e17;
  vector<vector<long long>> dp(N+1,vector<long long>(100010,INF));
  dp[0][0] = 0;
  for (int i = 0; i < N; i++)
  {
    for (int j = 0; j < 100010; j++)
    {
      if(j>=v[i]) dp[i+1][j] = min(dp[i][j],dp[i][j-v[i]]+w[i]);
      else dp[i+1][j] = dp[i][j];
    }
  }
  long long ans = 0;
  for (int j = 0; j <= 100000; j++)
  {
    if(dp[N][j]<=W) ans = j;
  }
  cout << ans << endl;
}

Measured memory_bytes: 80256
/*░░░░░░░▄▄▄▀▀▀▄▄███▄
░░░░░▄▀▀░░░░░░░▐░▀██▌
░░░▄▀░░░░▄▄███░▌▀▀░▀█
░░▄█░░▄▀▀▒▒▒▒▒▄▐░░░░█▌
░▐█▀▄▀▄▄▄▄▀▀▀▀▌░░░░░▐█▄
░▌▄▄▀▀░░░░░░░░▌░░░░▄███████▄
░░░░░░░░░░░░░▐░░░░▐███████████▄
░░░░░le░░░░░░░▐░░░░▐█████████████▄
░░░░toucan░░░░░░▀▄░░░▐██████████████▄
░░░░░░has░░░░░░░░▀▄▄████████████████▄
░░░░░arrived░░░░░░░░░░░░█▀██████*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

const int MAXN = 100 * 1000 + 7;
int a[MAXN];
int main()
{
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
#endif
	int n, x;
	scanf("%d %d", &n, &x);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
	}
	ll res = 0;
	for (int i = 2; i <= n; i++)
	{
		ll more = a[i] + a[i - 1] - x;
		if (more < 0) continue;
		if (more <= a[i])
		{
			a[i] -= more;
		}
		else
		{
			res += a[i];
			more -= a[i];
			a[i] = 0;
			a[i - 1] -= more;
		}
		res += more;
	}
	printf("%lld\n", res);
}


Measured memory_bytes: 768
#include<stdio.h>


int main(){

  int n, a, i, hai=0, cha=0, mid=0, miz=0, ao=0, ki=0, o=0, aka=0, c=0, min;

  scanf("%d", &n);

  for(i=0;i<n;i++){
    scanf("%d", &a);
    if(1<=a&&a<=399) hai=1;
    if(400<=a&&a<=799) cha=1;
    if(800<=a&&a<=1199) mid=1;
    if(1200<=a&&a<=1599) miz=1;
    if(1600<=a&&a<=1999) ao=1;
    if(2000<=a&&a<=2399) ki=1;
    if(2400<=a&&a<=2799) o=1;
    if(2800<=a&&a<=3199) aka=1;
    if(3200<=a) c++;
  }

  min=hai+cha+mid+miz+ao+ki+o+aka;
  if(min==0) printf("%d %d\n", min+1, min+c);
  else printf("%d %d\n", min, min+c);

  return 0;
}


Measured memory_bytes: 128
read a b k
for i in `seq $((k/2))`
do
    a=$((a/2))
    b=$((b+a))
    b=$((b/2))
    a=$((a+b))
done
if((k%2))
then
    a=$((a/2))
    b=$((b+a))
fi
echo $a $b

Measured memory_bytes: 3832
import java.io.*;

class Main{
	public static void main(String arga[])throws IOException{
		
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	String str = br.readLine();
	int x = Integer.parseInt(str);

	int y = x*x*x;

	System.out.println(y);
	}
}

Measured memory_bytes: 24236
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  map<int,int> cnt;
  int mi = 1 << 30;
  for(int i = 0; i < N; i++) {
    mi = min(mi, A[i]);
    cnt[A[i] - mi]++;
  }
  cout << (*(--cnt.end())).second << endl;
  return 0;
}

Measured memory_bytes: 5376
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<utility>//swapでaとbの値を入れ替える
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whie(a) vector<vector<int>>

int f(int x,vector<int> s) {
	if (x == 0)return 0;
	if (x == 1)return 1;
	if (s[x] != 0)return s[x];
	s[x] = f(x - 1,s) + f(x - 2,s);
	return s[x];
}

int gcd(int a, int b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}


int main() {
	int n;
	ll ans = 1000000000;
	cin >> n;
	hei(int) a(n);
	rep(i, 0, n)cin >> a[i];
	sort(a);
	reverse(a);
	int x = a[0];
	rep(i, 1, x + 1) {
		ll y = 0;
		rep(j, 0, n) {
			y += (i - a[j]) * (i - a[j]);
		}
		ans = min(ans, y);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * @author ??\???
 *
 */
public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		for (int i = 1, x = scanner.nextInt(); x != 0; i++, x = scanner.nextInt()) {
			System.out.println("Case " + i + ": " + x);
		}
		scanner.close();
	}

}

Measured memory_bytes: 44772
#include<bits/stdc++.h>
using namespace std;
long long a[100005],b[100005],c[100005],d[100005];
int main(){
	int n;scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%lld",a+i);
	for(int i=1;i<=n;++i)scanf("%lld",b+i);
	for(int i=1;i<=n;++i)scanf("%lld",c+i);
	sort(a+1,a+n+1);sort(b+1,b+n+1);sort(c+1,c+n+1);
	for(int i=n,j=n;i;--i){while(j&&c[j]>b[i])--j;d[i]=n-j+d[i+1];}
	for(int i=n,j=n;i;--i){while(j&&b[j]>a[i])--j;c[i]=d[j+1]+c[i+1];}
	cout<<c[1];
	return 0;
}

Measured memory_bytes: 3328
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main(){

    input!{
        n: usize,
        s: chars,
    }

    let mut cnt = 0;
    for i in 2..n{
        if s[i-2]=='A' && s[i-1]=='B' && s[i]=='C' {
            cnt += 1;
        }
    }

    println!("{}", cnt);
}

Measured memory_bytes: 4352
#include <cstdio>

using namespace std;

char s[100001];
char t[100001];

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

int main() {
    int n, m, g, i, j;
    
    scanf("%d %d", &n, &m);
    scanf("%s", s);
    scanf("%s", t);
    
    g = gcd(n, m);
    
    for (i = 0; i < g; i++) {
        if (s[n / g * i] != t[m / g * i]) {
            puts("-1");
            
            return 0;
        }
    }
    
    printf("%lld\n", (long long)n * m / g);
    
    return 0;
}


Measured memory_bytes: 384
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		List<List<int>> L = new List<List<int>>();
		bool[] used = new bool[N];
		for(int i=0;i<N;i++){
			if(used[i]) continue;
			var l = new List<int>();
			int now = i;
			while(true){
				l.Add(now);
				used[now] = true;
				if(!used[P[now]]){
					now = P[now];
					continue;
				}
				break;
			}
			L.Add(l);
		}
		
//foreach(var l in L) Console.WriteLine(String.Join("-", l));
		
		int[] compo = new int[N];
		int[] idx = new int[N];
		
		for(int i=0;i<L.Count;i++){
			for(int j=0;j<L[i].Count;j++){
				compo[L[i][j]] = i;
				idx[L[i][j]] = j;
			}
		}
		
		
		long[] ans = new long[N];
		for(int i=0;i<N;i++){
			var l = L[compo[i]];
			int i0 = idx[i];
			long peri = l.Count;
			if(K <= peri){
				long tot = 0;
				ans[i] = -(long) 2e18;
				for(int j=0;j<K;j++){
					int pos = (i0 + 1 + j) % l.Count;
					tot += C[l[pos]];
					ans[i] = Math.Max(ans[i], tot);
				}
			} else {
				long tot = 0;
				ans[i] = -(long) 2e18;
				for(int j=0;j<peri;j++){
					int pos = (i0 + 1 + j) % l.Count;
					tot += C[l[pos]];
					ans[i] = Math.Max(ans[i], tot);
				}
				
				long full = 0;
				for(int j=0;j<l.Count;j++){
					int pos = (i0 + 1 + j) % l.Count;
					long c1 = K / peri;
					long c2 = (K % peri) > j ? 1 : 0;
					//Console.WriteLine("i:{0}, j:{1}, peri:{2}, c1:{3}, c2:{4}, pos:{5}, l[pos]:{6}",i,j,peri,c1,c2,pos,l[pos]);
					full += (c1 + c2)* C[l[pos]];
				}
				ans[i] = Math.Max(ans[i], full);
				for(int j=0;j<l.Count;j++){
					int pos = (int)( (i0 + K - j + l.Count) % l.Count);
					full -= C[l[pos]];
					ans[i] = Math.Max(ans[i], full);
				}
				
				
			}
			//Console.WriteLine(ans[i]);
		}
		
		Console.WriteLine(ans.Max());
		
	}
	int N;
	long K;
	int[] P;
	long[] C;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1];
		P = ria();
		for(int i=0;i<N;i++) P[i] -= 1;
		C = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 29572
# 解説参照
k = int(input())
n = len(input())

mod = 10 ** 9 + 7
f = [1] + [1]
for i in range(2, n + k + 1 + 26):
    f.append(f[-1] * i % mod)

inv = [0] + [1]
for i in range(2, n + k + 2 + 26):
    inv += [inv[mod % i] * (mod - int(mod / i)) % mod]

inv_f = [1, 1]
for i in range(2, n + k + 2 + 26):
    inv_f.append(inv_f[-1] * inv[i] % mod)


def c(x, y):
    return f[x] * inv_f[x - y] * inv_f[y]


ans = 0

for i in range(k + 1):
    ans += c(n + k - i - 1, n - 1) * pow(25,k-i,mod)*pow(26,i,mod)

print(ans % mod)

Measured memory_bytes: 223232
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

string in;

bool check(){
  int p = 0;
  int edge[6][2] = {{1, 3}, {-1, 2}, {4, 5}, {1, -1}, {5, 3}, {3, 1}};
  for(int i=0;i<in.size();i++){
    p = edge[p][in[i]-'0'];
    if(p == -1) return false;
  }
  return p == 5;
}

main(){
  while(cin >> in){
    if(in == "#") break;
    cout << (check() ? "Yes" : "No") << endl;
  }
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
  double x;
    cin >> x;
    
    double pie = acos(-1);
    
    cout << precise(10) << (2*pie*x);
    
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Measured memory_bytes: 3808
class Factorial:
    def __init__(self,n,mod):
        self.f=[1]
        self.mod=mod
        for i in range(1,n+1):
            self.f.append(self.f[-1]*i%mod)
        self.i=[pow(self.f[-1],mod-2,mod)]
        for i in range(1,n+1)[::-1]:
            self.i.append(self.i[-1]*i%mod)
        self.i.reverse()
    def factorial(self,i):
        return self.f[i]
    def ifactorial(self,i):
        return self.i[i]
    def comb(self,n,k):
        return self.f[n]*self.i[n-k]%self.mod*self.i[k]%self.mod if n>=k else 0
M=10**9+7
n,k,*a=map(int,open(0).read().split())
comb=Factorial(n,M).comb
s=0
for i,a in enumerate(sorted(a)):
    s+=a*comb(i,k-1)-a*comb(~i+n,k-1)
    s%=M
print(s)

Measured memory_bytes: 16492
import java.util.Scanner;

class Main{
	static boolean isSQ(int s) {
		int tmp = (int)Math.sqrt(s);
		return tmp * tmp == s;
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next(), b = sc.next();
		System.out.println(isSQ(Integer.valueOf(a.concat(b))) ? "Yes" : "No");
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<set>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF 1000000100
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
    int a;
    string s;
    cin >> a;
    cin >> s;
    if(a>=3200) cout << s << endl;
    else cout << "red" << endl;
    return 0;
    
}

Measured memory_bytes: 3168
#include<iostream>

int main(){

	for (int i = 0; i < 4; i++){

		int t, n;
		std::cin >> t >> n;

		if (t == 1)std::cout << 6000 * n << std::endl;
		if (t == 2)std::cout << 4000 * n << std::endl;
		if (t == 3)std::cout << 3000 * n << std::endl;
		if (t == 4)std::cout << 2000 * n << std::endl;

	}

	return 0;
}

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

int main(){
    vector<pair<long long, long long>> shop;
    int n, m;
    cin >> n >> m;
    int num=0;
    long long sum = 0;

    for (auto i = 0; i < n; i++)
    {
        pair<long long, long long> p;
        long long a, b;
        cin >> a >> b;
        p.first = a;
        p.second = b;
        shop.push_back(p);
    }

    sort(shop.begin(), shop.end());

    for (auto i = 0; i < n; i++)
    {
        if(num + shop[i].second >= m){
            sum += shop[i].first * (m - num);
            break;
        }else{
            num += shop[i].second;
            sum += shop[i].first * shop[i].second;
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 2420
inp=input()
a,b,c,d=[int(i) for i in inp]

for i in range(8):
    calc=a
    B=bin(i)[2:].zfill(3)
    calc=calc+b if B[0]=="0" else calc-b
    calc=calc+c if B[1]=="0" else calc-c
    calc=calc+d if B[2]=="0" else calc-d
    if calc==7:
        break

Operator=["+" if i=="0" else "-" for i in B]
Operator.append("=7")
ans=""
for num, op in zip(inp, Operator):
    ans+=num
    ans+=op
print(ans)


Measured memory_bytes: 3064
#!/usr/bin/env python3
# -*- coding: utf-8-*-
if __name__ == '__main__':
    n, q = map(int, input().split(" "))
    s = input()
    c = [0]
    ql = []
    for i in range(q):
        r, l = map(int, input().split(" "))
        ql.append((r,l))
    for i in range(1, len(s)):
        if s[i-1:i+1] == "AC":
            c.append(c[i-1]+1)
        else:
            c.append(c[i-1])
    for r, l in ql:
        print(c[l-1] - c[r-1])


Measured memory_bytes: 19832
# coding: utf-8
# Your code here!
s=input()
lists=[]
for i in range(len(s)):
    lists.append(s[i])
    
t=input()
listt=[]
for j in range(len(t)):
    listt.append(t[j])
    
lists.sort()
listt.sort(reverse=True)

list1=[lists,listt]
list1.sort()
if lists==listt:
    print("No")
elif list1[0]==lists:
    print("Yes")
else:
    print("No")


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

int main() {
  int N, K;
  cin >> N >> K;
  double ans = 0;
  for (int i = 1; i <= N; i++) {
    int cnt = 0, tmp = i;
    while (tmp <= K - 1) {
      cnt++;
      tmp *= 2;
    }
    ans += pow(0.5, cnt);
  }
  cout << setprecision(12) << ans / N << endl;
}

Measured memory_bytes: 4300
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s; cin >> s;
	long long ans = 0;
	int tot = 0;
	for (int i = 0; i < s.length(); i++){
		if (i != s.length() - 1 && s[i] == 'B' && s[i + 1] == 'C'){
			ans += tot, i++;
		} else {
			if (s[i] != 'A') tot = 0;
			else tot++;
		}
	}
	cout << ans << endl;
	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP0(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(int i=n-1; i>=0; --i)
#define RREP1(i,n) for(int i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define FILL(c, v) fill((c).begin(),(c).end(), v)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;

const int INTINF = 1e9;
const LL LLINF = 1e18;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

void solve()
{
    LL H; int N; cin >> H >> N;
    REP0(i, N)
    {
        int A; cin >> A;
        H -= A;
        if (H <= 0)
        {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
    solve();
    return 0;
}


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

int main(void){
  int i,result;
  string s;
  string t;

  cin >> s;
  cin >> t;

  result=0;

  for(i=0;i<3;i++){
    if(s[i]==t[i]){
      result=result+1;
    }
  }

  cout << result << "\n";

  return 0;
}

Measured memory_bytes: 256
N,K=map(int, input().split())
A=list(map(int, input().split()))
A=sorted(A)
import numpy as np
A=np.array(A,dtype="int64")
Z=A[A==0]
H=A[A<0]
S=A[A>0]
l,r=-10**19,10**19
while r-l>1:
  mid=(r+l)//2
  cnt=0
  cnt+=A.searchsorted(mid//S,side="right").sum()
  cnt+=(N-A.searchsorted((mid+1)//(H),side="right")).sum()
  cnt-=np.count_nonzero(A*A<=mid)
  if mid>=0:
    cnt+=len(Z)*N 
  cnt//=2
  if cnt>=K:
    r=mid
  else:
    l=mid 
print(r)


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

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n, k;
    cin >> n >> k;
    ll a[n + 1];
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    vector <ll> hz(n + 1, 1e9);
    hz[1] = 0;
    hz[2] = abs(a[2] - a[1]);
    for (ll i = 2; i <= n; i++)
        for (ll j = 1; j <= k; j++)
        {
            if(i > j)
            hz[i] = min(hz[i - j] + abs(a[i - j] - a[i]), hz[i]);
        }

    cout << hz[n];
}


Measured memory_bytes: 4796
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;
const int q=1000000007,m=2001;
int n,a[200010],b[200010],c[8010][4010],f[4010][4010],p;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	  {
	   scanf("%d%d",&a[i],&b[i]);
	   f[m-a[i]][m-b[i]]++;
	  }
	for(i=1;i<=2*m;i++)
	  for(j=1;j<=2*m;j++)
	    f[i][j]=(f[i][j]+f[i-1][j]+f[i][j-1])%q;
	for(i=0;i<=4*m;i++)
	  {
	   c[i][0]=1;
	   for(j=1;j<=i && j<=2*m;j++)
	     c[i][j]=(c[i-1][j]+c[i-1][j-1])%q;
	  }
	for(i=1;i<=n;i++)
	  p=(p+f[m+a[i]][m+b[i]]-c[2*a[i]+2*b[i]][2*a[i]])%q;
	p=(p+q)%q;
	p=((p&1)?(p+q>>1):(p>>1));
	printf("%d\n",p);
	return 0;
}


Measured memory_bytes: 190080
n=int(input())
a=[[list(map(int,input().split()))for _ in'_'*int(input())]for _ in'_'*n]
m=0
for i in range(2**n):
  *s,=map(int,bin(i)[2:].zfill(n))
  f=1
  for j,t in enumerate(a):
    if s[~j]:
      for x,y in t:f&=s[-x]==y
  m=max(m,sum(s)*f)
print(m)

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

int main() {
    int n;
    cin >> n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    rep(i,n) {
      string s;
      cin >> s;
      if (s == "AC") ac++;
      if (s == "WA") wa++;
      if (s == "TLE") tle++;
      if (s == "RE") re++;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}


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

fn main() {
    input!{
        r: u64,
        g: u64,
        b: u64,
        n: u64
    };

    let mut ret = 0u64;
    for i in (0..).take_while(|&i| i * r <= n) {
        for j in (0..).take_while(|&j| i * r +  j * g <= n) {
            if (n - (i*r+j*g))%b == 0 {
                ret += 1;
            }
        }
    }
    println!("{}", ret);
}


Measured memory_bytes: 4352
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Tue Feb  5 11:13:15 2019
//
package main

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

type route struct {
	to, n int
}

type graph [][]route

var sc = bufio.NewScanner(os.Stdin)

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

func dfs(g graph, dists []int, n, d int) bool {
	if dists[n] != -1<<60 {
		return dists[n] == d
	}

	dists[n] = d
	for i := range g[n] {
		r := g[n][i]
		if !dfs(g, dists, r.to, d+r.n) {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	N, M := nextInt(), nextInt()

	g := make(graph, N)
	for i := 0; i < M; i++ {
		L, R, D := nextInt(), nextInt(), nextInt()
		g[L-1] = append(g[L-1], route{to: R - 1, n: D})
		g[R-1] = append(g[R-1], route{to: L - 1, n: -D})
	}

	dists := make([]int, N)
	for i := range dists {
		dists[i] = -1 << 60
	}

	for i := range dists {
		if dists[i] == -1<<60 {
			if !dfs(g, dists, i, 0) {
				fmt.Println("No")
				return
			}
		}
	}

	fmt.Println("Yes")
}


Measured memory_bytes: 38656
//C
#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>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#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>
#include <array>
#include <atomic>
#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>

//Others

//Hang in there!
//LOVE Ayane Sakura
//LOVE Nyantako_GG

using namespace std;


int main() {
	int N, M, C;
	cin >> N >> M >> C;
	vector<int>B(M);
	for (int i = 0; i < M; i++) {
		cin >> B[i];
	}
	vector<int>A(M);
	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			cin >> A[j];
		}
		int check = 0;
		for (int j = 0; j < M; j++) {
			check += A[j] * B[j];
		}
		if (check + C > 0) {
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef pair<int,int> P;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
  ll n,m,k;
  cin >> n >> m >> k;
  // 前処理
  combination c(200005);
  // 計算例
  mint w = c(n*m-2,k-2);
  // cout << now.x << endl;
  mint ans = 0;
  rep(i,n){
    ans += i*(n-i)*(m*m%mod);
  }
  rep(i,m){
    ans += i*(m-i)*(n*n%mod);
  }
  ans *= w;
  cout << ans.x << endl;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	vector<int>a(3); for(auto&&i:a)cin>>i;
	sort(a.begin(),a.end());
	int ans=0;
	for(int i=1;i<3;++i)ans+=abs(a.at(i)-a.at(i-1));
	cout<<ans<<"\n"s;
}


Measured memory_bytes: 3608
using System;
using System.Linq;

    class Program3
    {
        static void Main()
        {
            var input = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            var s = (input[1] - input[0]) % 2019;
            if (input[1] - input[0] >= 2019)
            {
                input[0] %= 2019;
                input[1] = input[0] + 2019;
            }
            else
            {
                input[0] %= 2019;
                input[1] = input[0] + s;
            }

            var ans = 2018;
            for (int i = input[0]; i < input[1]; i++)
                for (int j = i + 1; j <= input[1]; j++)
                    if ((i * j) % 2019 < ans)
                        ans = (i * j) % 2019;
            Console.WriteLine(ans);
        }
    }

Measured memory_bytes: 13396
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <set>
#include <bitset>
typedef long long ll;
typedef long double ld;
#define PI  3.14159265358979323846

#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;




int main() {
    ll N, Y;
    cin >> N >> Y;
    bool flg = false;
    ll a, b, c=0;
    rep(x,N+1) {
        rep(y,N+1) {
            ll z = N - x - y;
            if (0<=z&&z<=N) {
                if (x*10000+y*5000+z*1000==Y) {
                    flg = true;
                    a = x;
                    b = y;
                    c = z;
                    break;
                }
            }
        }
        if (flg) {
            break;
        }
    }
    if (flg) {
        cout << a << " " << b << " " << c << endl;
    }
    else {
        cout << -1 << " " << -1 << " " << -1 << endl;
    }
    return 0;
}

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

int main(){
    int ai, bi, a, b, n;
    scanf("%d", &n);
    for(int i=0;i<n;i++){
        scanf("%d%d", &a, &b);
        if(i==0||a>ai){ai=a, bi=b;}
    }
    printf("%d\n", ai+bi);
}


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

const int MOD = 1e9 + 7;

int main(){
	
	int n,k;
	cin >> n >> k;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	
	vector<vector<ll>> dp(n+1,vector<ll>(k+1));
	rep(i,n+1){
		dp[i][0] = 1;
	}
	
	for(int i = 1; i < n+1; i++){
		rep(j,k){
			if(j-a[i-1] >= 0){
			    ll tmp = dp[i][j] + dp[i-1][j+1] - dp[i-1][j-a[i-1]];
				dp[i][j+1] = (  tmp + MOD) % MOD;
			}
			else{
				dp[i][j+1] = ( dp[i][j] + dp[i-1][j+1] ) % MOD;
			}
		}
	}
	
	cout << dp[n][k] << endl;
	return 0;
}


Measured memory_bytes: 80256
#include<stdio.h>

#define SIZE 500000
#define MERGESIZE (SIZE/2+1)
#define SENTINEL (1000000000+1)

int S[SIZE];
int L[MERGESIZE], R[MERGESIZE];

int Merge(int A[], int left, int mid, int right)
{
  int n1 = mid - left;
  int n2 = right - mid;
  int i, j, k;
  
  for(i = 0; i <= n1-1; i++){
    L[i] = A[left + i];
  }
  for(i = 0; i <= n2-1; i++){
    R[i] = A[mid + i];
  }
  L[n1] = SENTINEL;
  R[n2] = SENTINEL;

  i = 0;
  j = 0;
  for(k = left; k <= right-1; k++){
    if(L[i] <= R[j]){
		A[k] = L[i];
		i = i + 1;
	}else{
		A[k] = R[j];
		j = j + 1;
	}
  }

  return(right - left);
}

int Merge_Sort(int A[], int left, int right)
{
	int mid, c = 0;
	if(left+1 < right){
		mid = (left + right)/2;
		c += Merge_Sort(A, left, mid);
		c += Merge_Sort(A, mid, right);
		c += Merge(A, left, mid, right);
	}else{
		c = 0;
	}
	return(c);
}

int main()
{
	int n, i, c;

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

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

	return(0);
}

Measured memory_bytes: 4504
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  random_device rd;
  mt19937 mt(rd());
  uniform_int_distribution<ll> a(1,26);
  rep(i,365) {
    cout << a(mt) << '\n';
  }
}

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

using namespace std;
#define PB push_back
#define MP make_pair
#define st first
#define nd second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

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

#define unordered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);

  int n;
  cin >> n;

  if ((n & (n - 1)) == 0) {
    cout << "No\n";
    return 0;
  }

  cout << "Yes\n";

  vector<pii> ans;
  for (int i = 1; i < 3; ++i) {
    ans.emplace_back(i, i + 1);
    ans.emplace_back(i + n, i + n + 1);
  }
  ans.emplace_back(3, n + 1);

  for (int k = 4; k + 1 <= n; k += 2) {
    ans.emplace_back(k, k + 1);
    ans.emplace_back(k + 1, 1);
    ans.emplace_back(1, n + k);
    ans.emplace_back(n + k, n + k + 1);
  }

  if (n % 2 == 0) {
    ans.emplace_back(n, n - 1);
    int v = n ^ (n - 1) ^ 1;
    assert(v % 2 == 0 && v > 0);

    if (v == 2) {
      ans.emplace_back(2 * n, 2);
    } else {
      ans.emplace_back(2 * n, n + v);
    }

  }

  for (auto &edge : ans) {
    cout << edge.st << " " << edge.nd << "\n";
  }
}



Measured memory_bytes: 4080