akhauriyash/Code-Regression huggingface dataset:
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

#define MAXN (1 << 20)

int p[MAXN];

int main() {
	for (int i = 2; i < MAXN; i++) {
		p[i] = 1;
	}
	for (int i = 2; i < MAXN; i++) {
		if (p[i]) {
			for (int j = 2 * i; j < MAXN; j += i) {
				p[j] = 0;
			}
		}
	}
	int x;
	cin >> x;
	for (int i = x; i < MAXN; i++) {
		if (p[i]) {
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 7688
#include <stdio.h>

int main(void)
{
	int i;
	int s;
	static int count;

	scanf("%d", &s);

	if (s / 100 != 0) count++;
	if ((s % 100) / 10 != 0) count++;
	if (s % 10 != 0) count++;

	printf("%d", count);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		 //sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }


using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;


const int MOD = 1e9+7;
const int INF = 1e9;
ll ans = 0;
int N;
void dfs(ll x, int a, int b, int c){
	if(x > N){
		return;
	}
	if(a>0&&b>0&&c>0){
		ans++;
	}
	dfs(10*x+3,a+1,b,c);
	dfs(10*x+5,a,b+1,c);
	dfs(10*x+7,a,b,c+1);

}
int main() {
	cin>>N;
	dfs(0,0,0,0);
	cout<<ans<<endl;

}

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

int main(){
    int N;
    int fx = 0;
    cin >> N;
    int x = N;
    while(x > 0){
        fx += x % 10;
        x /= 10;
    }
    if(N % fx == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int N, M; cin >> N >> M;
        vector<int> sum(N+1);
        rep(i, M) {
            int l, r; cin >> l >> r;
            sum[l-1]++;
            sum[r]--;
        }
        rep(i, N) sum[i + 1] += sum[i];
        int ans = 0;
        rep(i, N) {
            ans += sum[i] == M;
        }
        cout << ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=500010;

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

    string s;
    cin>>s;
    if(s[0]=='7'||s[1]=='7'||s[2]=='7'){cout<<"Yes";}
    else{cout<<"No";}

    return (0);
}


Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
//scanf("%d", &a); '\n';

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	int n;
	cin >> n;
	vector<int> p(n);
	int cnt = 0;
	int theta = MOD;
	rep(i, n) {
		scanf("%d", &p[i]);
		int alpha = theta;
		theta = min(theta, p[i]);
		if (alpha != theta) ++cnt;
	}
	cout << cnt;
}



Measured memory_bytes: 1024
"""from collections import *
from itertools import *
from bisect import *
from heapq import *

import math
from fractions import gcd"""
N,K=map(int,input().split())

#A=[list(reversed(list(map(int,input().split())))) for i in range(N)]
A=list(map(int,input().split()))
A.sort()
mod=10**9+7
fac=[1,1]
for i in range(2,N+1):
    fac.append(fac[i-1]*i%mod)
ifac=[pow(i,mod-2,mod) for i in fac]


if K==1:
    print(0)
    exit()


count=0
ncount=0
for i in range(N-K+1):
    n=N-i-K
    m=i+K-2
    ncount+=fac[m]*ifac[K-2]*ifac[m-(K-2)]%mod
    ncount%=mod
    count-=A[n]*ncount
    count%=mod

ncount=0
for i in range(K-1,N):
    n=i-1
    ncount+=fac[n]*ifac[K-2]*ifac[n-(K-2)]%mod
    ncount%=mod
    count+=A[i]*ncount
    count%=mod
print(count)


Measured memory_bytes: 67112
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
	
	int t;
	cin >> t;
	cout << (t >= 30 ? "Yes" : "No") << endl;	
	
}





Measured memory_bytes: 3620
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        int d=sc.nextInt();
        

        int ab= a<b ? a: b;
        int cd=c<d ? c : d;
        System.out.println(ab+cd);
        
    }
}

Measured memory_bytes: 21588
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cmath>
#define ll long long
#define maxn 0x3f3f3f3f
using namespace std;
int map[11][11],p[20],sum;
int n,m;
struct node{
	int i;
}r[20];
int check(int a){
	int sign=0,k=0;
	for(int j=1;j<=n;j++){
		if((map[a][j]==1)&&(r[j].i==1))
		{
			sign++;
			
		}
	}	
//	cout<<sign<<endl;
	if(sign%2==p[a]%2) return 1;
	else return 0;
}
void bao(void){
	
	for( r[1].i=0;r[1].i<=1;r[1].i++)
	for( r[2].i=0;r[2].i<=1;r[2].i++)
	for( r[3].i=0;r[3].i<=1;r[3].i++)
	for( r[4].i=0;r[4].i<=1;r[4].i++)
	for( r[5].i=0;r[5].i<=1;r[5].i++)
	for( r[6].i=0;r[6].i<=1;r[6].i++)
	for( r[7].i=0;r[7].i<=1;r[7].i++)
	for( r[8].i=0;r[8].i<=1;r[8].i++)
	for( r[9].i=0;r[9].i<=1;r[9].i++)
	for( r[10].i=0;r[10].i<=1;r[10].i++)	
	{
		int cnt = 0;
		
		for(int j=1;j<=m;j++)
		{
//			cout<<check(j)<<endl;
			if(check(j)==1) 
			{				
				cnt++;
												
			} else break;
					
			if(cnt == m){				
			sum++;			
			cnt=0;
		}	
		}
		
	}
}
int main()
{

	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int k;
		cin>>k;
		for(int j=1;j<=k;j++)
		{
			int so;
			cin>>so;
			map[i][so] = 1;
		}
	}
	for(int i=1;i<=m;i++)
	{
		cin>>p[i];
	}
	bao();
	cout<<sum/pow(2,10-n)<<endl;
	
}


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

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vl A(N);
  ll rev = 0;
  REP(i, N) {
    cin >> A[i];
    if (A[i] < 0)
      rev++;
  }
  sort(ALL(A));

  ll ans1 = 0, ans2 = 0;
  if (rev == N)
    rev--;

  REP(i, N) {
    if (ceil((long double)rev / 2) * 2 > i)
      ans1 -= A[i];
    else
      ans1 += A[i];
    if (floor((long double)rev / 2) * 2 > i)
      ans2 -= A[i];
    else
      ans2 += A[i];
  }
  cout << max(ans1, ans2) << endl;
  return 0;
}


