akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
main(){
int i,j,k,l,m,n,o,p,q;
while(cin>>p>>q){
  int y[p+1],x[p+1]={0};
  for(i=1;i<=p;i++)cin>>y[i];
  for(i=0;i<q;i++){
    cin>>m>>n;
    if(y[m]<=y[n])x[m]=1;
     if(y[n]<=y[m])x[n]=1;
  }
  j=0;
  for(i=1;i<=p;i++)if(x[i]==0){j++;}
  cout<<j<<endl;
} return 0;

}


Measured memory_bytes: 4408
#include <stdio.h>

int solve(int ,int);

int n,A[2000];

int main(){

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

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&mi[i]);
    c=solve(0,mi[i]);
    if(c==1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int i,int m){
  if(m==0) return 1;
  if(i>=n) return 0;

  int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  return res;
}



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

long long max(long long a,long long b){
  if(a>b)return a;
  return b;
}

int main(){
  int mod=1000000007;
  int n,m,tmp;
  std::cin >> n>>m;
  std::vector<long long> v(n+1,0);
  for (int i = 0; i < m; i++) {
    std::cin >> tmp;
    v[tmp]=-1;
  }

  bool flag=true;
  v[0]=1;
  if(v[1]!=-1)v[1]=1;
  for (int i = 2; i <= n; i++) {
    // std::cout << i<<":"<<v[i] << '\n';
    if(v[i]==-1)continue;
    if(v[i-1]==-1 && v[i-2]==-1)flag=false;
    if(v[i-1]!=-1)v[i]=(v[i]+v[i-1])%mod;
    if(v[i-2]!=-1)v[i]=(v[i]+v[i-2])%mod;
    // std::cout << i<<":"<<v[i] << '\n';

  }
  if(flag==false)std::cout << "0" << '\n';
  else std::cout << v[n] << '\n';



  return 0;
}


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

vector<string> split(string s){
    vector<string> ret;
    
    string tmp = s.substr(0,1);
    tmp[0] = tolower(tmp[0]);

    for(int i = 1; i < s.length(); i++){
        if(s[i] == '_'){
            ret.push_back(tmp);
            tmp = "";
        }else if(isupper(s[i])){
            ret.push_back(tmp);
            tmp = s.substr(i, 1);
            tmp[0] = tolower(tmp[0]);
        }else{
            tmp += s.substr(i,1);
        }
    }

    if(tmp != "")   ret.push_back(tmp);
    
    return ret;
}

