akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//Fast io
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
//Class shorthands
#define ll long long
#define db long double
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
//Function Shorthands
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair
#define po pop_back
#define eb emplace_back
//Code Shorthands
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
//Constants
#define hell 1000000007
#define PI acos(-1.0)
using namespace std;

int p[300000], s[300000];

void make_set(int v){
    p[v] = v;
    s[v] = 1;
}
int find_set(int v){
    if(p[v]==v) return v;
    return p[v] = find_set(p[v]);
}
void merge(int a, int b){
    a = find_set(a);
    b = find_set(b);
    if(a==b) return;
    if(s[a]<s[b]) swap(a, b);
    s[a] += s[b];
    p[b] = p[a];
}


void solve(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<n+1;i++) make_set(i);
    rep(i, 0, m){
        int t1, t2;
        cin>>t1>>t2;
        merge(t1, t2);
    }
    int ans = -1;
    rep(i,1,n+1){
        //cout<<i<<" "<<find_set(i)<<endl;
        ans = max(ans, s[find_set(i)]);
    }
    cout<<ans<<endl;
}

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

Measured memory_bytes: 5188
#include<stdio.h>
#include<stdlib.h>
int a[100005];
int asc(const void* x, const void* y)
{
	if (a[*(int*)x] > a[*(int*)y])return 1;
	if (a[*(int*)x] < a[*(int*)y])return -1;
	return 0;
}
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	int c[100005];
	for (i = 0; i < n; i++)
		c[i] = i;
	qsort(c, n, sizeof(int), asc);
	int ans = 0;
	for (i = 0; i < n; i++)
		if (i % 2 != c[i] % 2)
			ans++;
	printf("%d\n", ans / 2);
	return 0;
}

Measured memory_bytes: 1276
#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>;
using Graph = vector<vector<int>>;

typedef long long ll;
 
const ll mod = (ll)(1e9+7);

int main() {
  ll n;
  cin >> n;
  ll a[n];
  rep(i,n) cin >> a[i];
  
  ll r = 0;
  rep(k,60) {
    ll m = 0;
    rep(i,n) m += (a[i]>>k) % 2;
    r = (r + (n - m) * m % mod * ((1L<<k) % mod)) % mod;
  }
  cout << r << "\n";
  return 0;
}

Measured memory_bytes: 2688
#include<stdio.h>
#include<string.h>
int main() {
    char str[1000], ord[7], p[1000], tmp[1000];
    int q, i, j, a, b;
    scanf("%s", str);
    scanf("%d", &q);
    for (i = 0;i < q;i++) {
        scanf("%s", ord);
        if (strcmp(ord, "print") == 0) {
            scanf("%d %d", &a, &b);
            for (j = a;j <= b;j++) {
                printf("%c", str[j]);
                if(j==b){
                    printf("\n");
                }
            }
        }
            strcpy(tmp, str);
            if (strcmp(ord, "reverse")==0) {
            scanf("%d %d", &a, &b);
            int l = b - a + 1;
            for (j = 0;j < l;j++) {
                str[a + j] = tmp[b - j];
            }
        }
        if (strcmp(ord, "replace")==0) {
            scanf("%d %d %s", &a, &b, p);
            for (j = 0;j < b-a+1;j++) {
                str[a+j] = p[j];
            }
        }
    }
    return 0;
}

Measured memory_bytes: 588
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define Max(a,b) max({a,b})
#define Min(a,b) min({a,b})
#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define len(n)
using namespace std;

int n,m,a,b,c,cou,co,ans;
double d,k;
string s,t;

int lis[200];