Measured memory_bytes: 1152
#include<iostream>
#include<cmath>
#include<numeric>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<vector>
#define start int main() {
#define stop return 0;}
using namespace std;
typedef long long ll;
typedef long l;

ll GCD(ll ,ll);
//map<l,int>prime_factor_count(ll );
map<ll, int> prime_factor_count(ll );


///main function start
start
    ll num1,num2;
    cin>>num1>>num2;
    ll gcd=GCD(num1,num2);
    ///cout<<gcd<<endl;
    cout<<prime_factor_count(gcd).size()+1<<endl;
stop
///main function stop

ll GCD(ll n1,ll n2)
{
    if(n1%n2==0)
        return n2;
    return GCD(n2,n1%n2);
}

map<ll, int> prime_factor_count(ll num) {
    map< ll, int > cnt;
    for(l i = 2; i * i <= num; i++) {
        while(num % i == 0) {
            cnt[i]++;
            num /= i;
        }
    }
    if(num != 1)
        cnt[num] = 1;
    return cnt;
}


Measured memory_bytes: 256
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-11
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 100031;

int n;
int ans;

int main(){
	//freopen("tree.in","r",stdin);
	//freopen("tree.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);

	cin>>n;
	for (;n;--n)
	{
		int a,b;
		cin>>a>>b;
		ans+=b-a+1;
	}
	cout<<ans<<endl;

	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a1,a2,a3;
    int c1,c2,c3;
    int max,sum;
    
    scanf("%d %d %d",&a1,&a2,&a3);
    
    c1 = abs(a1-a2);
    c2 = abs(a2-a3);
    c3 = abs(a3-a1);
  
  	max = c1;
    if(c2 > max){
    	max = c2;
    }
    if(c3 > max){
    	max = c3;
    }
  
    sum = c1 + c2 + c3 - max;
    
    printf("%d",sum);
    
	return 0;
}

Measured memory_bytes: 128
x = int(input())
j = 2
a = 0
t = 0
if x == 1:
    print("1")
    exit()
for i in range(2,32):
    j = 2
    while True:
        t = i ** j
        if t <= x:
#            print(t)
            j += 1
            a = max(a,t)
        else:
            break
print(a)


Measured memory_bytes: 2940
#include <algorithm>
#include <array>
#include <bitset>
#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 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


std::vector<std::string> a;

int H, W, v[2222][2222], h[2222][2222];

int vdfs(int x, int y, int c = 0)
{
  if (y >= H) {
    return c;
  }
  else if (a[y][x] == '#') {
    v[y][x] = 0;

    return c;
  }
  else {
    return v[y][x] = vdfs(x, y + 1, c + 1);
  }
}

int hdfs(int x, int y, int c = 0)
{
  if (x >= W) {
    return c;
  }
  else if (a[y][x] == '#') {
    h[y][x] = 0;

    return c;
  }
  else {
    return h[y][x] = hdfs(x + 1, y, c + 1);
  }
}


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);

  std::cin >> H >> W;

  a.resize(H);

  for (auto& i : a)
    std::cin >> i;

  memset(v, -1, sizeof(v));
  memset(h, -1, sizeof(h));

  for (int i = 0; i < H; i ++)
    for (int j = 0; j < W; j ++)
      if (v[i][j] < 0)
        vdfs(j, i);

  for (int i = 0; i < H; i ++)
    for (int j = 0; j < W; j ++)
      if (h[i][j] < 0)
        hdfs(j, i);

  int cp = 0;

  for (int i = 0; i < H; i ++)
    for (int j = 0; j < W; j ++) {
      int hh = h[i][j], vv = v[i][j], c = hh + vv;

      if (hh && vv)
        c --;

      if (c > cp)
        cp = c;
    }

  std::cout << cp << std::endl;

  return 0;
}


Measured memory_bytes: 44928
#include<iostream>
using namespace std;
int qql(int x,int y){
	cout<<x<<"x"<<y<<"="<<x*y<<endl;
}
int main(){
	int x,y;
	for(x = 1;x < 10;x ++){
		for(y = 1;y < 10;y ++){
			qql(x,y);
		}
	}
	return 0;
}