int main(){
    string s;
    char op;
    while(cin >> s >> op){
        if(op == 'X')   break;

        vector<string> v = split(s);
        int n = v.size();

        if(op == 'L'){
            cout << v[0];
            for(int i = 1; i < n; i++){
                v[i][0] = toupper(v[i][0]);
                cout << v[i];
            }
            cout << endl;
        }else if(op == 'U'){
            for(int i = 0; i < n; i++){
                v[i][0] = toupper(v[i][0]);
                cout << v[i];
            }
            cout << endl;
        }else if(op == 'D'){
            for(int i = 0; i < n; i++){
                cout << v[i] << "_\n"[i == n-1];
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    priority_queue<int> q;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        q.push(a);
    }

    for (int i = 0; i < m; i++) {
        int b = q.top();
        q.pop();
        q.push(b / 2);
    }

    long long ans = 0;
    for (int i = 0; i < n; i++) {
        ans += q.top();
        q.pop();
    }

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



Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>



using namespace std;



int main() {
	
	int a, b, x;

	cin >> a >> b >> x;

	double half = 1.0*a* a*b/2;
	double theta = 0;
	double pi = acos(-1);
	//cout << pi << endl;

	if (x < half) {
		double d = 1.0 *x / (a*b) * 2;
		theta = atan(b / d)/pi * 180;
	}
	else {
		double d = (b-1.0*x/ (a*a)) * 2;
		theta = atan(d / a) / pi * 180;
	}

	printf("%.10lf", theta);
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = sorted(zip(B, A))
B, A = zip(*C)
D = sorted((a, i) for i, a in enumerate(A))
E, indices = zip(*D)
for e, b in zip(E, B):
  if e > b:
    print("No")
    exit()
S = {0}
now = 0
for _ in range(n-1):
  if indices[now] in S:
    print("Yes")
    exit()
  now = indices[now]
  S.add(now)
for i in range(n-1):
  if E[i+1] <= B[i]:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 128512
/*
    User ID: qcw
       Time: 2017-10-10 21:54:54
*/
#include<bits/stdc++.h>
using namespace std;

using ll=long long;
ll A[26],ans;
string s;
int main(){
    cin.tie(0),ios_base::sync_with_stdio(0);
    cin>>s;
    ans=s.size()*(s.size()-1)/2+1;
    for(auto& x:s)++A[x-'a'];
    for(int i{};i<26;++i)
        if(A[i])ans-=A[i]*(A[i]-1)/2;
    cout<<ans<<endl;
}


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

const int N = 1e5 + 5;

int A[N], C[2][N], mx[2], mx2[2];

signed main(){
    int n;
    cin >> n;
    for(int i=1; i<=n; i++){
        int x;
        scanf("%d",&x);
        int h = i&1;
        int &r = C[h][x];
        r++;
        if(x == mx[h]) continue;
        if(C[h][ mx2[h] ] < r) mx2[h] = x;
        if(C[h][ mx[h] ] < C[h][ mx2[h] ]) swap(mx[h], mx2[h]);
    }
    
    int t = n - C[0][ mx[0] ] - C[1][ mx[1] ];
    if(mx[0] == mx[1])
    	t += C[0][ mx[0] ] - max(C[0][ mx2[0] ], C[1][ mx2[1] ]); 

    cout << t;
    return 0;
}

Measured memory_bytes: 4472
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define pii pair<int, int> 
#define mod 1000000007
ll power(ll a,ll b){
    ll res=1;
    while(b>0){
        if(b%2!=0) res=(res*a)%mod;
        a=(a*a);
        b/=2;
    }
    return res;
}
ll ncr(ll n,ll k){
    if(k==0||k==n) return 1ll;
    if(k>n-k) k=n-k;
    ll pro=1;
    for(ll i=0;i<k;i++){
        pro=(pro*(n-i));
        pro/=(i+1);
    }
    return pro;
}
int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    vector<ll> arr(n);
    ll maxx=INT_MIN,sum=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        sum+=arr[i];
        if(arr[i]>maxx) maxx=arr[i];
    }
    sum-=maxx;
    sum+=maxx/2;
    cout<<sum;
    return 0;
}


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

const int mod= 
998244353;

int n,m,mx;
long long ans;
int a[maxl],num[maxl];
char s[maxl];

inline void prework()
{
	scanf("%d",&n);
	int x;mx=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		num[a[i]]++;
		mx=max(mx,a[i]);
	}
}

inline long long qp(long long a,long long b)
{
	long long ans=1,cnt=a;
	while(b)
	{
		if(b&1)
			ans=ans*cnt%mod;
		cnt=cnt*cnt%mod;
		b>>=1;
	}	
	return ans;
}

inline void mainwork()
{
	ans=1;
	for(int i=1;i<=mx;i++)
		ans=ans*qp(num[i-1],num[i])%mod;
	if(a[1]!=0 || num[0]!=1)
		ans=0;
}

inline void print()
{
	printf("%lld",ans);
}

int main()
{
	int t=1;
	//scanf("%d",&t);
	for(int i=1;i<=t;i++)
	{
		prework();
		mainwork();
		print();
	}
	return 0;
}

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

using namespace std;
typedef long long ll;

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

  string s;
  cin >> s;

  reverse(begin(s), end(s));
  while (s.size() > 0) {
    if (s.substr(0, 5) == "maerd") s = s.substr(5);
    else if (s.substr(0, 7) == "remaerd") s = s.substr(7);
    else if (s.substr(0, 5) == "esare") s = s.substr(5);
    else if (s.substr(0, 6) == "resare") s = s.substr(6);
    else break;
  }

  if (s.size() == 0) cout << "YES" << "\n";
  else cout << "NO" << "\n";

}


Measured memory_bytes: 3756
#include<iostream>
#include<fstream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<math.h>

#define FIO ios_base::sync_with_stdio(0);  cin.tie(0);
#define PI 3.14159265358979323846
#define mod 998244353
#define ll long long
#define vll vector<long long>  

#define all(c) c.begin(), c.end()

// Used to traverse in any STL container with iterators
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)

// Find whether element is present in given container or not
#define present(container, element) (container.find(element) != container.end())

// Finds whether element in present container is present in vector or not
#define cpresent(container, element) (find(all(container),element) != container.end())

using namespace std;