int main(){
    cin >> n;
    ans = 0;
    for(int i=1;i<=n;i++){
        cou = 0;
        if(i % 2 != 0){
            for(int r=1;r<=n;r++){
                if(i%r==0)cou++;
            }
            if(cou == 8){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n,a,b = map(int, input().split())
s = input()
p = a+b
cnt = 0
bcnt = 0
for i in range(n):
    if s[i] == 'a' and cnt < p:
        print('Yes')
        cnt+=1
    elif s[i] == 'b' and cnt < p and bcnt < b:
        print('Yes')
        cnt+=1
        bcnt+=1
    else:
        print('No')

Measured memory_bytes: 53464
/**
*    created: 26.06.2020 22:33:12
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pcnt(bit) __builtin_popcountll(bit)
#define mod 1000000007
#define pi acos(-1.0)
using namespace std;
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;}

const int INF = 1LL << 60;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> h(100000);
    vector<int> dp(100000,INF);
    rep(i,n) cin >> h[i];
    dp[0] = 0;
    rep2(i,1,n) {
        chmin(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
        if (i > 1) chmin(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 4764
from itertools import groupby

S = input()

p = 0
s = 0
for key, values in groupby(S):
    l = len(list(values))
    s = s + (l * (l+1))//2
    if key == '>':
        s = s - min(l, p)
    if key == '<':
        p = l

print(s)


Measured memory_bytes: 8328
#include<bits/stdc++.h>
using namespace std;
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define vvi vector<vector<int>>;
#define mi  map<int,int>
#define mii map<pii,int>
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define sz(x) (int)x.size()
#define all(v) (v).begin(), (v).end()
#define ret(x) return cout<<x,0;
#define rety return cout<<"YES",0;
#define retn return cout<<"NO",0;
#define fl fflush(stdout)   
#define hell 1000000007  
#define hell2 998244353 
#define pi 3.14159265358979323846

int solve(){
    int n,w,a,b;
    cin>>n>>w;vii v;
    rep(i,0,n){
        cin>>a>>b;
        v.pb({a,b});
    }
    int dp[100005];
    rep(i,0,100005)dp[i]=1e10;
  //  memset(dp,0,sizeof dp);
    dp[0]=0;
    rep(i,0,n){
        repn(j,100005,0){
            //if()
         //   if(j+v[i].ss<100005&&dp[j]==1e9)dp[j+v[i].ss]=min(dp[j+v[i].ss],v[i].ff);
            if(j+v[i].ss<100005&&dp[j]!=1e10)dp[j+v[i].ss]=min(dp[j+v[i].ss],dp[j]+v[i].ff);
        }
    }
    //cout<<w<<'*';
  //  rep(i,0,100005)cout<<dp[i]<<" ";
    int ans=0;
    rep(i,0,100005){  
        if(dp[i]<=w)ans=i;
    }
    cout<<ans;
    return 0;
}

signed main(){
    IOS;
    int t=1;
    
    //cin>>t;
    while(t--){
        solve();
        cout<<"\n";
    }
    return 0;
} 

Measured memory_bytes: 4340
/*                    ___          |\    /|           ____   ____   ____  ____
   |     |    /\    /    \ |     | | \  / |    /\    |    \ |    \ |     |    \
   |_____|   /__\   \____  |_____| |  \/  |   /__\   |____/ |____/ |__   |____/
   |     |  /    \       \ |     | |      |  /    \  |      |      |     |   \
   |     | /      \ \____/ |     | |      | /      \ |      |      |____ |    \
*/
#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;
#define ordered_set tree<pl, null_type,less<pl>, rb_tree_tag,tree_order_statistics_node_update>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lb lower_bound
#define ub upper_bound
#define pf push_front
#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define pld pair<long double,long double>
#define endl '\n'
#define loop(i,n) for(ll i=0;i<n;i++)
#define rep(i, begin, end) for (__typeof(begin) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define mod ((ll)(1e9+7))
#define in(x) scanf("%lld",&x)
#define in2(x,y) scanf("%lld %lld",&x,&y)
#define in3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define inv(v) for(auto&i:v) in(i)
#define all(x) x.begin(), x.end()
#define vl vector<ll>
#define ml unordered_map<ll,ll> 
#define vpl vector<pair<ll,ll>>
#define INF 0x3f3f3f3f
 
template<typename T, typename TT>
ostream& operator<<(ostream &os, const pair<T, TT> &t) { return os<<t.first<<" "<<t.second; }
template<typename T>
ostream& operator<<(ostream& os, const vector<T> &t) { for(auto& i: t) os<<i<<" "; return os; }

int main() {
    fast;
    // int t; scanf("%d",&t);
    // while(t--) {
    // }
    ll n,m,x; in3(n,m,x);
    ll v[n][m]; vl c(n);
    loop(i,n) {
        in(c[i]);
        loop(j,m) in(v[i][j]);
    }
    loop(j,m) {
        ll sum=0;
        loop(i,n) sum+=v[i][j];
        if(sum<x) {
            cout<<-1<<endl;
            return 0;
        }
    }
    ll ans = 1e18;
    loop(i,1<<n) {
        ll sum=0;
        vl tmp(m,0);
        bool f=0;
        loop(j,n) {
            if(i&(1<<j)) {
                f=1;sum+=c[j];
                loop(k,m) tmp[k]+=v[j][k];
            }
        }
        if(!f) continue;
        loop(j,m) if(tmp[j]<x) {
            goto skip;
        };
        ans = min(ans,sum);
        // cout<<sum<<"-"<<ans<<"-"<<tmp<<endl;
        skip:;
    }
    cout<<ans<<endl;
    #ifdef LOCAL
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
    return 0;
}

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

int Y,X,h,w,n;
string s,t;

bool U(){
  int y=Y;
  r(i,n){
    if(s[i]=='U')y--;
    if(y==0)return 1;
    if(t[i]=='D')y++;
    y=min(y,h);
  }
  return 0;
}
bool D(){
  int y=Y;
  r(i,n){
    if(s[i]=='D')y++;
    if(y>h)return 1;
    if(t[i]=='U')y--;
    y=max(y,1LL);
  }
  return 0;
}
bool R(){
  int x=X;
  r(i,n){
    if(s[i]=='R')x++;
    if(w<x)return 1;
    if(t[i]=='L')x--;
    x=max(1LL,x);
  }
  return 0;
}
bool L(){
  int x=X;
  r(i,n){
    if(s[i]=='L')x--;
    if(x==0)return 1;
    if(t[i]=='R')x++;
    x=min(w,x);
  }
  return 0;
}

signed main(){
  cin>>h>>w>>n;
  cin>>Y>>X;
  cin>>s;
  cin>>t;

  if(U()||R()||D()||L())cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
}


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


int main() {
    int N,M;
    cin>>N>>M;
    int a =pow(2,M);
    int ans = (1900*M+(N-M)*100)*a;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
/* 

	CODE TEMPLATE APRATIM

*/

#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define veci vector<ll>
#define it map<string, vv>::iterator
#define MOD 1000000007
#define N (ll)3e+6
#define test int T;cin>>T;while(T--)
#define nl "\n"
#define FULL(iii) iii.begin(),iii.end()
#define setbit(_) __builtin_popcount(_)
#define INF 9223372036854775807 
#define TOUPR(str) transform(str.begin(), str.end(),str.begin(), ::toupper)
#define TOLWR(str) transform(str.begin(), str.end(),str.begin(), ::tolower)
#define pb push_back
#define len(s) s.length()
#define pb push_back
#define eb emplace_back
#define S second
#define F first
#define len(s) s.length()
#define coutp cout<<setprecision(15)
#define pow(a,b) (ll)(pow(a,b)+0.5)
#define bin(x) stoull(x,0,2)
#define lld long double
 
int main()
{
	ll i,f,n,s=7;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		if(s%n==0)
		{f=0,cout<<i;break;}
		else
		s=(s%n)*10+7,f=1;
	}
	if(f)
	cout<<-1;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll,ll> P;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;

ll n,k;
string s;

void input(void){
   cin>>n>>k;
   cin>>s;
}

void solve(void){
    ll a=0,b=0;
    rep(i,n-1){
        if(s[i]==s[i+1])b++;
        else{
            a+=b;
            b=0;
        }
    }
    a+=b;
    cout<<min(n-1,a+2*k)<<endl;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
}

Measured memory_bytes: 512
def main():
    n = int(input())
    a = list(map(int, input().split()))
    tmp = {}
    is_unique = True
    for i in range(n):
        if a[i] in tmp:
            is_unique = False
            break
        tmp[a[i]] = a[i]
    
    if is_unique:
        print("YES")
    else:
        print("NO")


if __name__=="__main__":
    main()


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

  ll a,b;
  cin>>a>>b;
  auto calc = [](ll x)->ll{
    ll cnt = x%4;
    if(cnt==3)return 0;
    ll tmp = 0;
    for(int i=0;i<cnt+1;++i){
      tmp^=(x-i);
      cerr<<x-i<<" ";
    }
    cerr<<tmp<<endl;
    return tmp;
  };

  cout<<(calc(b)^calc(a-1))<<endl;

}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static class Move {
		int fx, fy, gx, gy;
		
		public Move(int fx, int fy, int gx, int gy) {
			this.fx = fx;
			this.fy = fy;
			this.gx = gx;
			this.gy = gy;
		}
		
		public String toString() {
			return this.fy + " " + this.fx + " " + this.gy + " " + this.gx;
		}
	}
	
	public static int[][] move_dirs = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
	public static boolean in_range(int x, int y, int W, int H) {
		return 0 <= x && x < W && 0 <= y && y < H;
	}
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			final int M = sc.nextInt();
			
			
			
			int answer = 1;
			for(int x = 1; x <= ((M + N - 1) / N); x++) {
				if(M < x * N) { break; }
				final int diff = M - (x * N);
				if(diff % x != 0) { continue; }
				
				if(diff % (x * N) == 0) { x += diff / (x * N); }
				//System.out.println(x + " " + (x * N) + " " + M + " " + diff);
				
				answer = x;
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 22868
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include "bits/stdc++.h"
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 5010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n;
string s, t;
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n;
    cin >> s >> t;
    FOR(i,0,n-1) cout << s[i] << t[i];
    return 0;
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    token.parse().ok().unwrap()
}

fn main() {
    let t = input::<i64>();
    let x = input::<i64>();

    let ans = t as f64 / x as f64;
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>


int main(void) {
	int n, m;
	int i, j;
	int A[100][100], B[100], c[100];
	
	
	scanf("%d %d", &n, &m);
	
	for(i = 0; i < n; i++) {
		for(j = 0; j < m; j++) {
			scanf("%d", &A[i][j]);
		}
	}
	
	for(i = 0; i < m; i++) {
		scanf("%d", &B[i]);
	}
	
	for(i = 0; i < n; i++) {
		c[i] = 0;
	}
	
	for(i = 0; i < n; i++) {
		for(j = 0; j < m; j++) {
			c[i] += A[i][j]*B[j];
		}
	}
	
	for(i = 0; i < n; i++) {
		printf("%d\n", c[i]);
	}
	
	return 0;
}

Measured memory_bytes: 640
class NumExpression:
    def __init__(self, input_value, rank):
        self.raw_value = input_value
        self.rank = rank

    @property
    def value(self):
        list = self.expression.split("+")
        sum = 0
        for num in list:
            sum += int(num)
        return sum

    @property
    def expression(self):
        #print("rank = {0}".format(self.rank))
        points = self.gen_points(self.rank, len(self.raw_value) - 1)
        #print("gen_points = {0}".format(points))
        expression = self.insert_plus(points)
        #print("expression = {0}".format(expression))
        return expression

    def gen_points(self, num, width):
        """
        num → 2進数に変換してリストで返す
        """
        points = [0] * width
        temp = num
        i = 1
        while True:
            p = temp % 2 
            if p == 1:
                points[width - i] = 1
            temp = temp >> 1
            if temp == 0:
                break
            i += 1

        return points

    def insert_plus(self, points):
        """
        point位置に"+"を挿入する
        """
        i = 0 #points[0]
        new_value = self.raw_value[0:i]
        for point in points:
            new_value += self.raw_value[i:i+1]
            if point == 1:
                new_value += "+"
            i += 1

        new_value += self.raw_value[i:]
        return new_value

class Calculator:
    def __init__(self, input_value):
        self.input_value = input_value
        self.expressions = self.make_expressions()

    def len(self):
        return len(self.input_value)

    def make_expressions(self):
        expressions = []
        for i in range(0, pow(2, self.len()-1)):
            expression = NumExpression(self.input_value, i)
            expressions.append(expression)
        return expressions

    def compute_sum(self):
        sum = 0
        for expression in self.expressions:
            sum += expression.value

        return sum

if __name__ == "__main__":
    num = input()
    c = Calculator(num)
    print(c.compute_sum())


Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string S;
  cin >> S;
  int real,phy;
  int count=0;
  int max=-1;
  for(int i=0; i<S.size(); i++){
    if(S.at(i)=='A' || S.at(i)=='C' || S.at(i)=='G' || S.at(i)=='T' || S.at(i)==' '){
      count=1;
      for(int j=i+1; j<S.size(); j++){
        if(S.at(j)=='A' || S.at(j)=='C' || S.at(j)=='G' || S.at(j)=='T' || S.at(j)==' '){
          count++;
        }
        else
          break;
      }
    }
    if(count>max)
      max=count;
    count=0;
  }
  if(max==-1)
    cout << 0 << endl;
  else{
    cout << max << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n;
	cin >> n;
	while(n >= 0){
		if(n%7==0){
			cout << "Yes" << endl;
			return 0;
		}
		n -= 4;
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)


def main(input, print):
    s = input().strip()
    t = input().strip()
    a = t[:-1]
    if s == t[:-1]:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main(sys.stdin.readline, print)


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

using namespace std;

int main()
{
    int H,N,sum=0;
    cin>>H>>N;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        int a;
        cin>>a;
        sum+=a;
        A.push_back(a);
    }

    for(int i=0;i<N;i++){
        if(sum-A[i]>=H){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define f1(n) for(int i=0;i<n;++i)
#define f2(n) for(int i=1;i<=n;++i)
#define mp make_pair
using namespace std;
typedef long long ll;
typedef long double llf;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
const int maxn = 2e5 + 5;
const int maxm = 18;
const ll Mod = 1e9 + 7;
const ll INF = 1e9 + 7;
ll _power(ll a, int b) {
	ll ans = 1;
	while (b) {
		if (b & 1)
			ans = ans * a % Mod; 
		a = a * a % Mod;
		b >>= 1;
	}
	return ans;
}
ll a[maxn];
map<int, int>p;

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

	ll n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; ++i) {
		a[i] += a[i - 1] + i;
	}
	ll ans = 0;
	for (int i = k; i <= n + 1; ++i) {
		ans += (a[n] - a[n - i]) - (a[i - 1]) + 1;
		ans %= Mod;
	}
	cout << ans << endl;

	return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;


int N;
pint A[100000];

signed main(){
    cin >> N;
    int a;
    REP(i, N){
        cin >> a;
        A[i] = pint(a, i);
    }
    sort(A, A + N);
    REP(i, N){
        cout << A[i].second + 1;
        if(i < N - 1) cout << " ";
        else cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define MAX 1000005
#define ll long long
#define upperlimit 1000100
#define INF 1e18
#define eps 1e-8
#define endl '\n'
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define MOD 1000000007
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define FF first
#define SS second
#define pb(x) push_back(x)
#define vi vector<int>
#define vll vector<ll>
#define clr(a) memset(a,0,sizeof(a))
#define debug(a) printf("check%d\n",a)
#define csl ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
 
ll gcd(ll n1,ll n2){
	if(n1%n2==0)return n2;
	return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent)
{
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%MOD;
		base=(base*base)%MOD;
		exponent/=2;
	}
	return ans;
}
int main()
{
	ll n,a,b;
	cin>>n>>a>>b;

	
		ll hi=(n-1)*b+a;
		ll lo=(n-1)*a+b;
		ll ans=hi-lo+1;
		ans=max(ans,0LL);
	 	cout<<ans<<endl;
	
}

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

// O(V^3)
void warshall_floyd(int n, vector<vector<int> > &g) {
    for(int k = 0; k < n; ++k)
        for(int i = 0; i < n; ++i)
            for(int j = 0; j < n; ++j) g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int h,w; cin >> h >> w;
    vector<vector<int> > g(10, vector<int>(10));
    for(int i=0; i < 10; ++i)
        for(int j=0; j < 10; ++j) cin >> g[i][j];
    warshall_floyd(10, g);
    int ans = 0; int tmp;
    for(int i=0; i < h; ++i){
        for(int j=0; j < w; ++j){
            cin >> tmp;
            if(tmp==-1) continue;
            ans += g[tmp][1];
        }
    }
    cout << ans << '\n';
    return 0;
}

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

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

    // Aには全部入れて、Apos, Anegはそれぞれ正と負の値のみ入れる。全て絶対値で管理。
    vector<int64_t> A, Apos, Aneg;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        A.push_back(abs(a));
        if(a > 0) Apos.push_back(a);
        if(a < 0) Aneg.push_back(abs(a));
    }
    int szp = Apos.size(), szn = Aneg.size();

    int64_t ans = 1;

    if(szp + szn/2*2 >= K && (K%2 == 0 || szp > 0)){
        // 正にできる場合：絶対値を大きくしたい
        sort(Apos.rbegin(), Apos.rend());
        sort(Aneg.rbegin(), Aneg.rend());
        // Kが奇数ならまず正側の最大値を1個使う
        if(K%2) ans = Apos[0];
        // 正負それぞれで絶対値の大きいものから2個ずつペアにして、大きいものから使う
        vector<int64_t> V;
        for(int i=K%2; i+1<szp; i+=2) V.push_back(Apos[i]*Apos[i+1]);
        for(int i=0; i+1<szn; i+=2) V.push_back(Aneg[i]*Aneg[i+1]);
        sort(V.rbegin(), V.rend());
        for(int i=0; i<K/2; i++) mul(ans, V[i] % MOD);
    }else{
        // 正にできない場合：絶対値を小さくしたい
        // 全部混ぜて絶対値の小さいものから使う
        sort(A.begin(), A.end());
        for(int i=0; i<K; i++) mul(ans, A[i]);
        ans = (MOD-ans) % MOD;
    }
    cout << ans << endl;
    return 0;
}


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

typedef long double ld;

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
	string s;
	cin>>s;
	
	
	
	ll n = s.size();
	
	string a = "",b="";
	for(ll i=0;i<((n-1)/2);i++)
		a += s[i];
		
	for(ll i=((n+1)/2);i<n;i++)
	{
		b += s[i];
	}
	
	string t = a;
	ll flg1 = 0,flg2 = 0,flg3 = 0;
	
	reverse(a.begin(),a.end());
	
	if(a==t)flg1++;
	
	t = b;
	reverse(b.begin(),b.end());
	if(b==t)flg2++;
	
	t = s;
	reverse(s.begin(),s.end());
	if(t==s)flg3++;
	
	if((flg1*flg2*flg3) == 1)
	{
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	cout<<endl;
	
}


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

using i64 = long long int;

int main(){
    int n;
    cin >> n;
    vector<i64> v;
    for(int i=0;i<n;++i){
        i64 a;
        cin >> a;
        v.push_back(a);
    }
    i64 ans = 0;
    for(auto e : v){
        i64 tmp = e, cnt = 0;
        while(tmp % 2 == 0){
            tmp >>= 1;
            cnt++;
        }
        ans += cnt;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
char st[200010];
int main() {
	scanf("%s", st);
	int n = strlen(st);
	string s = "", pre = "";
	int ans = 0;
	for(int i = 0; i < n; ++ i) {
		s += st[i];
		if(s != pre) {
			pre = s;
			s = "";
			++ ans;
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 384
#include <cstdio>
using namespace std;
int main()
{
    int n;
    bool prime[10001];
    for (int i=0; i<=10000; i++) prime[i]=true;
    prime[0]=false;
    prime[1]=false;
    for (int i=2; i<=10000; i++) {
        if (!prime[i]) continue;
        for (int j=i+i;j<=10000; j+=i) prime[j]=false;
    }
    while (scanf("%d",&n)&&n!=0) {
        int p1=0, p2=0;
        for (int i=2; i+2<=n; i++) {
            if (!prime[i]) continue;
            if (prime[i]&&prime[i+2]) {
                p1=i;
                p2=i+2;
            }
        }
        printf("%d %d\n",p1,p2);
    }
}

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

int main(){
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;

    if(x + r <= w && x - r >= 0 && y + r <= h && y - r >= 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3096
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
typedef long long int ll;
typedef vector< int > vi;
typedef pair< int, int > ii;
typedef vector< ii > vii;
typedef vector< ll > vll;
// #define DEBUG_MODE
#ifdef DEBUG_MODE
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(x) fprintf(stderr, "[%s = %d]\n", #x, x)
#else
	#define errp(...)
	#define dbg(x) 
#endif

int main () { 
#ifdef DEBUG_MODE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int a, b;
	scanf("%d%d", &a, &b);
	if (a >= 6 && a <= 12) b /= 2;
	else if (a < 6) b = 0;
	printf("%d\n", b);
}

Measured memory_bytes: 128
# cook your dish here
n=int(input())
if n <= 111:
    print(111)
elif n <= 222:
    print(222)
elif n <= 333:
    print(333)
elif n <= 444:
    print(444)
elif n <= 555:
    print(555)
elif n <= 666:
    print(666)
elif n <= 777:
    print(777)
elif n <= 888:
    print(888)
elif n <= 999:
    print(999)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int a, b; scanf("%d%d", &a, &b);
	
	if(a % b) printf("1\n");
	else printf("0\n");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class fare {
public:
	int X;
	int Y;
	void get() {
		cin >> X >> Y;
	}
	int sum() {
		return X + Y / 2;
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	fare obj;
	obj.get();
	cout << obj.sum() << "\n";

	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

class Main
{
    public static void main(String args[])
    {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int k = s.nextInt();
        long a[] = new long[n];
        int i;
        for(i=0; i<n; i++)
        {
            a[i] = s.nextInt();
        }
        Arrays.sort(a);
        long sum = 0;
        for(i=n-k-1; i>=0; i--)
        {
            sum += a[i];
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 88572
#include <iostream>
#include <string>
using namespace std;
int main() {
  char a;
  string str;
  cin >> str;
  for (int i = 0; i < str.size()-1-i; i++) {
    a = str[i];
    str[i] = str[str.size()-1-i];
    str[str.size()-1-i] = a;
  }
  cout << str << endl;
}

Measured memory_bytes: 1172
// Problem: C - A x B + C
// Contest: AtCoder - AtCoder Beginner Contest 179
// URL: https://atcoder.jp/contests/abc179/tasks/abc179_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable" 
//#pragma GCC diagnostic ignored "-Wformat"

using namespace std ;

#define   Pi     2*acos(0.0)
#define   LINF   1LL<<63
#define   ll     long long
#define   ull    unsigned long long
#define   pb     push_back
#define   mp     make_pair
#define   MAX    500006
#define   MAX1   10000008
#define   mem(a,v)   memset(a,v,sizeof(a))
#define   all(x) x.begin(),x.end()
#define   lcm(a, b)        ((a)*((b)/gcd(a,b)))
#define yes   cout<<"YES"<<endl
#define no   cout<<"NO"<<endl
#define buga  cout<<1<<endl
#define bugb  cout<<2<<endl
#define bugc  cout<<3<<endl
#define bugd  cout<<4<<endl
#define buge  cout<<5<<endl

void fastIO (){ios_base::sync_with_stdio(false);cin.tie(0); cout.precision(20);}

ll A[MAX];
ll B[MAX];
ll C[MAX];
vector< ll >V;
vector< ll >Ans;
vector< pair<ll,ll> >VP;
map< ll,ll >M;
vector<ll>prime;
bool mark[MAX1];
ll N=1e7;
void seive (){int limit = sqrt(N*1.0)+2;mark[1]=1;for (int i=4;i<=N;i+=2)mark[i]=1;prime.push_back(2);for (int i=3;i<=N;i+=2){if(!mark[i]){prime.push_back(i);if(i<=limit){for (int j=i*i;j<=N;j+=i*2)mark[j]=1;}}}}

/*
ll bin_pow(ll o, ll s) {
    if (s == 0) return 1;
    if (s == 1) return o % mod;
    ll d = bin_pow(o, s/2);
    d = (d * 1ll * d) % mod;
    if (s % 2 == 1)
        d = (d * 1ll * o) % mod;
    return d;
}
*/
vector<int>divisors[1000006];
void init()
{
	int i,j;
    for(ll i=1000000;i>=1;i--)
    {
        for(ll j=i;j<=1000000;j+=i)
        {
            divisors[j].pb(i);
        }
    }

}

int main ()
{
    fastIO();
    ll a,b,c,d,n,m,k,l,p,q,r,t,x,y;
    ll cnt=0,cntr=0,sum=0,ans=1,check=0;
    ll Max= 0,Max1=-1e18+1,Min=LINF;
    string s,s1,s3,s4;

    //cin>>n;
    init();
    cin>>n;
    
    for(int i = 1; i < n; i++){
    	sum += divisors[i].size();
    }
    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 116676
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;
lint p=1e9+7;

lint mod_pow(lint a,int n,lint p){
  lint r=1;
  REP(i,n){
    r*=a;
    r%=p;
  }
  return r;
}

int main(){
  int N;
  cin>>N;
  lint ans=mod_pow(10,N,p);
  ans-=mod_pow(9,N,p);
  if(ans<0)ans+=p;
  ans-=mod_pow(9,N,p);
  if(ans<0)ans+=p;
  ans+=mod_pow(8,N,p);
  ans%=p;
  cout<<ans<<endl;
  return 0;
}


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

int main() {
    long long X;
    cin >> X;
    long long yokin = 100;
    int i=0;
    while (true) {
        if (yokin>=X) {
            cout << i;
            return 0;
        }
        yokin = yokin*1.01;
        i++;
    }
}

Measured memory_bytes: 3640
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <cassert>
#include <bitset>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

#include <atcoder/mincostflow>
using namespace atcoder;

int n,m;
vs a;

int main(){
	cin>>n>>m;
	a=vs(n);
	mcf_graph<int,int> g(n*m+2);
	int res=0,sr=n*m,sk=n*m+1;
	for(auto &i:a) cin>>i;
	for(int i=0;i<n;i++) for(int j=0;j<m;j++){
		if(a[i][j]=='o'){
			g.add_edge(sr,i*m+j,1,0);
			res+=n+m-i-j;
		}
		if(a[i][j]!='#'){
			g.add_edge(i*m+j,sk,1,n+m-i-j);
			if(i+1<n&&a[i+1][j]!='#') g.add_edge(i*m+j,(i+1)*m+j,inf,0);
			if(j+1<m&&a[i][j+1]!='#') g.add_edge(i*m+j,i*m+j+1,inf,0);
		}
	}
	P p=g.flow(sr,sk);
	cout<<res-p.second<<endl;
}

Measured memory_bytes: 4100
n=int(input())
l=list(map(int,input().split()))
c=[0]*8;free=0
for x in l:
  if x<400:
    c[0]+=1
  elif x<800:
    c[1]+=1
  elif x<1200:
    c[2]+=1
  elif x<1600:
    c[3]+=1
  elif x<2000:
    c[4]+=1
  elif x<2400:
    c[5]+=1
  elif x<2800:
    c[6]+=1
  elif x<3200:
    c[7]+=1
  else: free+=1
cnt=0
for x in c:
  if x>0:cnt+=1
print(max(1,cnt),cnt+free)

Measured memory_bytes: 3064
def cmb(a,b,c):
    b = min(b,a-b)
    num = 1
    for i in range(b):
        num = num*(n-i) % c
    den = 1
    for i in range(b):
        den = den*(i+1) % c
    return num*pow(den,-1,c) % c
mod = 10**9+7
n,a,b = map(int,input().split())
ans  = (pow(2,n,mod)-cmb(n,a,mod)-cmb(n,b,mod)-1) % mod
if ans < 0:
    ans = ans + mod
print(ans)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
pair<int,int> P;
priority_queue<int,vector<int>,less<int>> pq;
int a,b,c,ans;
bool cmp(int p,int q)
{
    return p>q?1:0;
}
main()
{
    scanf("%d %d %d",&a,&b,&c);
    ans=c-(a-b); if(ans<0) ans=0;
    printf("%d",ans);
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100
typedef struct{
  int p,l,r;
}NODE;
void Pre(NODE *,int);
void In(NODE *,int);
void Post(NODE *,int);
  int main(){
    int n,i,j,id,l,r,head;
    NODE T[N];
    for(i=0;i<N;i++)
      T[i].p=-1;
    scanf("%d",&n);
    for(i=0;i<n;i++){
      scanf("%d%d%d",&id,&l,&r);
      T[l].p=id;
      T[r].p=id;
      T[id].l=l;
      T[id].r=r;
      
    }
    for(i=0;i<n;i++){

      if(T[i].p==-1)
	head=i;
    }
      
    printf("Preorder\n");
      Pre(T,head);
    printf("\n");
    printf("Inorder\n");
      In(T,head);
    printf("\n");
    printf("Postorder\n");
      Post(T,head);
    printf("\n");
    return 0;
  }
void Pre(NODE T[],int i){
  if(i==-1)
    return;
  printf(" %d",i);
  Pre(T,T[i].l);
  Pre(T,T[i].r);

}void In(NODE T[],int i){
  if(i==-1)
    return;
  
  In(T,T[i].l);
  printf(" %d",i);
  In(T,T[i].r);

}void Post(NODE T[],int i){
  if(i==-1)
    return;
  Post(T,T[i].l);
  Post(T,T[i].r);
printf(" %d",i);
}



Measured memory_bytes: 2048
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,(n))
typedef vector<int> vec;


class BMakingTriangle {
public:
	void solve(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    vec l(n);
    REP(i,n){
      in >> l[i];
    }
    sort(l.begin(),l.end());
    int ok = 0;
    FOR(i,0,n-2)FOR(j,i + 1,n-1)FOR(k,j + 1,n){
      if(l[i] != l[j] && l[i] != l[k] && l[j] != l[k] && l[i] + l[j] > l[k] && l[i] + l[k] > l[j] && l[j] + l[k] > l[i]){
        ok++;
      }
    }
    out << ok << endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
	BMakingTriangle solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3640
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#define MOD (1000000007l)

using namespace std;

long count_bit(long v) {
  if (v == 0) return 0;
  return count_bit(v >> 1) + (v & 1);
}

void solve(long from, long to, long N, long mask_position) {
  //cout << "from: " << from << ", to: " << to << ", mask_position: " << mask_position << endl;
  if (count_bit(mask_position) == N - 1) {
    cout << " " << to;
    return;
  }
  long i = 0;
  for (; i < N; i++) {
    long now = 1l << i;
    if ((mask_position & now) == 0 and (from & now) != (to & now)) {
      break;
    }
  }
  long next_mask_position = mask_position | (1l << i);
  long j = 0;
  for (; j < N; j++) {
    long now = 1l << j;
    if ((next_mask_position & now) == 0) {
      break;
    }
  }
  long via = from ^ (1l << j);
  long via_2 = via ^ (1l << i);
  solve(from, via, N, next_mask_position);
  cout << " " << via_2;
  solve(via_2, to, N, next_mask_position);
}

int main(void) {
  long N, A, B;
  cin >> N >> A >> B;

  if (count_bit(A) % 2 == count_bit(B) % 2) {
    cout << "NO" << endl;
    return 0;
  }

  cout << "YES" << endl;
  cout << A;
  solve(A, B, N, 0);
  cout << endl;

  return 0;
}


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

#define MAXN 100005

using namespace std;

int n, a[MAXN], ans;
int pre[MAXN], suf[MAXN];

int read() {
    char c = getchar();
    int x = 0;
    while (!isdigit(c))
        c = getchar();
    while (isdigit(c)) {
        x = (x << 3) + (x << 1) + c - '0';
        c = getchar();
    }
    return x;
}

int gcd(int a, int b) {
    return !b ? a : gcd(b, a % b);
}

int solve() {
//    for (int i = 1; i <= n; ++i)
//        printf("%d ", a[i]);
//    cout << endl;
    int tempsuf[MAXN], temppre[MAXN];
    int res = 0;
    for (int i = 1; i <= n; ++i)
        res ^= (a[i] - 1) & 1;
    if (res)
        return true;
    pre[1] = a[1];
    for (int i = 2; i <= n; ++i)
        pre[i] = gcd(pre[i - 1], a[i]);
    suf[n] = a[n];
    for (int i = n - 1; i >= 1; --i)
        suf[i] = gcd(suf[i + 1], a[i]);
    memcpy(temppre, pre, sizeof(pre));
    memcpy(tempsuf, suf, sizeof(suf));
    for (int i = 1; i <= n; ++i) {
        if (a[i] == 1)
            continue;
        int d;
        if (i == 1)
            d = gcd(a[i] - 1, suf[i + 1]);
        else if (i == n)
            d = gcd(a[i] - 1, pre[i - 1]);
        else
            d = gcd(gcd(suf[i + 1], pre[i - 1]), a[i] - 1);
        if (d != 1) {
            --a[i];
            for (int j = 1; j <= n; ++j)
                a[j] /= d;
            int res = solve();
            for (int j = 1; j <= n; ++j)
                a[j] *= d;
            ++a[i];
            memcpy(pre, temppre, sizeof(pre));
            memcpy(suf, tempsuf, sizeof(suf));
            if (!res)
                return true;
        }
    }
    return false;
}

int main() {
//    freopen("in11.txt", "r", stdin);
    n = read();
    for (int i = 1; i <= n; ++i)
        a[i] = read();
    int res = solve();
    puts(res ? "First" : "Second");
}


Measured memory_bytes: 19328
#include<bits/stdc++.h>
using namespace std;
using p = pair<int,int>;
using pp = pair<p,p>;
using ll = long long;
const auto INF =(ll)1e5;
int main(){
  int n;
  cin >> n;
  auto a = vector<int>(INF+1,0);
  for (int i = 0; i < n; i++)
  {
    int t;
    cin >> t;
    a[t]++;
  }

  ll max_ = 0;
  for (int i = 0; i < a.size()-3; i++)
  {
    ll t = a[i]+a[i+1]+a[i+2];
    max_ = max(max_,t);
  }
  
  cout << max_;
  return 0;
}

Measured memory_bytes: 640
import java.math.BigInteger;
import java.util.*;

public class Main {
	
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int n = sc.nextInt();
			int h = sc.nextInt();
			int w = sc.nextInt();
			System.out.println((n - h + 1) * (n - w + 1));
		}
	}


	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define int long long int
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}
#define DUMP(x) cout<<#x<<" = "<<(x)<<endl
#define COUT(x) cerr<<#x<<" = "; cout<<(x)<<endl

struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

signed main()
{
   int n, a, b; cin >> n >> a >> b;
   V<int> p(n);
   for (int i = 0; i < n; i++) {
      cin >> p[i];
   }

   V<int> num(3);
   for (int i = 0; i < n; i++) {
      if (p[i] <= a) {
         num[0]++;
      } else if (p[i] <= b) {
         num[1]++;
      } else {
         num[2]++;
      }
   }

   cout << *min_element(num.begin(), num.end()) << endl;

   return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 1000000000
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int A[3], a[3];

  std::cin >> A[0] >> A[1] >> A[2];

  std::iota(a, a + 3, 0);

  int sm = INF;

  do {
    int s = 0;

    for (int i = 1; i < 3; i ++)
      s += std::abs(A[a[i]] - A[a[i - 1]]);

    sm = std::min(s, sm);
  } while (std::next_permutation(a, a + 3));

  std::cout << sm << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
typedef double D;
typedef complex<D> P;
#define EPS (1e-10)
 
D dot(P a, P b)
{
    return real(conj(a) * b);
}
 
D cross(P a, P b)
{
    return imag(conj(a) * b);
} 
 
int ccw(P p0, P p1, P p2)
{
    P a = p1 - p0;
    P b = p2 - p0;
  
    if (cross(a,b) > EPS) return 1;
    if (cross(a,b) < -EPS) return -1;
    if (dot(a,b) < -EPS) return 2;
    if (norm(a) < norm(b)) return -2;
    return 0;
}
 
bool check(P p1, P p2, P p3, P p4)
{
    return (ccw(p1, p2, p3)*ccw(p1, p2, p4) <= 0 &&
	    ccw(p3, p4, p1)*ccw(p3, p4, p2) <= 0);
}
  
int main()
{
    int n;
    P P[3], T[2];
  
    scanf("%d", &n);
    while (n--) {
	for (int i = 0; i < 3; i++) {
	    scanf("%lf %lf", &P[i].real(), &P[i].imag());
	}
 
	for (int i = 0; i < 2; i++) {
	    scanf("%lf %lf", &T[i].real(), &T[i].imag());
	}
 
	int cnt = 0; 
	if (check(P[0], P[1], T[0], T[1])) {
	    cnt++;
	}   
	if (check(P[0], P[2], T[0], T[1])) {
	    cnt++;
	} 
	if (check(P[1], P[2], T[0], T[1])) {
	    cnt++;
	} 
	if (cnt % 2) {
	    puts("OK");
	} else {
	    puts("NG");
	}
    }
    return 0;
}

Measured memory_bytes: 1208