Measured memory_bytes: 1116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

int main()
{
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    int dp[3010][3010];

    rep(i,n+1)
    {
        rep(j,m+1)
        {
            if (s[i] == t[j]) dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1);
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j]);
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1]);
        }
    }

    string res = "";
    int i=n, j=m;
    while (i>0 && j>0)
    {
        if (dp[i][j] == dp[i-1][j])
        {
            i--;
        }

        else if (dp[i][j] == dp[i][j-1])
        {
            j--;
        }

        else
        {
            res = s[i-1] + res;
            i--;
            j--;
        }
    }
    
    cout << res << endl;
}

Measured memory_bytes: 35584
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<ctype.h>
#include<algorithm>
typedef long long int ll;
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {X;}
#define TF(f) {f;}
#define END {}
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,a) for (int i=1;i<=(a);i++)
const ll MOD = (10*10*10*10*10*10*10*10*10+7);

    string A,B,C;
    int N,M,K,X,Y,W,H;
    string ans;
    //string S;
    bool S[101][101];
    int temp[100]={0};
    bool f=true;
    bool fir=true;

int main(){
    cin>>A>>B>>C;
    ans+=A.substr(0,1);
    ans+=B.substr(0,1);
    ans+=C.substr(0,1);
    transform(ans.begin(), ans.end(), ans.begin(), ::toupper);

    cout<<ans;
}
/*A.size()!=0&&B.size()!=0&&C.size()!=0*/


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int r,g,b,x;
	scanf("%d",&r);
	scanf("%d",&g);
	scanf("%d",&b);
	x=(r*100)+(g*10)+(b);
	if(x%4==0){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}


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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= (j);i--)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

int N,K;
const int maxn = 1e5+5;

vector<LL> ts[maxn];
set<int> tt;
vector<int> selects;

struct Cmp{
    bool operator()(const int a,const int b) const{
        return ts[a][0] > ts[b][0];
    }
};

int main()
{
    scanf("%d %d",&N,&K);
    _for(i,0,N){
        LL d;
        int t;
        scanf("%d %lld",&t,&d);
        ts[t].push_back(d);
        tt.insert(t);
    }

    for(auto a:tt){
        sort(ALL(ts[a]),greater<LL>());
        selects.push_back(a);
    }

    sort(ALL(selects),Cmp());
    priority_queue<LL,vector<LL>,greater<LL>> pq;
    LL ans = 0;
    LL temp = 0;

    _for(i,0,selects.size()){
        LL genere = i+1;
        int s = selects[i];
        temp += ts[s][0];
        temp -= (genere-1)*(genere-1);
        temp += genere*genere;

        if(pq.size() > K-genere){
            LL dele = pq.top();
            // << dele << endl;
            pq.pop();
            temp -= dele;
        }

        if(i == K-1){
            //cout << temp << endl;
            ans = max(ans,temp);
            break;
        }

        _for(j,1,ts[s].size()){
            LL ne = ts[s][j];
            if(pq.size() < K-genere){
                temp += ne;
                pq.push(ne);
            }
            else{
                if(ne <= pq.top()) break;
                temp -= pq.top();
                temp += ne;
                pq.pop();
                pq.push(ne);
            }
        }

        //cout << temp << endl;

        ans = max(ans,temp);
    }

    cout << ans << endl;

    return 0;
}


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

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long LL;

template<typename T> inline
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

int dfs(int n, const vector<int> &hs) {
    if (n == hs.size() - 1) {
        return 0;
    }

    int cost1 = n + 1 < hs.size() ? abs(hs[n] - hs[n + 1]) + dfs(n + 1, hs) : int(1e5);
    int cost2 = n + 2 < hs.size() ? abs(hs[n] - hs[n + 2]) + dfs(n + 2, hs) : int(1e5);

    int ret = min(cost1, cost2);

    return ret;
}

int dfs_memo(int n, const vector<int> &hs, vector<int> &memo) {
    if (n == hs.size() - 1) {
        return 0;
    }

    if (memo[n] > -1) {
        return memo[n];
    }

    int cost1 = n + 1 < hs.size() ? abs(hs[n] - hs[n + 1]) + dfs(n + 1, hs) : int(1e5);
    int cost2 = n + 2 < hs.size() ? abs(hs[n] - hs[n + 2]) + dfs(n + 2, hs) : int(1e5);

    int ret = min(cost1, cost2);

    memo[n] = ret;

    return ret;
}

int dp(const vector<int> &hs) {
    vector<int> costs(hs.size());

    costs[0] = 0;
    costs[1] = abs(hs[0] - hs[1]);

    FOR(i, 2, hs.size()) {
        costs[i] = min(costs[i - 2] + abs(hs[i - 2] - hs[i]), costs[i - 1] + abs(hs[i - 1] - hs[i]));
    }

    return costs.back();
}

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

    int N; cin >> N;

    vector<int> h(N);
    REP(i, N) cin >> h[i];

//    cout << dfs(0, h) << endl;

//    vector<int> memo(N, -1);
//    cout << dfs_memo(0, h, memo) << endl;

    cout << dp(h) << endl;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

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