int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif
    FIO

    int n;
    cin>>n;
    int ans;
    int arr[10000];
    for(int i=0;i<10000;i++)arr[i]=0;

    for(int x=1;x<=100;x++){
        for(int y=1;y<=100;y++){
            for(int z=1;z<=100;z++){
                ans = x*x + y*y + z*z + z*x + x*y + y*z;
                if(ans <= 10000){
                    arr[ans-1]++;
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        cout<<arr[i]<<endl;
    }
    
    
}

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

using namespace std;

int main()
{
    int n , i;
    cin>>n;

    bool ok = 0;

    for(i = 9 ; i >= 1 ; i--){
        if(n%i == 0){
            int ans = n/i;
            //cout<<ans<<endl;
            if(ans >= 1 && ans <= 9){
                ok = 1;
                break;
            }
        }
    }

    if(ok) cout<<"Yes\n";
    else cout<<"No\n";

    return 0;
}


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

int main() {
    ll n,m,k;
    cin >> n >> m >> k;
    vector<ll> A(n + 1);
    vector<ll> B(m + 1);
    vector<ll> sum_a(n + 1);
    vector<ll> sum_b(m + 1);

    ll now_data_num = n;

    sum_a.at(0) = 0;
    sum_b.at(0) = 0;

    ll max = 0;

    for(ll i = 1 ; i <= n ; i++){
        cin >> A.at(i);
        sum_a.at(i) = sum_a.at(i - 1) + A.at(i);
        if(sum_a.at(i) > k){
            if(now_data_num == n){
                now_data_num = i;
            }
        }else{
            max = i;
        }
    }


    for(ll i = 1 ; i <= m ; i++){
        cin >> B.at(i);
        sum_b.at(i) = sum_b.at(i - 1) + B.at(i);
        if(sum_b.at(i) > k){
            continue;
        }
        while(1){
            if(now_data_num < 0){
                break;
            }
            if(sum_b.at(i) + sum_a.at(now_data_num) > k){
                now_data_num--;
            }else{
                if(max < i + now_data_num){
                    max = i + now_data_num;
                }
                break;
            }
        }
    }

    cout << max << endl;

}

Measured memory_bytes: 9504
fun main(args: Array<String>) {
    val (A, B) = readLine()!!.split(" ").map(String::toLong)
    val result = mutableListOf<Long>()

    val higher = Math.max(A, B)
    val lower = Math.min(A, B)
    // 約数のList
    fun divisor(value: Long): List<Long> {
        val max = Math.sqrt(value.toDouble()).toLong()
        return (1..max)
            .filter { value % it == 0L }
            .map { listOf(it, value / it) }
            .flatten()
            .sorted()
    }

    val divisorList = divisor(lower)
    for (i in divisorList) {
        if (i == 1L) {
            continue
        }
        if (higher % i == 0L) {
            if (!result.any { i % it == 0L }) {
                result.add(i)
            }
        }
    }
    result.add(1)


    result.size.let(::println)
}

Measured memory_bytes: 46396
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
int x,a,b;
int main(){
  cin>>x>>a>>b;
  if(abs(x-a)<abs(x-b)){
    prin("A");
  }
  else{
    prin("B");
  }

  return 0;
}


Measured memory_bytes: 256
#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 A,B;
    cin >> A >> B;
    cout << max(0,A-B*2) << endl;
}

Measured memory_bytes: 256
# AtCoder Beginner Contest 123
# https://atcoder.jp/contests/abc123
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def check(nn, k):
    nnl = len(nn)
    for i in range(nnl):
        for j in range(i+1, nnl):
            d = abs(nn[i] - nn[j])
            if d > k:
                return False
    return True

def main():
    abcde = ii2nn(5)
    k = i2n()
    if check(abcde, k):
        print('Yay!')
    else:
        print(':(')

main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long 
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define vi vector<int>
#define pb push_back
using namespace std;
const int N=505;
bool f[N][N];
int n,ans,dist[N][N],cnt;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
inline bool ok(int x,int y){return (x>=1&&y>=1&&x<=n&&y<=n);}
void dfs(int x,int y)
{
	if(!dist[x][y])return;
	dist[x][y]--;
	for(int i=0;i<4;i++)
	{
		int x2=x+dx[i];
		int y2=y+dy[i];
		if(ok(x2,y2)&&dist[x][y]+1+f[x2][y2]==dist[x2][y2])
		{
			dfs(x2,y2);
		}
	}
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			dist[i][j]=min(min(i-1,n-i),min(j-1,n-j))+1,f[i][j]=true;
	for(int i=0;i<n*n;i++)
	{
		cnt++;
		int x;
		cin>>x;
		int a=x/n+1-(x%n==0),b=x%n;
		if(b==0)b=n;
		dfs(a,b);ans+=dist[a][b];
		f[a][b]=false;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 24160
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

int main() {
  i64 N, D;
  cin >> N >> D;
  D = 2 * D + 1;
  cout << N / D + !!(N % D) << endl;
}


Measured memory_bytes: 256
//author: Harsh Nema
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 922337203685477;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
bool isp(ll n){
  if(n<=1)
    return false;
  else{
    for(ll i=2;i*i<=n;++i){
      if(n%i==0) return false;
    }
    return true;
  }
}
int main()
{
    fastio;
    ll n=0;
    cin>>n;
    while(!isp(n)) ++n;
    cout<<n;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=9;i++){
		for(int j=1;j<=9;j++){
			if(i*j==n){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
}

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

int main()
{
    ll n;
    cin >> n;
    ll ans = n - 1;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0)
        {
            ll j = n / i;
            ans = min(ans, i + j - 2);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#include <vector>
#include<math.h>
#include<string.h>
using namespace std;
#define MAX 300005
#define MOD 998244353
#define INF 1000000000000000000
#define EPS 0.0000000001
#define CHAINS 18
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
set<pair<int,int> > S;
set<pair<int,int> > ::iterator it;
int rows[MAX],columns[MAX];
vector<int> R,C;
int main()
{
    int H,W,M,i,j;
    scanf("%d %d %d",&H,&W,&M);
    pair<int,int> p;
    int rmax=0,cmax=0;
    for(i=0;i<M;i++)
    {
        scanf("%d %d",&p.first,&p.second);
        S.insert(p);
        rows[p.first]++;
        columns[p.second]++;
        rmax=max(rmax,rows[p.first]);
        cmax=max(cmax,columns[p.second]);
    }
    int ans=rmax+cmax-1;
    for(i=1;i<=H;i++)
    {
        if(rows[i]==rmax)
        {
            R.push_back(i);
        }
    }
    for(i=1;i<=W;i++)
    {
        if(columns[i]==cmax)
        {
            C.push_back(i);
        }
    }
    for(i=0;i<R.size();i++)
    {
        p.first=R[i];
        for(j=0;j<C.size();j++)
        {
            p.second=C[j];
            it=S.lower_bound(p);
            if(it==S.end()||(*it)!=p)
            {
                printf("%d",ans+1);
                return 0;
            }
        }
    }
    printf("%d",ans);
    return 0;
}


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

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

    int taro, hanako;
    taro = 0;
    hanako = 0;
    for (int i = 0; i < n; ++i) {
        string a, b;
        cin >> a >> b;

        if (a.compare(b) < 0) {
            hanako += 3;
            continue;
        }
        if (a.compare(b) == 0) {
            taro += 1;
            hanako += 1;
            continue;
        }
        if (0 < a.compare(b)) {
            taro += 3;
            continue;
        }
    }
    cout << taro << " " << hanako << endl;

    return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    double d;
    cin >> d;
    fcout << d * 3.141 * 2.0 << endl;
    return 0;
}

Measured memory_bytes: 3804
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = Integer.parseInt(sc.next());

		sc.close();

		boolean flag = false;
		for(int i = 1;i <= 9;i++) {
			for(int j = 1;j <= 9;j++) {
				if(i * j == N) {
					flag = true;
				}
			}
		}
		System.out.println(flag ? "Yes" : "No");

	}
}



Measured memory_bytes: 23764
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <bitset>
#include <complex>
using namespace std;
 
const double EPS = 1e-9;
const double PI = 3.14159265359;
 
typedef complex<double> P;

int main(){
	string s;

	while(getline(cin, s)){
		stack<double> st;
		stringstream ss;

		ss << s;
		while(ss >> s){
			if(s[0] >= '0' && s[0] <= '9' || s.size() > 1){
				st.push(atoi(s.c_str()));
			}else{
				double a, b;
				b = st.top();
				st.pop();
				a = st.top();
				st.pop();
				switch(s[0]){
				case '+':
					st.push(a+b);
					break;
				case '-':
					st.push(a-b);
					break;
				case '*':
					st.push(a*b);
					break;
				case '/':
					st.push(a/b);
					break;
				}
			}
		}
		printf("%lf\n", st.top());
	}

    return 0;
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<P>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
template <typename T>inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}

ll mypow(ll a,ll b){
    ll ret=1;
    while(b--){
        ret*=a;
    }
    return ret;
}

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

    cout<<(100*(n-m)+1900*m)*mypow(2,m)<<endl;
    return 0;
}

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

using namespace std;

typedef pair<int,int> pi;
typedef long long ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int N;
	vector<ld> v;
	cin >> N;
	v.resize(N);
	ld tot = 0;
	for (int i = 0; i < N; ++i) cin >> v[i];
	sort(v.begin(),v.end());
	ld x2 = 1;
	for (int i = N-1; i >= 0; --i){
		if (i != 0) x2 /= 2;
		tot += v[i]*x2;
	}
	cout << tot << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

bool canReach(int from, int to, string S){
    bool ret = 1;
    for(int i = from+1; i <= to-2; i++){
        if(S[i-1] == '#' && S[i] == '#') ret = 0;
    }
    return ret;
}

bool canJump(int spos, int fpos, int fnuke_to, string S){
    bool ret = 0;
    for(int i = fpos; i <= fnuke_to; i++){
        if(S[i-2] == '.' && S[i-1] == '.' && S[i] == '.') ret = 1;
    }
    return ret;
}

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,A,B,C,D; cin >>N>>A>>B>>C>>D;
    string S; cin >> S;

    bool snuke = canReach(A,C,S);
    bool fnuke = canReach(B,D,S);

    if(C > D){
        bool jump = canJump(A,B,D,S);
        if(jump && snuke && fnuke) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    else{
        if(snuke && fnuke) cout << "Yes" << endl;
        else cout << "No" << endl;
    }



}

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

int n, kk, c;
char str[200005];
int work[2][200005];
int pw[2] = {0};

int main () {
	cin >> n >> kk >> c >> str;
	int rem = -1000000000;
	for (int i = 0; i < n; ++i) {
		if (str[i] == 'x')
			continue;
		if (i-rem > c) {
			work[0][++pw[0]] = i;
			rem = i;
		}
	}
	if (pw[0] > kk)
		return 0;
	pw[1] = pw[0];
	rem = 1000000000;
	for (int i = n-1; i >= 0; --i) {
		if (str[i] == 'x')
			continue;
		if (rem-i > c) {
			work[1][pw[1]--] = i;
			rem = i;
		}
	}
	for (int i = 1; i <= pw[0]; ++i)
		if (work[0][i] == work[1][i])
			cout << work[0][i]+1 << endl;
	return 0;
}

Measured memory_bytes: 3200
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	char s[100001];
	int i,cnt,len;
	scanf("%s",s);
	len=strlen(s);
	cnt=0;
	for(i=1;i<len;i++)	{
		if(s[i]!=s[i-1])	cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}

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


int main() {
  string S;
  int N,K;
  cin >> N >> K >> S;
  if(S[K-1]=='A'){
    S[K-1]='a';
  }else if(S[K-1]=='B'){
    S[K-1]='b';
  }else{
    S[K-1]='c';
  }
  cout << S << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	string s;
    cin>>s;
    int c=0,m=0;
    FOR(i,0,3){
        if(s[i]=='S'){
            m=max(c,m);
            c=0;
        }else{
            c++;
            m=max(m,c);
        }
    }
    cout<<m<<endl;
}


Measured memory_bytes: 3616
#include <iostream>

using namespace std;

int main(void) {
    int X, Y;
    cin >> X >> Y;

    if(Y%2 == 0 && 2*X <= Y && Y <= 4*X) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3592
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C: Christmas Eve
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int INF = 1 << 30;

/* typedef */

/* global variables */

int hs[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  k--;

  for (int i = 0; i < n; i++) scanf("%d", hs + i);
  sort(hs, hs + n);

  int mind = INF;
  for (int i = 0, j = k; j < n; i++, j++) {
    int d = hs[j] - hs[i];
    if (mind > d) mind = d;
  }
  printf("%d\n", mind);
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
int bubble(int a[],int k);
main()
{

    int i,j,a[100],n=6,k;
    for(i=1;i<n;i++)
    scanf("%d",&a[i]);
    bubble(a,n);

    for(i=1;i<n;i++)
    {
        printf("%d",a[i]);
        if(i<5)
        printf(" ");
        else printf("\n");
    }
    return 0;
}
int bubble (int a[],int n)
{
    int i,j,tmp;

    for(i=1;i<n;i++)
    {
        for(j=1;j<n-i;j++)
        {
            if(a[j]<a[j+1])
            {
            tmp=a[j];
            a[j]=a[j+1];
            a[j+1]=tmp;
            }
        }
    }
    return a;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);
int main()
{
    string S;
    cin >> S;
    if (S[0] - '0' >= 1 && S[1] - '0' >= 3 || S[0] == '0' && S[1] == '0')
    {
        if (S[2] - '0' >= 1 && S[3] - '0' >= 3 || S[2] - '0' == 0 && S[3] - '0' == 0)
        {
            cout << "NA" << endl;
        }
        else
        {
            cout << "YYMM" << endl;
        }
    }
    else
    {
        if (S[2] - '0' >= 1 && S[3] - '0' >= 3 || S[2] - '0' == 0 && S[3] - '0' == 0)
        {
            cout << "MMYY" << endl;
        }
        else
            cout << "AMBIGUOUS" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
//@author yash2040
#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<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
//#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main()
{
	fast();
	int n,m;
	cin>>n>>m;
	int arr[m];
	ll sum=0;
	for(int i=0;i<m;i++)
	{
		cin>>arr[i];
		sum+=arr[i];
		}	
	if(n>=sum)
	cout<<n-sum<<endl;
	else
	cout<<"-1"<<endl;
}





Measured memory_bytes: 3680
s = input()
N=int(s)
A = input().split()

buka_num = [0] * N 
#buka_num=[]
for i in range(N-1):
    #print(i)
    buka_num[int(A[i])-1] += 1
        
for i in range(N):
    print(buka_num[i])

Measured memory_bytes: 25100
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    int n, m;
    cin >> n >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
}

Measured memory_bytes: 764
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ft first
#define sd second
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 1 << 19;

char T[maxN];

void solve()
{
	int n, a, b, c;
	scanf ("%d%d", &n, &a);
	
	printf("%s\n", n * 500 >= a ? "Yes" : "No");
}

int main()
{
	int t;
	t = 1;//scanf ("%d", &t);
	while (t--)
		solve();
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define pll pair<ll, ll>
#define vint vector<int >
#define vll vector<ll >
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    ll ans = 1;
    bool is_zero = false;
    vll a(n);
    REP(i,n){
        cin >> a[i];
        if(a[i]==0) is_zero = true;
    }
    // zero
    if(is_zero == true){
        cout << "0\n";
        return 0;
    }

    // not zero
    REP(i,n){     
        if(a[i] <= (ll)1e18/ans){
            ans *= a[i];
        }else{
            cout << "-1\n";
            return 0;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

using ll = long long;
const ll mod = LLONG_MAX;


int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(b-a==c-b){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int ans = 0;
    for(int i = 0; i <= 100; ++i)
        if(i >= a and i <= b and i >= c and i <= d)
            ++ans;
    if(ans > 0)
        --ans;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int mod=1000000007;
int main()
{
	int n,m,i;
	cin>>n>>m;
	int h[n],a,b,f[n],c=0;
	for(i=0;i<n;i++) 
	{
	cin>>h[i]; f[i]=0;
	}
	for(i=0;i<m;i++)
	{
		cin>>a>>b;
		if(h[a-1]>h[b-1]) f[b-1]=1;
		else if(h[a-1]<h[b-1]) f[a-1]=1;
		else {
			f[a-1]=1; f[b-1]=1;
		}
	}
	for(i=0;i<n;i++)
	{
		if(f[i]==0) c++;
	}
	cout<<c;
	return 0;
}

Measured memory_bytes: 4416
#!/usr/bin/env python3
# coding: utf-8

n, m = map(int, input().split())
c = [ int(x) for x in input().split() ]

dp = [ float('inf') ] * 50001
dp[0] = 0

for i in range(1, 50001):
    cand = float('inf')
    for j in c:
        if i-j < 0:
            continue 
        else:
            cand = min(cand, dp[i-j] + 1)
    dp[i] = cand

print (dp[n])




Measured memory_bytes: 7272
#include <stdio.h>

int main(void)
{
	int N, K, i;
	int a[100000];
	int counter=0;

	scanf("%d %d", &N, &K);

	for(i=0; i<N; i++)
	{
		scanf("%d", &a[i]);
	}
	N = N -K;
	counter += 1;
	counter += N/(K-1);
	if(N%(K-1) != 0) counter += 1;

	printf("%d", counter);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int main() {
    long long N,K;
    cin >> N >>K;
    vector<long long> a(N);
    for (int i=0;i<N;i++){
        cin >> a.at(i);
    }
    
    long long ans = 0;
    for(int i=0; i<N; i++){
        long long p=0,q=0;
        for(int j=0;j<N;j++){
            if(a.at(i) > a.at(j)){
                p += 1;
                if(i < j){
                    q += 1;
                }
            }
        }
        ans += ((q * K)%MOD +  (p * ((K * (K-1) /2)%MOD))%MOD)%MOD;
        ans = ans%MOD;
    }
    
    cout << ans%MOD << endl;
}



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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  int n;cin>>n;
  bool used[n+10]={};
  vector<int>bo(n+10);
  for(int i=1;i<=n;i++){
    cin>>bo[i];
  }
  int cnt=0;
  int now=1;
  bool flag=true;
  while(1){
    if(used[now]){flag=false;break;}
    used[now]=true;
    now=bo[now];
    cnt++;
    if(now==2)break;
  }
  if(flag)cout<<cnt<<endl;
  else cout<<-1<<endl;
  return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;

int n;
ll a[3010];
ll dp[3010][3010];
int flag[3010][3010];

ll ddpp(int x,int y){
    if (flag[x][y]){
        return dp[x][y];
    }
    else{
        flag[x][y]=1;
        if (x==y){
            dp[x][y]=a[x];
            return dp[x][y];
        }
        else{
            dp[x][y]=max(-ddpp(x,y-1)+a[y],-ddpp(x+1,y)+a[x]);
            return dp[x][y];
        }
    }
}


int main() {
    cin>>n;
    rep(i,n){
        cin>>a[i+1];
    }
    ddpp(1,n);
    cout<<dp[1][n]<<endl;
    

    return 0;
}

Measured memory_bytes: 105088
#include<bits/stdc++.h>
using namespace std;
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
const int MOD = 1000000007;



void solve() {
  int s;
  cin >> s;
  int n = s;
  int sum = 0;
  while(n > 0) {
    int x = n % 10;
    sum += x;
    n /= 10;
  }
  cout << ((s % sum == 0) ? "Yes" : "No") << endl;
}

int main() {
  solve();
  return 0;
}

Measured memory_bytes: 256
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int a, b; cin >> a >> b;
	println(a*b);
}


Measured memory_bytes: 3644
/*
    AUTHOR:hruday pabbisetty
    NIT ROURKElA
*/
#include <bits/stdc++.h>
using namespace std;
#define opt ios_base::sync_with_stdio(0)
#define lli long long int
#define ulli unsigned long long int
#define I int
#define S string
#define D double
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define in3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define out(n) printf("%lld\n",n)
#define inu(a) scanf("%lld",&a)
#define outu(a) printf("%llu",a)
#define ins(s) scanf("%s",&s)
#define outs(s) printf("%s",s)
#define nl printf("\n")
#define mod 1000000007
#define inf 100000000000000
typedef long long       ll;
typedef pair<lli,lli>  plli;
typedef vector<lli>     vlli;
typedef vector<ulli>    vulli;
typedef vector<ll>      vll;
typedef vector<string>  vs;
typedef vector<plli>     vplli;
#define MM(a,x)  memset(a,x,sizeof(a));
#define ALL(x)   (x).begin(), (x).end()
#define P(x)       cerr<<"{"#x<<" = "<<(x)<<"}"<<endl;
#define P2(x,y)       cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<"}"<<endl;
#define P3(x,y,z)  cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"}"<<endl;
#define P4(x,y,z,w)cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<", "#w" = "<<(w)<<"}"<<endl;
#define PP(x,i)     cerr<<"{"#x"["<<i<<"] = "<<x[i]<<"}"<<endl;
#define TM(a,b)     cerr<<"{"#a" -> "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n";
#define UN(v)    sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define sz() size()
//#define nl cout<<"\n"
#define MX1 100005
#define MX2 1000005
#define sqr(a) a*a*a
#define bs binary_search
#define lb lower_bound
#define ub upper_bound

lli power(lli a,lli b)
    {
    lli value;
    if(b==0)
        {
        return 1;
    }
    else if(b%2==0)
        {
        value=power(a,b/2)%mod;
        return(value*value)%mod;
    }
    else
        {
        value=power(a,b/2)%mod;
        return ((a*value)%mod*(value))%mod;
    }
}
int main()
{
      /*  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif*/
    opt;
    string s;
    cin>>s;
    lli a[26]={0},i;
    rep(i,0,s.sz())
    {
        a[s[i]-'a']++;
    }
    rep(i,0,26)
    {
        if(!a[i])
        {
            char ch='a'+i;
            cout<<ch;
            exit(0);
        }
    }
    cout<<"None";
}


Measured memory_bytes: 512
import java.util.*;
 
class Main{
    public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		int[] a = new int[6];
		int[] b = new int[6];
		for(int i=0; i<6; i++){
			a[i] = scan.nextInt();
		}
		for(int i=0; i<6; i++){
			b[i] = scan.nextInt();
		}
		Dice xai1 = new Dice(a);
		Dice xai2 = new Dice(b);
		System.out.println(xai2.cheakSameDice(xai1, xai2));
    }
}

class Dice{
	int[] dice;
	public Dice(int[] a){
		dice = new int[6];
		for(int i=0; i<6; i++){
			dice[i] = a[i];
		}
	}
	public void roll(char c){
		int tmp = 0;
		switch(c){
			case 'N':
				tmp = dice[0];
				dice[0] = dice[1];
				dice[1] = dice[5];
				dice[5] = dice[4];
				dice[4] = tmp;
				break;
			case 'W':
				tmp = dice[0];
				dice[0] = dice[2];
				dice[2] = dice[5];
				dice[5] = dice[3];
				dice[3] = tmp;
				break;
			case 'S':
				tmp = dice[0];
				dice[0] = dice[4];
				dice[4] = dice[5];
				dice[5] = dice[1];
				dice[1] = tmp;
				break;
			case 'E':
				tmp = dice[0];
				dice[0] = dice[3];
				dice[3] = dice[5];
				dice[5] = dice[2];
				dice[2] = tmp;
				break;
		}
	}
	public void rotation(){ //???????????????????¨???????????????????
		int tmp = dice[1];
		dice[1] = dice[2];
		dice[2] = dice[4];
		dice[4] = dice[3];
		dice[3] = tmp;
	}

	public String cheakSameDice(Dice xai1, Dice xai2){
		if(compareDices(xai1, xai2, 'N', 'W'))return "Yes";
		if(compareDices(xai1, xai2, 'N', 'E'))return "Yes";
		if(compareDices(xai1, xai2, 'S', 'W'))return "Yes";
		if(compareDices(xai1, xai2, 'S', 'E'))return "Yes";
		return "No";
	}

	public boolean checkSurface(Dice xai1, Dice xai2){
		if(xai1.dice[0]==xai2.dice[0] && xai1.dice[1]==xai2.dice[1] && xai1.dice[2]==xai2.dice[2] && xai1.dice[3]==xai2.dice[3] && xai1.dice[4]==xai2.dice[4] && xai1.dice[5]==xai2.dice[5]){
			return true;
		}
		return false;
	}

	public boolean compareDices(Dice xai1, Dice xai2, char c1, char c2){
		for(int i=0; i<6; i++){
			for(int j=0; j<6; j++){
				xai2.roll(c1);
				if(checkSurface(xai1, xai2))return true;
				xai2.roll(c2);
				if(checkSurface(xai1, xai2))return true;;
			}
			xai2.rotation();
			if(checkSurface(xai1, xai2))return true;
		}
		return false;
	}

	public int showTop(){
		return dice[0];
	}
}

Measured memory_bytes: 26416
#include<bits/stdc++.h>
#define For(i , j , k) for (int i = (j) , _##end_ = (k) ; i <= _##end_ ; ++ i)
#define Fordown(i , j , k) for (int i = (j) , _##end_ = (k) ; i >= _##end_ ; -- i)
#define Set(a , b) memset(a , b , sizeof(a))
#define pb push_back
#ifdef hany01
#define debug(...) fprintf(stderr , __VA_ARGS__)
#else
#define debug(...)
#endif 
using namespace std;

inline void file()
{
	freopen("a.in" , "r" , stdin);
    freopen("a.out" , "w" , stdout);
}

char c_;
int _ , __;
inline int read()
{
    for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar())
            if (c_ == '-')
                __ = -1;
    for ( ; isdigit(c_) ; c_ = getchar())
        _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}

const int maxn = 100015;
int n , a[maxn] , Ans , cnt;

int main()
{
#ifdef hany01
	file();
#endif
    n = read();
    For(i , 1 , n)
        a[i] = read();
    For(i , 1 , n - 1)
        if (i == a[i])
        {
            swap(a[i] , a[i + 1]);
            ++cnt;
        }
    if (a[n] == n)
        ++ cnt;
    printf("%d\n" , cnt);
    return 0;
}


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

int main() {
	int A, B;
	int max=0,max2=0;
	cin >> A >> B;
	if (A > B) {
		max = A;
		A--;
	}
	else {
		max = B;
		B--;
	}
	if (A > B)
		max2 = A;
	else
		max2 = B;
	cout << max + max2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
using namespace std;
using ll=long long;
#define MOD  1000000007


int main(int argc, char const *argv[]) {
  int a,b,c;
  std::cin >> a >> b >> c;
  std::cout << a*b/2 << '\n';
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {1,-1};
 
static const double EPS = 1e-8;
 
int main(){
  string buf;
  string lhs = "qwertasdfgzxcvb";
  string rhs = "yuiophjklnm";
  sort(lhs.begin(),lhs.end());
  sort(rhs.begin(),rhs.end());
 
  while(cin >> buf){
    if(buf == "#") break;
    int res = 0;
    bool flag = (lhs.find(buf[0]) != string::npos ? true : false);
    for(int i=1;i<buf.size();i++){
      bool old_flag = flag;
      flag = (lhs.find(buf[i]) != string::npos ? true : false);
      if(old_flag != flag) res++;
    }
 
    printf("%d\n",res);
  }
}

Measured memory_bytes: 1212
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int t;
gl(t);
map<ll,int> m;
ll ans=0;
while(t--)
{
	ll x;
	cin>>x;
	m[x]++;
}
vll v;
tr(m,it)
{
	if((it->ss)>=2)v.pb(-(it->ff));
}

sort(all(v));
if(v.size()==1)
{
	if(m[-v[0]]>=4)ans=v[0]*v[0];
}
if(v.size()>=2)
{
	if(m[-v[0]]>=4)ans=v[0]*v[0];
	else
	ans=v[0]*v[1];
}
ol(ans);
return 0;
}



Measured memory_bytes: 6528
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    ll a[n];
    for(int i = 0; i < n; i++)  cin >> a[i];
    vector<vector<ll>> dp(n, vector<ll>(n, 1ll<<60));
    for(int i = 0; i < n; i++)  dp[i][i] = 0;
    for(int i = 1; i < n; i++)  a[i] += a[i-1];
    for(int wid = 2; wid <= n; wid++){
        for(int i = 0; i+wid-1 < n; i++){
            for(int j = i; j < i+wid-1; j++){
                dp[i][i+wid-1] = min(dp[i][i+wid-1], dp[i][j]+dp[j+1][i+wid-1]);
            }
            dp[i][i+wid-1] += a[i+wid-1] - (i==0 ? 0 : a[i-1]);
        }
    }
    cout << dp[0][n-1] << endl;
    return 0;
}

Measured memory_bytes: 1536
import java.io.DataInputStream;
import java.io.IOException;

class Main {

    final private static int BUFFER_SIZE = 1 << 16;
    private static DataInputStream din;
    private static byte[] buffer;
    private static int bufferPointer, bytesRead;

    public static void main(String[] args) throws IOException {
        Reader reader = new Reader();
        int n = reader.nextInt();
        int counter = 0;
        String ans = "No";

        for (int i = 0; i < n; i++) {
            int a = reader.nextInt();
            int b = reader.nextInt();

            if (counter >= 2 && (a == b)) {
                ans = "Yes";
                continue;
            } else if (a != b) {
                counter = 0;
            } else {
                counter++;
            }
        }

        System.out.println(ans);
    }

    static class Reader {

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }

    }
}

Measured memory_bytes: 32380