using namespace std;



int main() {
	
	
	int c[4][4];
	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 3; j++)cin >> c[i][j];

	for (int i = 0; i <= 101; i++) {
		for (int j = 0; j <= 101; j++) {
			for (int k = 0; k <= 101; k++) {
				int x[4] = {i,j,k};
				int y[4] = { c[0][0] - i,c[0][1] - i,c[0][2] - i };

				bool f = 1;
				for(int a=0;a<3;a++)
					for (int b = 0; b < 3; b++) {
					//	cout << c[a][b];
						if (c[a][b] != x[a] + y[b])f = 0;
					//	cout << x[a]+y[b]<<" "<<c[a][b]<< endl;
					}
				if (f) {
					cout << "Yes" << endl;;
					return 0;
				}
			}
		}
	}
	cout << "No" << endl;



	

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main(void){
    // Your code here!
    vector<string> YN{"NO","YES"};
    vector<string> yn{"No","Yes"};
    int a,b,c;
    cin>>a>>b;
    cout<<b*2-a<<endl;
}


Measured memory_bytes: 256
import sys
import heapq


def IN(): return sys.stdin.readline().split()


N, M = map(int, input().split())
A = list(map(lambda x: int(x) * (-1), IN()))
heapq.heapify(A)

for _ in range(M):
    tmp = -heapq.heappop(A) // 2
    heapq.heappush(A, -tmp)

print(sum(A) * (-1))


Measured memory_bytes: 14168
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();
        if(b % a == 0){
            System.out.println(a + b);
        }else{
            System.out.println(b - a);
        }
    }
}

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

public class Main {

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

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      final int n = Integer.parseInt(br.readLine());
      String op;
      String[] words;
      Tree tree = new Tree();
      int t;

      for(int i=0,k=0; i<n; i++,k=0){
        words = br.readLine().split(" ");
        op  = words[k++];

        switch( op ) {
          case "insert" :
            tree.insert(Integer.parseInt(words[k]));
            break;
          case "find" :
            t = Integer.parseInt(words[k]);
            System.out.println( tree.find(t) ? "yes" : "no" );
            break;
          default :
            tree.dispRoundPath();
        }
      }

    }
    catch(IOException e) {
      System.out.println("IOException!");
    }
  }
}

class Tree {

  static final BTreeNode NIL = new BTreeNode(-1);
  BTreeNode root;
  StringBuilder buf;
  boolean exist;

  public Tree() {
    root = NIL;
    buf = new StringBuilder();
    exist = false;
  }

  public void insert(int val) {
    BTreeNode y = NIL;
    BTreeNode x = root;
    BTreeNode z = new BTreeNode(val);

    while( !x.equals(NIL) ) {
      y = x;
      if( z.key < x.key )
        x = x.left;
      else
        x = x.right;
    }
    z.parent = y;

    if( y.equals(NIL) )
      root = z;
    else if( z.key < y.key )
      y.left = z;
    else
      y.right = z;
  }
  boolean find(int target) {
    BTreeNode x = root;

    while( !x.equals(NIL) ) {
      if( target == x.key )
        return true;
      else if( target < x.key )
        x = x.left;
      else
        x = x.right;
    }

    return false;
  }
  
  void preParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      buf.append(" ").append(u.key);
      preParse(u.left);
      preParse(u.right);
    }
  }
  void inParse(BTreeNode u) {
    if( !u.equals(NIL) ) {
      inParse(u.left);
      buf.append(" ").append(u.key);
      inParse(u.right);
    }
  }

  void dispRoundPath() {

    inParse(root);
    buf.append("\n");
    preParse(root);
    buf.append("\n");

    System.out.print(buf);
    buf.setLength(0);
  }
}

class BTreeNode {
  final int key;
  BTreeNode parent,left,right;

  public BTreeNode(final int key) {
    this.key = key;
    this.parent =
    this.left =
    this.right = Tree.NIL;
  }

  @Override
  public boolean equals(Object o) {
    if(o == this) return true;
    if(o == null) return false;
    if(!(o instanceof BTreeNode)) return false;

    BTreeNode node = (BTreeNode)o;
    if(!(this.key == node.key)) return false;

    return true;
  }
}


Measured memory_bytes: 138768
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

signed main(){
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout.precision(20);

  string n;
  cin >> n;
  if(n[n.length() - 1] == '3'){
    cout << "bon" << endl;
  }
  else if(n[n.length() - 1] == '0' || n[n.length() - 1] == '1' || n[n.length() - 1] == '6' || n[n.length() - 1] == '8'){
    cout << "pon" << endl;
  }
  else{
    cout << "hon" << endl;
  }

  return 0;
}

Measured memory_bytes: 3656
import heapq
def dijkstra(s, n, g): # s: start, n: |V|, g; glaph 
    INF = 10**18
    d = [INF] * n
    d[s] = 0
    que = [] # (a,b): a... shortest dist, b... v
    heapq.heappush(que, (0, s))

    while que:
        dist, v = heapq.heappop(que)
        if d[v] < dist: continue # if v has been already used -> continue
        for next_v, cost in g[v]:
            if d[next_v] > d[v] + cost:
                d[next_v] = d[v] + cost
                heapq.heappush(que, (d[next_v], next_v))
    return d


n,m,s,t = map(int, input().split())
gal = [ [] for _ in range(n+1) ]
gbl = [ [] for _ in range(n+1) ]

for _ in range(m):
    u,v,a,b = map(int, input().split())
    gal[u].append((v,a))
    gal[v].append((u,a))
    gbl[u].append((v,b))
    gbl[v].append((u,b))

adl = dijkstra(s,n+1,gal)
bdl = dijkstra(t,n+1,gbl)
ansl = [0]*n
curr_min = 10**18

# print(adl)
for i in range(n-1,-1,-1):
    cost = adl[i+1] + bdl[i+1]
    curr_min = min(cost, curr_min)
    ansl[i] = 10**15-curr_min
    # print('--',i)
    # print(cost)

for ans in ansl:
    print(ans)


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

int main() {
  string s,t;
  cin >> s >> t;
  int n = stoi ( s+t );
  for (int i=1 ; i< 1000 ; i++){
    if ( i*i==n){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3632
N, L = list(map(int, input().split()))

A = [L + i for i in range(N)]
j = 10 ** 10
t = sum(A)
ans = 0
for i in range(N):
  k = abs(t - (t - A[i]))
  if k <= j:
    j = k
    ans = t - A[i]

print(ans)

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

int main(){
  int n;cin>>n;
  char s[n];cin>>s;
  int  c_ans=0,ans=0;

  for(int i=0;i<n;++i){
    if(s[i]=='I'){
      ++c_ans;
    }else{
      --c_ans;
    }
    ans=max(c_ans,ans);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
s = list(map(str, input()))
ans = [0] * len(s)
strk = ["R"]
for i in range(1,len(s)):

    if strk[-1] == s[i]:
        strk.append(s[i])

        if i == len(s)-1:
            if len(strk) % 2 == 0:
                ans[ind-1] = len(strk) // 2
                ans[ind] = len(strk) // 2

            else:
                if R_strk % 2 == 0:
                    ans[ind-1] = len(strk) // 2
                    ans[ind] = (len(strk) // 2) + 1
                else:
                    ans[ind-1] = (len(strk) // 2) + 1
                    ans[ind] = len(strk) // 2
                    
    elif strk[-1] == "R" and s[i] == "L":
        R_strk = len(strk)
        ind = i
        strk.append(s[i])

        if i == len(s)-1:
            if len(strk) % 2 == 0:
                ans[ind-1] = len(strk) // 2
                ans[ind] = len(strk) // 2

            else:
                if R_strk % 2 == 0:
                    ans[ind-1] = len(strk) // 2
                    ans[ind] = (len(strk) // 2) + 1
                else:
                    ans[ind-1] = (len(strk) // 2) + 1
                    ans[ind] = len(strk) // 2


    else:
        if len(strk) % 2 == 0:
            ans[ind-1] = len(strk) // 2
            ans[ind] = len(strk) // 2

        else:
            if R_strk % 2 == 0:
                ans[ind-1] = len(strk) // 2
                ans[ind] = (len(strk) // 2) + 1
            else:
                ans[ind-1] = (len(strk) // 2) + 1
                ans[ind] = len(strk) // 2


        strk.clear()
        strk.append(s[i])
        ind = 0

for a in ans:
    print(a, end=" ")

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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n; --i)
#define INF (int)1e9
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define all(arr) arr.begin(),arr.end()

void boost(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

ll dp[1002][1002];
string s[1002];

void solve(){
	int h,w;
	cin>>h>>w;
	fr(i,0,h)
	cin>>s[i];
	dp[0][0]=1;
	fr(i,0,h){
		fr(j,0,w){
			if(s[i][j]=='.'){
				if(i<h-1 && s[i+1][j]=='.')
					dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD;
				if(j<w-1 && s[i][j+1]=='.')
					dp[i][j+1]=(dp[i][j+1]+dp[i][j])%MOD;
			}
		}
	}
	cout<<dp[h-1][w-1]<<endl;
	return;
}

int main()
{
	boost();
	
	int tc=1;
	//cin>>tc;
	while(tc--)
		solve();
	return 0;
}

Measured memory_bytes: 12548
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N, K, ans;
std::vector<int> a;

int main()
{
	in>>N>>K;
	a.resize(N);
	rep(i,N)
	{	in>>a[i];}

	rep(i,N)
	{
		ans+=std::min(a[i],K-a[i])*2;
	}
	out<<ans<<std::endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.*;

class Main
{
   public static void main(String[] args) throws IOException
   {

      BufferedReader br =
       new BufferedReader(new InputStreamReader(System.in));

      String str1 = br.readLine();
      String str2[] = str1.split(" ");
      int a = Integer.parseInt(str2[0]);
      int b = Integer.parseInt(str2[1]);
      int c = a*b;
      int d = 2*(a+b);
      System.out.println( c + " " + d );

   }
}



Measured memory_bytes: 24240
pub fn main() {
    use std::io::Read;
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let n: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();
    let a: Vec<usize> = iter.take(m).map(|x| x.parse().unwrap()).collect();

    // 添え字=数, 値=マッチの数
    let match_nums: [usize;10] = [0,2,5,5,4,5,6,3,7,6];

    // dp[i] := ちょうどi本で作れる整数の最大
    // dp[i+k] = dp[i] + 10 * max_digit_from_match(k)

    let mut dp = vec!["none".to_string();n+1];
    dp[0] = "".to_string();
    for i in 0..n+1 {
        for j in 0..m {
            let num_char = a[j];
            let match_num = match_nums[num_char];
            if i+match_num <= n && dp[i] != "none" {
                dp[i+match_num] = sdigit_max(
                    (&dp[i+match_num]).to_string(),
                    format!("{}{}", num_char.to_string(), (&dp[i]).to_string())
                );
            }
        }
    }

    println!("{}", dp[n]);
}

fn sdigit_max(a: String, b: String) -> String {
    if a == "none" {
        b
    } else if b == "none" {
        a
    } else if a.len() == b.len() {
        std::cmp::max(a, b)
    } else {
        if a.len() > b.len() {a} else {b}
    }
}

Measured memory_bytes: 30972
def judge_three_number_is_ordered(a:int, b:int, c:int) -> None:
    if a < 0:
        raise ValueError('Parameter a is less than 0.')
    if a > 100:
        raise ValueError('Parameter a is lareger than 100.')
    if b < 0:
        raise ValueError('Parameter b is less than 0.')
    if b > 100:
        raise ValueError('Parameter b is lareger than 100.')
    if c < 0:
        raise ValueError('Parameter c is less than 0.')
    if c > 100:
        raise ValueError('Parameter c is lareger than 100.')

    if a < b and b < c:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    in_str = input()
    in_str = in_str.split()
    a = int(in_str[0])
    b = int(in_str[1])
    c = int(in_str[2])
    judge_three_number_is_ordered(a, b, c)



Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    if(S == "SUN")
    cout << 7 << endl;
    else if (S == "MON")
    {
        cout << 6 << endl;
            }
    else if (S == "TUE")
    {
        cout << 5 << endl;
    }
    else if(S == "WED")
    {
        cout << 4 << endl;
    }
    else if (S == "THU")
    {
        cout << 3 << endl;
    }
    else if (S == "FRI")
    {
        cout << 2 << endl;
    }
    else 
    cout << 1 << endl;
    
    
}

Measured memory_bytes: 256
n = int(input())
a_ls = list(map(int, input().split()))
b_ls = list(map(int, input().split()))
c_ls = list(map(int, input().split()))
for ls in [a_ls,b_ls,c_ls]:
    ls.sort()

def is_not_less_than(ls, ind, key):
    if ls[ind] >= key:
        return True
    else:
        return False

def return_min_ind_whose_value_not_less_than(ls,key):
    r = len(ls)
    l = -1
    while True:
        next_ind = (r+l) // 2
        if is_not_less_than(ls, next_ind, key):
            r = next_ind
        else:
            l = next_ind
        if r - l == 1:
            return r

def is_more_than(ls, ind, key):
    if ls[ind] > key:
        return True
    else:
        return False

def return_min_ind_whose_value_more_than(ls,key):
    r = len(ls)
    l = -1
    while True:
        next_ind = (r+l) // 2
        if is_more_than(ls, next_ind, key):
            r = next_ind
        else:
            l = next_ind
        if r - l == 1:
            return r

ans = 0
for i in range(n):
    b_c = n - return_min_ind_whose_value_more_than(c_ls, b_ls[i])
    a_b = return_min_ind_whose_value_not_less_than(a_ls, b_ls[i])
    ans += b_c*a_b
print(ans)


Measured memory_bytes: 105600
#include <stdio.h>

int main(void)
{
	int num[100]={0};
	int i,max=0;

	while(scanf("%d",&i)!=EOF)
		num[i-1]++;
	for(i=0; i<100; i++)
		if(num[i]>=max)
			max=num[i];
	for(i=0; i<100; i++)
		if(num[i]==max)
			printf("%d\n",i+1);

	return 0;
}

Measured memory_bytes: 596
import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] input = new int[5];
		int[] roundUp = new int[5];
		int max = 0, index = 0, ans = 0;
 
		for(int i = 0; i < 5; i++){
			input[i] = sc.nextInt();
			roundUp[i] = (input[i] + 9) / 10 * 10;
			if(max < roundUp[i] - input[i]){
				max = roundUp[i] - input[i];
				index = i;
			}
		}
		for(int i = 0; i < 5; i++){
			ans += roundUp[i];
		}
		ans -= max;
		System.out.println(ans);
	}
}


Measured memory_bytes: 21716
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	static HashMap<Integer,HashMap<Integer,Integer>>gr;
	public static long solve(int i,long []dp,HashMap<Integer,HashMap<Integer,Integer>>gr)
	{
		
		if(dp[i]!=-1)
		return dp[i];
		long ret=0;
		if(gr.containsKey(i))
		{
		for(int y:gr.get(i).keySet())
		{
		//	System.out.println(i+" "+y);
			ret=Math.max(ret,solve(y,dp,gr)+1);
		}
		}
	//	System.out.println(ret+" i hai"+i);
		
		dp[i]=ret;
		return ret;
	}
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int m=scn.nextInt();
		gr=new HashMap<>();
		while(m-->0)
		{
			int a,b;
			a=scn.nextInt();
			b=scn.nextInt();
			if(gr.containsKey(a))
			{
				gr.get(a).put(b,1);
			}
			else
			{
				HashMap<Integer,Integer>map=new HashMap<>();
				map.put(b,1);
				gr.put(a,map);
			}
		}
		//System.out.println(gr);
		// StringBuilder sb=new StringBuilder();
		// for(int x:gr.keySet())
		// {
		// 	sb.append(x+"->");
		// 	for(int y:gr.get(x).keySet())
		// 	{
		// 		sb.append(y+",");
		// 	}
		// 	sb.append("\n");
		// }
		// System.out.println(sb);
		long an=-1;
		long []dp=new long[100005];
		for(int i=0;i<=n;i++)
		{
			dp[i]=-1;
		}
		for(int x:gr.keySet())
		{
			an=Math.max(an,solve(x,dp,gr));
		}
		System.out.println(an);
	}
}

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

 using namespace std;
 typedef long long ll;

 int main() {
   ll N;
   int A, B, ans = 0;
   cin >> N;

   for (int i = sqrt(N); i > 0; i--) {
     if (N % i == 0) {
       A = i;
       B = N / i;
       break;
     }
   }

   while (B > 0) {
     ans++;
     B /= 10;
   }

   cout << ans << endl;

 }


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  int n;
  cin>>n;
  double p[n+1];
  p[0] = 0;
  rep(i,n) cin>>p[i+1];
  double dp[n+1][n+1];
  dp[1][0] = 1 - p[1];
  dp[1][1] = p[1];
  for(int i = 2; i <= n; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0) {
        dp[i][j] = dp[i-1][j] * (1 - p[i]);
      } else if(j == i) {
        dp[i][j] = dp[i-1][j-1] * p[i];
      } else {
        dp[i][j] = dp[i-1][j] * (1 - p[i]) + dp[i-1][j-1] * p[i];
      }
    }
  }
  double ans = 0.0;
  for(int i = n / 2 + 1; i <= n; i++) {
    ans += dp[n][i];
  }
  printf("%.12f\n", ans);

  return 0;
}


Measured memory_bytes: 70400
#include<bits/stdc++.h>
using namespace std;
int temp1,temp2;
int main()
{
	char a[10011];
	cin>>a;
	for(int i=0;i<=strlen(a);i++)
	{
	if(a[i]=='C')
	temp1=1;
	if(temp1==1&&a[i]=='F')
	temp2=1;
	}
	if(temp1==1&&temp2==1)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
	
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>

int main(void)
{
	int ch;

	while ((ch = getchar()) != EOF) {
		if (isupper(ch)) {
			ch = tolower(ch);
		}
		else {
			ch = toupper(ch);
		}
		putchar(ch);
		if (ch == '\n') {
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 524
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] q = Console.ReadLine().Split();
            string an;
            int a = int.Parse(q[0]); int b = int.Parse(q[1]);
            if (a < 9 && b < 9) { an = "Yay!"; }
            else { an = ":("; }
            Console.Write(an);
        }
    }
}

Measured memory_bytes: 11092
#include <stdio.h>
#include <stdlib.h>

struct _Node{
  int key;
  struct _Node *next;
  struct _Node *prev;
};
typedef struct _Node Node;

Node *nil;

void insert(int key) {
  Node *n;
  n = (Node *)malloc(sizeof(Node));
  n->key = key;
  n->next = nil->next;
  nil->next = nil->next->prev = n;
  n->prev = nil;
}

void deleteNode(Node *n) {
  n->prev->next = n->next;
  n->next->prev = n->prev;
}

void delete(int key) {
  Node *n;
  for (n = nil->next; n != nil; n = n->next) {
    if (n->key == key) {
      deleteNode(n);
      return;
    }
  }
}

void deleteFirst() {
  deleteNode(nil->next);
}

void deleteLast() {
  deleteNode(nil->prev);
}

int main() {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
  int i, key, N;
  char *command;
  command = (char *)malloc(sizeof(char) * 12);

  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf(" %s", command);
    switch(*command) {
    case 'i':
      scanf(" %d", &key);
      insert(key);
      break;
    default :
      switch(*(command + 6)) {
      case 'F':
        deleteFirst();
        break;
      case 'L':
        deleteLast();
        break;
      default:
        scanf(" %d", &key);
        delete(key);
        break;
      }
    }
  }

  Node *node;
  for (node = nil->next;; node = node->next) {
    if (node->next == nil) {
      printf("%d\n", node->key);
      break;
    }
    printf("%d ", node->key);
  }
  return 0;
}



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

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

    set<ll> x;
    for (int i = 0; i < n; ++i) {
        ll a;
        cin >> a;
        if (x.find(a) == x.end()) {
            x.insert(a);
        } else {
            x.erase(a);
        }
    }
    cout << x.size() << endl;

    return 0;
}


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

int main() {
    int N; cin >> N;
    vector<int> d(N, 0);
    for (int i = 0; i < N; i++) {
        cin >> d.at(i);
    }
    sort(d.begin(), d.end());
    int answer = d.at(d.size()/2) - d.at(d.size()/2-1);
    cout << answer << endl;
    return 0;
}

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

using namespace std;

struct Team{
	int id,blg,ac,pen;
	bool operator<(const Team &t)const{
		if(this->ac>t.ac)	return true;
		if(this->ac==t.ac){
			if(this->pen<t.pen)	return true;
			if(this->pen==t.pen){
				return (this->id<t.id);
			}
		}
		return false;
	}
};

int main(){
	for(int n;scanf("%d",&n),n;){
		Team tm[300];
		for(int i=0;i<n;i++)	scanf("%d%d%d%d",&tm[i].id,&tm[i].blg,&tm[i].ac,&tm[i].pen);

		sort(tm,tm+n);

		int selected=0,cnt[1001]={};
		for(int i=0;i<n;i++){
			if(selected<10){
				if(cnt[tm[i].blg]<3){
					selected++;
					printf("%d\n",tm[i].id);
					cnt[tm[i].blg]++;
				}
			}
			else if(selected<20){
				if(cnt[tm[i].blg]<2){
					selected++;
					printf("%d\n",tm[i].id);
					cnt[tm[i].blg]++;
				}
			}
			else if(selected<26){
				if(cnt[tm[i].blg]<1){
					selected++;
					printf("%d\n",tm[i].id);
					cnt[tm[i].blg]++;
				}
			}
		}
	}

	return 0;
}

Measured memory_bytes: 0
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;

int main(int argc, char* argv[]) {
	while (true) {
		LL n = -1, ans = 0;
		cin >> n;
		if (n <= 0) break;
		vector<LL> l(n);
		for (int i = 0; i < n; ++i) {
			cin >> l[i];
		}
		sort(l.begin(), l.end());
		l.push_back(1LL << 60);
		for (LL a = 0; a < n; ++a) {
			LL b = a + 1, c = n - 1;
			while (c > b&& l[c] >= l[a] + l[b]) {
				--c;
			}
			for (; b < n; ++b) {
				while (l[c + 1] < l[a] + l[b]) {
					++c;
				}
				ans += c - b;
			}
		}
		cout << ans << endl;
	}
	return 0;
}


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

int main()
{
    int a, b;
    cin >> a >> b;
    
    if(a > b) cout << "a > b" << endl;
    else if (a < b) cout << "a < b" << endl;
    else cout << "a == b" << endl;
    
    return 0;
}


Measured memory_bytes: 3108
import java.io.*;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	
		MyScanner sc = new MyScanner();
		int n=sc.nextInt();
		int h[]=new int[n];
		for(int i=0;i<n;i++) {
			h[i]=sc.nextInt();
		}
		int cost[]=new int[n];
		cost[0]=0;
		cost[1]=Math.abs(h[1]-h[0]);
		if(n>2) {
			for(int j=2;j<n;j++) {
				cost[j]=Math.min(Math.abs(h[j]-h[j-2])+cost[j-2],Math.abs(h[j]-h[j-1])+cost[j-1]);
			}
		}
		
		System.out.println(cost[n-1]);
	}
	
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	

}





Measured memory_bytes: 33124
#include<stdio.h>
#include<iostream>
#include<cmath>
using namespace std;
static const double r = 6378.1;
static const double PI = acos(-1);

class Point{
    public:
    double x, y, z;
    Point(){}
    Point ( double theta, double phi ){
        theta = 90 - theta;
        theta *= (PI/180); // to degree
        phi *= (PI/180);
        x = r*sin(theta)*cos(phi);
        y = r*sin(theta)*sin(phi);
        z = r*cos(theta);
    }
};

double getDistance( Point p1, Point p2 ){
    return  (p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)+(p1.z-p2.z)*(p1.z-p2.z);
}

int main(){
    double lat1, lat2, lon1, lon2;
    Point p1, p2;
    double theta, phi;
    while( cin >> lat1 >> lon1 >> lat2 >> lon2 ){
        if ( lat1 == -1 && lon1 == -1 && lat2 == -1 && lon2 == -1 ) break;

        p1 =  Point( lat1, lon1 );
        p2 =  Point( lat2, lon2 );

        double dist = getDistance( p1, p2 );
        
        printf("%.0lf\n", r*acos( 1 - dist/(2*r*r)));
    }

    return 0;
}

Measured memory_bytes: 0
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin>>n;
  
  vector<pair<int,int>> p[16];
  int a,x,y;
  rep(i,n){
    cin>>a;
    rep(j,a){
      cin>>x>>y;
      p[i].push_back({x,y});
    }
  }
  
  int ma=0;
  for(int i=0;i<(1<<n);i++){
    bool b = true;
    int cnt=0;
    for(int j=0;j<n;j++){
      if((i>>j)&1==1){
        cnt++;
        for(auto u:p[j]){
          if(u.second==1 && ((1<<(u.first-1))&i)==0) b=false;
          if(u.second==0 && ((1<<(u.first-1))&i)>0) b=false;
        }
      }
    }
    if(b){
      if(cnt>ma) ma=cnt;
    }
  }
  
  cout<<ma<<endl;
    
  return 0;
}

Measured memory_bytes: 256