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

int main() {
  int n;
  while(cin >> n && n) {
    int a[n];
    for(int i=0; i<n; i++) cin >> a[i];
    int dp[n][n];
    memset(dp,0,sizeof(dp));
    for(int i=0; i<n-1; i++) {
      if(abs(a[i]-a[i+1])<=1) dp[i][i+1]=1;
    }
    for(int i=0; i<n-1; i+=2) {
      for(int l=0; l<n; l++) {
        int r=l+i+1;
        if(r>=n) break;
        if(dp[l+1][r-1]&&abs(a[l]-a[r])<=1) dp[l][r]=1;
      }
      for(int l=0; l<n; l++) {
        for(int r=l+1; r<n; r++) {
          if(dp[l][r]) {
            int x=l-i-2;
            if(x>=0) {
              if(dp[x][l-1]) dp[x][r]=1;
            }
            x=r+i+2;
            if(x<n) {
              if(dp[r+1][x]) dp[l][x]=1;
            }
          }
        }
      }
    }
    int d[n+1];
    memset(d,-1,sizeof(d));
    d[0]=0;
    int ans=0;
    for(int i=0; i<n; i++) {
      d[i+1]=max(d[i+1],d[i]);
      if(d[i]==-1) continue;
      for(int j=i+1; j<n; j++) {
        if(dp[i][j]) d[j+1]=max(d[j+1],d[i]+j-i+1);
      }
    }
    for(int i=0; i<=n; i++) ans=max(ans,d[i]);
    cout << ans << endl;
  }
  return 0;
}


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

using ll = long long;
ll n, ans;

void dfs(ll x,int a,int b,int c) {
	if (x > n)return;
	if (a&&b&&c)ans++;
	dfs(x * 10 + 3, 1, b, c);
	dfs(x * 10 + 5, a, 1, c);
	dfs(x * 10 + 7, a, b, 1);
}

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

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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s, t; cin >> s >> t;
	int m = t.length();
	for (int i = 0; i <= s.length() - t.length(); ++i){
		string s2 = s.substr(i, t.length());
//`:`		cout << s2 << "\n";
		int number = 0;
		for (int j = 0; j < t.length(); ++j){
			if (t[j] != s2[j]) ++number;
		}
		m = min(number, m);
	}
	cout << m << "\n";
	
	return 0;
}


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

using namespace std;

typedef long long ll;

int main() {
	int N; cin >> N;
	vector<ll> v(N);
	for (int i = 0; i < N; ++i) {
		cin >> v[i];
	}
	sort( v.begin(), v.end() );

	ll ans = 0;

	// 012345
	// oooxox
	// ooooxx
	for (int t = N-6; t >= 0; --t) {
		vector<ll> a(6);
		for (int i = 0; i < 6; ++i) {
			a[i] = v[t+i];
		}

		ll sum = 0;
		for (int i = 0; i < 6; ++i) {
			sum += a[i];
		}

		if ((a[0] + a[1] > a[3] && a[2] + a[4] > a[5])
			|| (a[0] + a[2] > a[3] && a[1] + a[4] > a[5])
			|| (a[1] + a[2] > a[3] && a[0] + a[4] > a[5])
			|| (a[0] + a[1] > a[4] && a[2] + a[3] > a[5])
			|| (a[0] + a[2] > a[4] && a[1] + a[3] > a[5])
			|| (a[0] + a[3] > a[4] && a[1] + a[2] > a[5])
			|| (a[0] + a[1] > a[5] && a[2] + a[3] > a[4])
			|| (a[0] + a[2] > a[5] && a[1] + a[3] > a[4])
			|| (a[0] + a[3] > a[5] && a[1] + a[2] > a[4])) {
			if (sum > ans) ans = sum;
		}
	}
	{
		ll s = 0;

		int pos = -1;
		for (int i = N-3; i >= 0; --i) {
			if (v[i] + v[i+1] > v[i+2]) {
				s = v[i] + v[i+1] + v[i+2];
				pos = i;
				break;
			}
		}
		if (pos > -1) {
			for (int i = pos-3; i >= 0; --i) {
				if (v[i] + v[i+1] > v[i+2]) {
					ll s2 = s + v[i] + v[i+1] + v[i+2];
					if (s2 > ans) ans = s2;
				}
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1796
import java.io.*;
import java.util.*;

class Main {

	private static final int M = 1000000007;

	private static Combination c;

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int r1 = sc.nextInt();
		int c1 = sc.nextInt();
		int r2 = sc.nextInt();
		int c2 = sc.nextInt();

		c = new Combination(r2 + c2 + 10, M);
		long answer = f(r2 + 1, c2 + 1);
		answer = (((answer - f(r2 + 1, c1)) % M) + M) % M;
		answer = (((answer - f(r1, c2 + 1)) % M) + M) % M;
		answer = (answer + f(r1, c1)) % M;
		System.out.println(answer);
	}

	private static long f(int a, int b) {
		return c.choose(a + b, a);
	}

	private static class Combination {
		private final int M;
		private long[] fact;
		private long[] ifact;
		private long[] inv;

		public Combination(int n, int M) {
			this.M = M;
			fact = new long[n + 1];
			ifact = new long[n + 1];
			inv = new long[n + 1];

			fact[0] = fact[1] = 1;
			ifact[0] = ifact[1] = 1;
			inv[1] = 1;

			for (int i = 2; i <= n; i++) {
				fact[i] = fact[i - 1] * i % M;
				// p = (p / a * a) + (p % a)
				// 0 ≡ (p / a * a) + (p % a)          (mod p)
				// a^(-1) ≡ - (p % a)^(-1) * (p / a)  (mod p)
				inv[i] = M - inv[M % i] * (M / i) % M;
				ifact[i] = ifact[i - 1] * inv[i] % M;
			}
		}

		public long choose(int n, int k) {
			if (n < k) return 0;
			if (n < 0 || k < 0) return 0;
			return fact[n] * (ifact[k] * ifact[n - k] % M) % M;
		}
	}

}


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

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

  if (N <= K) {
    cout << 0 << endl;
  }
  else {

    vector<int> vec(N);
    
    for (int i = 0;i < N;i++) {
      cin >> vec.at(i);
    }
    
    sort(vec.begin(), vec.end()); // {1, 2, 2, 5}

    long long sum = 0;
    
    for (int i = 0; i < N - K; i++) {

      sum += vec.at(i);
    }
    
    cout << sum << endl;
  }
}

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

template <class T>
struct BIT{
    int size;
    vector<T> data;
    function<T(T, T)> f = [](T a, T b){ return a+b; };
    BIT(){}
    BIT(int n){ init(n); }
    void init(int n){
        size = n;
        data.assign(size+1, 0);
    }

    T sum(int x){
        T res = 0;
        while(x > 0){
            res = f(res, data[x]);
            x -= (x & -x);
        }
        return res;
    }

    T sum(int lft, int rit){
        if(lft == 0) return sum(rit);
        return sum(rit) - sum(lft-1);
    }

    void add(int x, T y){
        if(x <= 0) x = 1;
        while(x <= size){
            data[x] = f(data[x], y);
            x += (x & -x);
        }
    }
};

BIT<int> bit;

int main(void){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    vector< vector<int> > ax(2, vector<int>(n+1, -1)), bx(2, vector<int>(n+1, -1));
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<n;i++) cin >> b[i];

    for(int i=0;i<n;i++){
        int j = i;
        while(j+1 < n && a[j+1] == a[i]) j++;
        ax[0][a[i]] = i;
        ax[1][a[i]] = j;
        i = j;
    }
    for(int i=0;i<n;i++){
        int j = i;
        while(j+1 < n && b[j+1] == b[i]) j++;
        bx[0][b[i]] = i;
        bx[1][b[i]] = j;
        i = j;
    }

    bit.init(n*3);

    for(int i=0;i<n;i++){
        if(i > 0 && b[i] == b[i-1]) continue;
        int y = b[i];
        if(ax[0][y] == -1) continue;
        int a0 = ax[0][y];
        int a1 = ax[1][y];
        int b0 = bx[0][y];
        int b1 = bx[1][y];
        bit.add(a0-b1, 1);
        bit.add(a1-b0+1, -1);

        bit.add(a0-b1+n, 1);
        bit.add(a1-b0+1+n, -1);
    }

    for(int i=1;i<=n;i++){
        bool flg = true;
        for(int j=i;j<n*3;j+=n){
            if(bit.sum(j) != 0) flg = false;
        }
        if(!flg) continue;
        puts("Yes");
        for(int j=0;j<n;j++) cout << b[(n-i+j)%n] << " "; cout << endl;
        return 0;
    }
    puts("No");

}


Measured memory_bytes: 10604
#include<bits/stdc++.h>
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define P pair<int,int>
using namespace std;
const int INF=1e17+5;
const int maxn=2e5+5;
int n,m,a[maxn],b[maxn],ans,sum;
struct node{
    int first,second;
};
multiset<node>T;
bool operator<(const node&a,const node&b)
{
    return a.second<b.second;
}
int32_t main()
{
    IOS;
    cin>>n;
    fu(i,1,n)
    {
        int x,y;
        cin>>x>>y;
        T.insert({x,y});
    }
    int t=0;
    for(auto i:T)
    {
        t+=i.first;
        if(t>i.second){
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 12800
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int main(void){
  int num,keta[5];
  int i,j,count=0;
  while(scanf("%d",&num)!=EOF){
    if(count) putchar('\n');
    for(i=0;i<5;i++){
      keta[4-i]=num%10;
      num/=10;
    }
    /*for(i=0;i<5;i++){
      printf("%d",keta[i]);
      }
      putchar('\n');*/
    for(i=0;i<8;i++){
      for(j=0;j<5;j++){
	switch(i){
	case 0:
	  putchar((keta[j]/5)?' ':'*');
	  break;  
	case 1:
	  putchar((keta[j]/5)?'*':' ');
	  break;
	case 2:
	  putchar('=');
	  break;
	case 3:
	  putchar((keta[j]%5)?'*':' ');
	  break;
	case 4:
	  putchar((keta[j]%5-1)?'*':' ');
	  break;
	case 5:
	  putchar((keta[j]%5-2)?'*':' ');
	  break;
	case 6:
	  putchar((keta[j]%5-3)?'*':' ');
	  break;
	case 7:
	  putchar((keta[j]%5-4)?'*':' ');
	  break;
	case 8:
	  putchar((keta[j]%5-5)?'*':' ');
	  break;
	}
      }
      putchar('\n');
      count++;
    }
  }
  return 0;
}

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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

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

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); }

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    ios::sync_with_stdio(false);//stdoutとcoutの同期解除
    cin.tie(nullptr);//cinとcoutの同期解除
    
    string S;
    cin >>S;

    
    //-----------------------------------
    string ans;
    if(S=="Sunny")ans="Cloudy";
    else if(S=="Cloudy")ans="Rainy";
    else ans="Sunny";

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  #define int long long
  string S;
  cin>>S;
  int count=0;
  for(int i=0;i<3;i++){
    if(S.at(i)=='R'){
      count++;
    }
  }
  if(count==2){
    if(S.at(0)=='R' && S.at(2)=='R'){
      count=1;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>    
#define inf 100000000
#define INF 9223372036854775807
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
long long mod=(long long)1e09+7;

int in(void){
    int i;scanf("%d",&i);
    return i;
}
long long llin(void){
    long long i;scanf("%lld",&i);
    return i;
}
double din(void){
    double i;scanf("%lf",&i);
    return i;
}
void chin(char s[]){
    scanf("%s",s);
}
void print(int a){
    printf("%d\n",a);
}
void llprint(long long a){
    printf("%lld\n",a);
}
void dprint(double a){
    printf("%.10f\n",a);
}
void print2(int a,int b){
    printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
    return a>b?a:b;
}
long long min(long long a,long long b){
    return a<b?a:b;
}
int cmp(const void *a,const void *b){
    return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
    return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
    return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
    return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
    int t=*a;
    *a=*b;
    *b=t;
}
long long gcd(long long x,long long y){
    return x%y?gcd(y,x%y):y;
}
long long lcm(long long x,long long y){
    return x/gcd(x,y)*y;
}

// write codes below this
// when you use 'sort',
// make sure TYPE macro is correct

int main(void){
    int n,m,a[1000],i,j,ans;
    while(1){
        n=in();
        m=in();
        if(!n)break;
        rep(i,n)a[i]=in();
        ans=0;
        rep(i,n-1){
            for(j=i+1;j<n;j++){
                if(a[i]+a[j]<=m&&ans<a[i]+a[j])ans=a[i]+a[j];
            }
        }
        if(ans)print(ans);
        else puts("NONE");
    }
    return 0;
}



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

#define int long long

#define F first
#define S second
#define all(x) (x).begin(), (x).end()

using namespace std;

vector<vector<int>> g(200005);
int u[200005];

void dfs(int v, int& cnt) {
    u[v] = 1, cnt++;
    for(int to : g[v])
        if(!u[to])
            dfs(to, cnt);
}

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

//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);

    int n, m, ans = 0;
    cin >> n >> m;

    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    for(int i = 1; i <= n; i++) {
        if(!u[i]) {
            int cnt = 0;
            dfs(i, cnt);
            ans = max(ans, cnt);
        }
    }

    cout << ans;

    return 0;
}


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

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

vector<pair<ii,int> > edges;
int n;

void add(int u, int v, int c)
{
	edges.pb(mp(mp(u+1,v+1),c)); n=max(n,u+1); n=max(n,v+1);
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int L; cin>>L;
	vi dig;
	while(L)
	{
		dig.pb(L&1); L>>=1;
	}
	reverse(dig.begin(),dig.end());
	L=1;
	for(int i=1;i<dig.size();i++)
	{
		add(i-1,i,L); add(i-1,i,0);
		L*=2;
		if(dig[i]) {add(0,i,L); L++;}
	}
	cout<<n<<' '<<edges.size()<<'\n';
	for(auto X:edges)
	{
		cout<<X.fi.fi<<' '<<X.fi.se<<' '<<X.se<<'\n';
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include <string>
#include <sstream>
#include <iomanip>
#include <functional>
 
using namespace std;
 
 
#define sort(arr) sort(begin(arr), end(arr))

int main() {

    int n, m;

    cin >> n >> m;
    vector<long long> a(n);
    vector<long long> b(m);
    for(int i=0; i<n; i++)
        cin >> a[i];
    for(int j=0; j<m; j++)
        cin >> b[j];

    sort(a);
    sort(b);

    long long ret = 0;
    int i=0, j=0;
    while(i<a.size() || j<b.size()){
        if(i==a.size() || (j<b.size() && a[i] > b[j])){
            swap(a, b);
            swap(i, j);
        }
        //cout << i << ' ' << j << endl; 
        ret += a[i++]*(b.size()-j+1);
    }
    cout << ret << endl;
    return 0;
}

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

struct Node {
    int location;
    int p, l, r;
    Node() {}
};

struct Point {
    int id, x, y;
    Point() {}
    Point (int id, int x, int y) :id(id), x(x), y(y)  {}
    bool operator<(const Point& p) const {
        return id < p.id;
    }

    void print() {
        printf("%d\n", id);
    }
};

static const int MAX = 1000000;
static const int NIL = -1;

int N;
Point P[MAX];
Node T[MAX];
int np;

bool lessX(const Point &p1, const Point &p2) {
    return p1.x < p2.x;
}

bool lessY(const Point &p1, const Point &p2) {
    return p1.y < p2.y;
}

int makekDTree(int l, int r, int depth) {
    if (!(l<r)) return NIL;
    int mid = (l + r) / 2;
    int t = np++;
    if (depth%2 == 0) {
        sort(P + l, P + r, lessX);
    }
    else {
        sort(P + l, P + r, lessY);
    }
    T[t].location = mid;
    T[t].l = makekDTree(l, mid, depth + 1);
    T[t].r = makekDTree(mid+1, r, depth + 1);

    return t;
}

void find(int v, int sx, int tx, int sy, int ty, int depth, vector<Point> & ans) {
    int x = P[T[v].location].x;
    int y = P[T[v].location].y;

    if (sx <= x and x <= tx and sy <= y and y <= ty) {
        ans.push_back(P[T[v].location]);
    }

    if (depth%2 == 0) {
        if (T[v].l != NIL) {
            if (sx <= x) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if (T[v].r != NIL) {
            if (x <= tx) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    }
    else {
        if (T[v].l != NIL) {
            if (sy <= y) find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
        }
        if (T[v].r != NIL) {
            if (y <= ty) find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
        }
    }
}

int main() {
    int x, y;
    scanf("%d", &N);
    rep(i, N) {
        scanf("%d %d", &x, &y);
        P[i] = Point(i, x, y);
        T[i].l = T[i].r = T[i].p = NIL;
    }

    np = 0;

    int root = makekDTree(0, N, 0);

    int q;
    scanf("%d", &q);
    int sx, tx, sy, ty;
    vector<Point> ans;
    rep(i, q) {
        scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
        ans.clear();
        find(root, sx, tx, sy, ty, 0, ans);
        sort(ans.begin(), ans.end());
        rep(j, ans.size()) {
            ans[j].print();
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 16440
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long int
#define MAXN 1000

using namespace std;

typedef vector<int,int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

void solve(){
    ll a , b, k;
    cin >> a >> b >> k;
    if( a > k ){
        a = a-k;
        k = 0;
    }else{
        k = k-a;
        a = 0;
    }

    if(b > k){
        b = b-k;
        k = 0;
    }else{
        k = k-b;
        b = 0;
    }
    cout << a << " " <<  b << endl;
}

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

    solve();
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
h = [int(x) for x in input().split()]
l = [1] * n
for i in range(m):
	a, b = map(int, input().split())
	if h[a-1] >= h[b-1]:
		l[b-1] = 0
	if h[b-1] >= h[a-1]:
		l[a-1] = 0
print(sum(l))

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

class D
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());

		var d = new int[n + 1].Select(_ => new List<string>()).ToArray();
		d[0].Add("");

		for (int i = 1; i <= n; i++)
			foreach (var s in d[i - 1])
				foreach (var c in "abcdefghij")
				{
					var end = !s.Contains(c);
					d[i].Add(s + c);
					if (end) break;
				}
		Console.WriteLine(string.Join("\n", d[n]));
	}
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    double a, b;
    cin >> a >> b;
    printf("%.7f", a * b / 3.305785);
    return 0;
}


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

int main(void)
{
	char ch;
	
	while(1) {
		scanf("%c", &ch);
		if(islower(ch)) printf("%c", toupper(ch));
		else if(isupper(ch)) printf("%c", tolower(ch));
		else printf("%c", ch);
		
		if(ch=='\n') break;
	}
	
	return 0;
}


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

int main() {
  int N; cin >> N;
  vector<vector<int>> A(3, vector<int>(N + 1));
  for (int i = 1; i <= 2; i++) for (int j = 1; j <= N; j++) cin >> A[i][j];
  for (int i = 1; i <= 2; i++) for (int j = 2; j <= N; j++) A[i][j] += A[i][j - 1];
  int ans = 0;
  for (int i = 1; i <= N; i++) ans = max(A[1][i] + A[2][N] - A[2][i - 1], ans);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://abc069.contest.atcoder.jp/tasks/arc080_a

"""


def solve(data):
    l_data = len(data)
    mo4s = [x for x in data if x%4 == 0] #  multiple of 4
    l_mo4s = len(mo4s)
    odds = [x for x in data if x%2 == 1]
    l_odds = len(odds)
    l_evens = l_data - l_odds - l_mo4s
    # print('4の倍数: {}'.format(l_mo4s))
    # print('奇数: {}'.format(l_odds))
    # print('偶数(4の倍数以外): {}'.format(l_evens))

    if l_odds > (l_mo4s + 1):
        return 'No'
    if (l_odds > l_mo4s) and (l_data > (l_mo4s + l_odds)):
        return 'No'
    return 'Yes'


def main():
    N = int(input())
    data = [int(x) for x in input().split()]
    result = solve(data)
    print(result)


if __name__ == '__main__':
    main()

Measured memory_bytes: 14252
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

#define rep(i, n) for (size_t i = 0; i < (n); i++)

template<typename T>
T sq(T x) {
  return x * x;
}

int main() {
  size_t N;
  scanf("%ld", &N);
  pair<double, double> cs[N];
  rep(i, N) scanf("%lf%lf", &cs[i].first, &cs[i].second);
  // (\sum_{i<j} d_{i,j} * (n-1) * n! / \binom{n}{2}) / n!
  // = (\sum_{i<j} d_{i,j}) * (n-1) / \binom{n}{2}
  // = (\sum_{i<j} d_{i,j}) * (n-1) / (n * (n-1) / 2)
  // = (\sum_{i<j} d_{i,j}) * 2 / n
  double d = 0.0;
  rep(i, N - 1)
    for (size_t j = i; j < N; j++)
      d += sqrt(sq(cs[j].first - cs[i].first) + sq(cs[j].second - cs[i].second));
  printf("%.7lf\n", d * 2 / N);
  return 0;
}


Measured memory_bytes: 384
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      int N = nextInt();
      ArrayList<String> one = nextStrArray();
      ArrayList<String> s = myconv(one.get(0), 0);
      ArrayList<String> t = myconv(one.get(1), 0);
      String output = "";
      for(int i = 0; i < N; i++){
        output += s.get(i) + t.get(i);
      }
      myout(output);
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 37440
var
	N,X,Y,Z,i,p:Longint;
	S:String;
begin
	readln(N,X,X);
	readln(S);
	i:=length(S);
	Z:=0;
	p:=1;
	while(1<=i)and(S[i]<>' ')do begin
		inc(Z,(ord(S[i])-48)*p);
		p:=p*10;
		dec(i);
	end;
	dec(i);
	Y:=0;
	p:=1;
	if N=1 then Y:=X
	else begin
		while(1<=i)and(S[i]<>' ')do begin
			inc(Y,(ord(S[i])-48)*p);
			p:=p*10;
			dec(i);
		end;
	end;
	dec(X,Z);
	dec(Y,Z);
	if X<0 then X:=-X;
	if Y<0 then Y:=-Y;
	if X<Y then X:=Y;
	writeln(X);
end.


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)

int main() {
  ll n; cin >> n;
  vector <ll> v(n, 0);
  for (ll x = 1; x*x <= n; x++) {
    for (ll y = x; x*x+y*y+x*y <= n; y++) {
      for (ll z = y; x*x+y*y+z*z+x*y+y*z+z*x <= n; z++) {
        ll tmp = x*x+y*y+z*z+x*y+y*z+z*x;
        tmp--;
        if (x == y) {
          if (y == z) {
            v.at(tmp)++;
          } else {
            v.at(tmp) += 3;
          }
        } else {
          if (y == z) {
            v.at(tmp) += 3;
          } else {
            v.at(tmp) += 6;
          }
        }
      }
    }
  }
  rep(i, n) cout << v.at(i) << endl;
}

Measured memory_bytes: 3520
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		long K = sc.nextLong();
		
		int[] A = new int[N];
		for(int i=0; i<N; i++)
			A[i] = sc.nextInt()-1;
		
		int[] p = new int[N];
		int cur = 0;
		p[cur] = 1;
		while(true) {
			int next = A[cur];
			if(p[next]==0) {
				p[next] = p[cur]+1;
				cur = next;
			} else {
				int v1 = p[next]-1;
				int v2 = p[cur]+1-p[next];
				if(K > v1+v2) {
					K = v1 + (K-v1)%v2;
				}
				break;
			}
		}
		
		cur = 0;
		while(K>0) {
			cur = A[cur];
			K--;
		}
		
		System.out.println(cur+1);
		sc.close();
	}
}


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

queue<char> to_queue(string s) {
    queue<char> q;
    for (int i=0; i<(int)s.size(); ++i) {
        q.push(s[i]);
    }
    return q;
}

int main() {
    string red, green, down;
    while (cin >> red, red != "-") {
        cin >> green >> down;

        queue<char> r, g, d;
        r = to_queue(red);
        g = to_queue(green);
        d = to_queue(down);
        
        string res = "";
        char c = g.front(); g.pop();
        while ( ! r.empty() || ! g.empty() ) {
            if (c == d.front()) {
                d.pop();
                c = r.front(); r.pop();
            } else {
                res += c;
                c = g.front(); g.pop();
            }
        }
        res += c;
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#define _USE_MATH_DEFINES
#define INF 100000000
 
#include <iostream>
#include <cstdio>
#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;
 
static const double EPS = 1e-8;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
int main(){
	int N,K;
	while(~scanf("%d %d",&N,&K)){
		map<int,map<int,bool> > boats;
 
		for(int i=0;i<K;i++){
			int m;
			scanf("%d",&m);
 
			map<int,bool> tmp;
			for(int j=0;j<m;j++){
 
				int usagi;
				scanf("%d",&usagi);
				tmp[usagi] = true;
			}
 
			boats[i] = tmp;
		}
 
		int R;
		scanf("%d",&R);
		bool sux[100];
		memset(sux,0,sizeof(sux));
		for(int i=0;i<R;i++){
			int a,b;
			scanf("%d %d",&a,&b);
			for(int j=0;j<K;j++){
				if(boats[j].find(a) != boats[j].end()
					&& boats[j].find(b) != boats[j].end()){
						sux[a] = true;
						sux[b] = true;
				}
			}
		}
 
		int res = 0;
		for(int i=0;i<=N;i++){
			if(sux[i]) res++;
		}
 
		printf("%d\n",res);
	}
}

Measured memory_bytes: 1200
#include <iostream>
#include <vector>
#include <cstdlib>  
#include <algorithm>
#include <string>

using namespace std;
 
int main() {
    int n;cin>>n;
    int keta=0;
    if(n<10) {
      cout<<n;
      return 0;
    }
    for(int i = 10;;i*=10){
      if(i > n){
        keta = i/10;
        break;
      }
    }
    if(keta == 10) cout<<"9";
    if(keta ==100) cout<<(n+9)-keta+1;
  	if(keta == 1000) cout<<"909";
    if(keta == 10000) cout<<n-keta+1+909;
  	if(keta > 10000) cout<<"90909";
    return 0;
  
}

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

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

int main(void){
  int N, X;
  cin >> N >> X;
  vector<int> x(N);
  for(int i = 0; i < N; i++) {
    cin >> x[i];
  }
  int ans = abs(x[0] - X);
  for(int i = 1; i < N; i++) {
    int diff = abs(x[i] - X);
    ans = gcd(max(ans, diff), min(ans, diff));
  }

  cout << ans << endl;

  return 0;
}

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

int main(){
string a;
cin>>a;
 int b,c;
  b=a.size();
  c=100000;
 if(a[0]!='A'){
   cout<<"WA"<<endl;
 }
  else{
    for(int i=2;i<b-1;i++){
    if(a[i]=='C'){
      c=i;
      for(int j=i+1;j<b-1;j++){
      if(a[j]=='C'){
        c=100000;
      }
      }
      break;
    } 
    }
  if(c==100000){
      cout<<"WA"<<endl;
  }
    else{
      for(int i=1;i<b;i++){
      if(i!=c&&a[i]<='Z'){
          cout<<"WA"<<endl;
        break;
      
      }
        if(i==b-1){
        cout<<"AC"<<endl;
        }
      }

  }
}

}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a, b, c = map(int, input().split())

    for i in range(a, a * b + 1, a):
        if i % b == c:
            print("YES")
            break
    else:
        print("NO")


if __name__ == '__main__':
    resolve()


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

class D
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var a = Console.ReadLine().Split().Select(int.Parse).ToArray();

		var x1 = new PQ<int>();
		var x2 = new PQ<int>((x, y) => -x.CompareTo(y));
		var s1 = new long[n + 1];
		var s2 = new long[n + 1];
		for (int i = 0, j = 3 * n - 1; i < n; i++, j--)
		{
			x1.Push(a[i]);
			x2.Push(a[j]);
			s1[0] += a[i];
			s2[n] += a[j];
		}

		for (int i = 0, j = n - 1; i < n; i++, j--)
		{
			var v1 = a[n + i];
			if (v1 > x1.Current)
			{
				s1[i + 1] = s1[i] + v1 - x1.Pop();
				x1.Push(v1);
			}
			else s1[i + 1] = s1[i];

			var v2 = a[n + j];
			if (v2 < x2.Current)
			{
				s2[j] = s2[j + 1] + v2 - x2.Pop();
				x2.Push(v2);
			}
			else s2[j] = s2[j + 1];
		}
		Console.WriteLine(Enumerable.Range(0, n + 1).Max(i => s1[i] - s2[i]));
	}
}

class PQ<T> : List<T>
{
	Comparison<T> _c;
	public T Current => this[0];

	public PQ() : this(Comparer<T>.Default.Compare) { }
	public PQ(Comparison<T> c) { _c = c; }

	void Swap(int i, int j)
	{
		var t = this[i];
		this[i] = this[j];
		this[j] = t;
	}

	void UpHeap(int i) { for (var j = (i - 1) / 2; i > 0 && _c(this[j], this[i]) > 0; Swap(i, j), i = j, j = (i - 1) / 2) ; }
	void DownHeap(int i)
	{
		for (var j = 2 * i + 1; j < Count; i = j, j = 2 * i + 1)
		{
			if (j + 1 < Count && _c(this[j], this[j + 1]) > 0) j++;
			if (_c(this[i], this[j]) > 0) Swap(i, j); else break;
		}
	}

	public void Push(T v) { Add(v); UpHeap(Count - 1); }
	public T Pop()
	{
		var r = this[0];
		this[0] = this[Count - 1];
		RemoveAt(Count - 1);
		DownHeap(0);
		return r;
	}
}


Measured memory_bytes: 46456
#include<iostream>
#include<cstdio>
#include<string.h>
using namespace std;

int main(){
  int n;
  int ans;
  char cmd[100];
  int dice[3];
  
  cin>>n;
  while(n!=0){
    dice[0]=2;
    dice[1]=1;
    dice[2]=3;
  
    ans=1;
    int temp;
    for(int i=0;i<n;i++){
      cin>>cmd;
      if(strcmp(cmd,"North")==0){
	temp=dice[0];
	dice[0]=7-dice[1];
	dice[1]=temp;
      }else if(strcmp(cmd,"East")==0){
	temp=dice[1];
	dice[1]=7-dice[2];
	dice[2]=temp;
      }else if(strcmp(cmd,"West")==0){
	temp=dice[1];
	dice[1]=dice[2];
	dice[2]=7-temp;
      }else if(strcmp(cmd,"South")==0){
	temp=dice[0];
	dice[0]=dice[1];
	dice[1]=7-temp;
      }else if(strcmp(cmd,"Right")==0){
	temp=dice[0];
	dice[0]=dice[2];
	dice[2]=7-temp;
      }else if(strcmp(cmd,"Left")==0){
	temp=dice[0];
	dice[0]=7-dice[2];
	dice[2]=temp;
      }
      ans+=dice[1];
    }
    cout<<ans<<endl;
    cin>>n;
  }

  return 0;

}

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

const int MAX_N=53;
int N, A;
int x[MAX_N];
ll dp[MAX_N][MAX_N][MAX_N*MAX_N];

void solve()
{
	dp[0][0][0]=1;
	for(int i=0;i<N;++i)for(int j=0;j<=i;++j)for(int k=0;k<=j*50;++k){
		if(dp[i][j][k]){
			dp[i+1][j+1][k+x[i]]+=dp[i][j][k];
			dp[i+1][j][k]+=dp[i][j][k];
		}
	}
	ll ans = 0;
	for(int j=1;j<=N &&j*A<=2500;++j) ans+=dp[N][j][j*A];
	cout << ans;
}

int main()
{
	cin >> N >> A;
	for(int i=0;i<N;++i)cin >> x[i];
	solve();
	return 0;
}

Measured memory_bytes: 57600
#include<bits/stdc++.h>
using namespace std;
struct point{
	int a,b;
	point *l,*r,*pa;
	point(){l=r=pa=NULL;}
	point(int aa,int bb):a(aa),b(bb){l=r=pa=NULL;};
};
point *root;
point *rightRotate(point *t){
	point *s=t->l;
	t->l=s->r;
	s->r=t;
	return s;
}
point *leftRotate(point *t){
	point *s=t->r;
	t->r=s->l;
	s->l=t;
	return s;
}
point* insert(point *p,int a,int b){
	if(p==NULL)return new point(a,b);
	if(a==p->a)return p;
	if(a<p->a){
		p->l=insert(p->l,a,b);
		if(p->b<p->l->b)
			p=rightRotate(p);
	}else{
		p->r=insert(p->r,a,b);
		if(p->b<p->r->b)
			p=leftRotate(p);
	}return p;
}
point *_del(point *p, int a);
point *del(point *p,int a){
	if(p==NULL)return NULL;
	if(a<p->a)p->l=del(p->l,a);
	else if(a>p->a)p->r=del(p->r,a);
	else return _del(p,a);
	return p;
}
point *_del(point *p, int a){
	if(p->l==NULL&&p->r==NULL)return NULL;
	else if(p->l==NULL)p=leftRotate(p);
	else if(p->r==NULL)p=rightRotate(p);
	else{
		if(p->l->b>p->r->b)p=rightRotate(p);
		else p=leftRotate(p);
	}return del(p,a);
}
bool find(int a){
	point *p=root;
	while(p){
		if(a==p->a)return 1;
		if(a>p->a)p=p->r;
		else p=p->l;
	}
	return 0;
}
void dfs1(point *p){
	if(!p)return;
	dfs1(p->l);
	printf(" %d",p->a);
	dfs1(p->r);
}
void dfs2(point *p){
	if(!p)return;
	printf(" %d",p->a);
	dfs2(p->l);
	dfs2(p->r);
}
int main(){
	int T,ta,tb;
	cin>>T;
	string s;
	while(cin>>s){
		if(s=="insert"){
			cin>>ta>>tb;
			root=insert(root,ta,tb);
		}else if(s=="find"){
			cin>>ta;
			printf(find(ta)?"yes\n":"no\n");
		}else if(s=="print"){
			dfs1(root);
			printf("\n");
			dfs2(root);
			printf("\n");
		}else if(s=="delete"){
			cin>>ta;
			root=del(root,ta);
		}
	}
	return 0;
}



Measured memory_bytes: 12640
import kotlin.math.ceil

fun main(args: Array<String>) {
    val (a, b, c, d) = readLine()!!.split(" ").map { it.toInt() }
    if (ceil(a.toFloat() / d) >= ceil(c.toFloat() / b)) {
        println("Yes")
    } else {
        println("No")
    }
}

Measured memory_bytes: 36220
N = int(input())

d = {}
d2 = {}
for i in range(1, N + 1):
    s = str(i)
    key = (s[0], s[-1])
    key2 = (s[-1], s[0])
    if key not in d:
        d[key] = 1
    else:
        d[key] += 1

    if key2 not in d2:
        d2[key2] = 1
    else:
        d2[key2] += 1


kosuu = 0
for key in d:
    val = d[key]
    val2 = d.get((key[1], key[0]))
    if val2 is not None:
        kosuu += val * val2

print(kosuu)


Measured memory_bytes: 40684
#include <bits/stdc++.h>
using namespace std;
#define lson (id << 1)
#define rson (id << 1 | 1)
#define lowb(x) (x & (-x))
#define gcd(x, y) __gcd(x, y)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define maxm 
#define maxn 

int main()
{
	int n, m;
	long long ans = 0;
	
	scanf("%d%d", &n, &m);
	int tmp;
	if (m % 2 == 0) {
		tmp = (n + m / 2) / m;
		ans += 1ll * tmp * tmp * tmp;
	}
	tmp = n / m;
	ans += 1ll * tmp * tmp * tmp;
	printf("%lld\n", ans);
}


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

int k;
vector<long long> v;

bool can(long long n) {
    for (int i = 0; i < k; i++) {
        n -= (n % v[i]);
    }
    return (n == 2LL);
}

int main() {
    cin >> k;
    v.assign(k, 0LL);
    for (int i = 0; i < k; i++) cin >> v[i];

    if (v[k-1] != 2LL) {
        cout << -1 << endl;
        return 0;
    }

    long long lo = 2LL;
    for (int i = k-1; i >= 0; i--) {
        long long t = v[i];
        if (lo % t == 0) continue;
        lo = ((lo/t)+1LL)*t;
    }

    if (!can(lo)) {
        cout << -1 << endl;
        return 0;
    }

    long long ans1, ans2;
    ans1 = lo;

    long long hi = 1e18;
    while (lo <= hi) {
        long long mid = (lo+hi)/2LL;
        if (can(mid)) {
            ans2 = mid;
            lo = mid+1LL;
        } else {
            hi = mid-1LL;
        }
    }

    cout << ans1 << ' ' << ans2 << endl;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(a <= c && c <=b){
            System.out.println("Yes");
        }else if(a >= c && c >=b){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    }
}


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

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

	int N;
	cin>>N; //number of dice roll

	int D[N][2]; //array for storing dice rolls
	bool flag = false;
	for(int i=0 ;i<N;i++){
		for(int j=0; j<2; j++){
			cin>>D[i][j];
		}
	}

	for(int i=0;i<N;i++){
		if(D[i][0] == D[i][1]){
			if(D[i+1][0] == D[i+1][1]){
				if(D[i+2][0] == D[i+2][1]){
					flag =true;
					break;
				}
			}
		}
		
	}
	if(flag)
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
}


Measured memory_bytes: 3648
#include <cstdio>

using namespace std;

int A[1000000], n;

//二分探索
int binarySearch(int key){
  int left = 0;
  int right = n;
  int mid;
  while (left < right){
    mid = (left + right) / 2;
    if(key == A[mid]) return 1; //keyを発見
    if(key > A[mid]) left = mid + 1;
    else if(key < A[mid])right = mid;
  }
  return 0;
}

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

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

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

  return 0;
}



Measured memory_bytes: 2952
import sys


def graham_scan(vertices: list):
    from math import atan2
    from operator import itemgetter

    vertices.sort(key=itemgetter(1))
    base_x, base_y = vertices[0][:2]
    vertices = sorted(vertices[1:], key=lambda p: atan2(p[1]-base_y, p[0]-base_x)) + vertices[:1]
    convex = vertices[-1:] + vertices[:1]
    pop, append = convex.pop, convex.append
    last_x, last_y = convex[-1][:2]

    for point, (x, y, *_) in zip(vertices[1:], vertices[1:]):
        while ((x - last_x) * (convex[-2][1] - last_y) -
               (y - last_y) * (convex[-2][0] - last_x) < 0):
            pop()
            last_x, last_y = convex[-1][:2]
        append(point)
        last_x, last_y = x, y

    return convex[:-1]


def kruskal(v_count: int, edges: list, border) -> int:
    """
    :param v_count: 頂点数
    :param edges: [(weight, from, to), ... ]
    """
    from itertools import islice
    tree = [-1]*v_count

    def get_root(x) -> int:
        if tree[x] < 0:
            return x
        tree[x] = get_root(tree[x])
        return tree[x]

    def unite(a) -> bool:
        x, y = get_root(a[1]), get_root(a[2])
        if x != y:
            big, small = (x, y) if tree[x] < tree[y] else (y, x)
            tree[big] += tree[small]
            tree[small] = big
        return x != y

    cost = 0
    for c, s, t in border_edges:
        cost += c
        unite((0, s, t))
    v_count -= len(border_edges)-1
    for w, _s, _t in islice(filter(unite, sorted(edges)), v_count-1):
        cost += w
    return cost


if __name__ == "__main__":
    from math import hypot
    V, R = map(int, input().split())
    vertices = [list(map(int, sys.stdin.readline().split()))+[i] for i in range(V)]
    edges = [(hypot(vertices[s-1][0]-vertices[t-1][0], vertices[s-1][1]-vertices[t-1][1]), s-1, t-1)
             for l in sys.stdin for s, t in (map(int, l.split()),)]
    convex = graham_scan(vertices)
    border_edges = [(hypot(x1-x2, y1-y2), s, t) for (x1, y1, s), (x2, y2, t) in zip(convex, convex[1:]+convex[:1])]
    cost = kruskal(V, edges, border_edges)
    print(cost)


Measured memory_bytes: 5940
l =list(map(int,input().split()))
a=l[0]*l[2]
b=l[0]*l[3]
c=l[1]*l[2]
d=l[1]*l[3]
m=[]
m.append(a)
m.append(b)
m.append(c)
m.append(d)
m.sort()
print(m[-1])

Measured memory_bytes: 9188
#include <bits/stdc++.h>
typedef long long LL;
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second

using namespace std;

int main(){
	DRI(n);
	bool isok=true;
	VPII a(n);
	REP(i,n){
		DRII(x,y);
		a[i]={y,x};
	}
	sort(a.begin(),a.end());
	LL ct=0;
	for (auto t:a){
		ct+=t.S;
		if (ct>t.F) isok=false;
	}
	if (!isok) {printf("No\n");}
	else {printf("Yes\n");}
}


Measured memory_bytes: 1792
mod=10**9+7
n,k=map(int,input().split())
ans=(n+1)*( (n+k+1)*(n-k+2)/2 - (n+2)*(2*n+3)/6 )+k*(k-1)*(2*k-1)/6+(n-k+2)
ans=round(ans%mod)
print(ans)

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

using namespace std;
int main(){
    int N, M, C;
    cin >> N >> M >> C;

    vector<int>B(M);
    vector<vector<int>>A(N, vector<int>(M));

    for(int i=0; i<M; i++) cin >> B.at(i);
    for(int i=0; i<N; i++){
        for(int j=0; j<M; j++) cin >> A.at(i).at(j);
    }

    int tmp=0,ans=0;
    for(int i=0; i<N; i++){
        for(int j=0; j<M; j++){
            tmp+=A.at(i).at(j)*B.at(j);
        }
        ans+=(tmp+C>0?1:0);
        tmp=0;
    }

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

Measured memory_bytes: 256
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim n As String = NextString()
        Dim flg As Integer

        For i As Integer = 0 To Len(n) - 1
            If i <> 0 And n(i) <> "9"c Then
                flg = 1
            End If
        Next

        WriteLine(Convert.ToInt32(n(0) & "") + 9 * (Len(n) - 1) - flg)
    End Sub

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function
End Module


Measured memory_bytes: 20432
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<ll,int> P;

int main(void){
	          int i;

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

	      	  ll Q,H,S,D,N;
	      	  cin >> Q >> H >> S >> D >> N;

	      	  vector<P> v;
	      	  v.push_back(P(8LL*Q,0));
	      	  v.push_back(P(4LL*H,1));
	      	  v.push_back(P(2LL*S,2));
	      	  v.push_back(P(D,3));

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

	      	  ll ans;
	      	  if(v[0].second!=3){

	      		if(v[0].second==0){
	      			ans=4LL*N;
	      			ans*=Q;
	      		}
	      		if(v[0].second==1){
	      			ans=2LL*N;
	      			ans*=H;
	      		}
	      		if(v[0].second==2){
	      			ans=N;
	      			ans*=S;
	      		}

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

	      	  if(N%2LL==0){
		      		ans=N/2LL;
		      		ans*=D;
		      		cout << ans << endl;
		      		return 0;
	      	  }

	      	 ans=N/2LL;
	      	 ans*=D;
	      	 ll r;
	      		if(v[1].second==0) r=4LL*Q;
	      		if(v[1].second==1) r=2LL*H;
	      		if(v[1].second==2) r=S;

	      		cout << ans+r << endl;


	          return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int V[110];
    rep(i, N) cin >> V[i];
    int ans = 0;
    REP(L, 0, min(N, K)) {
        REP(R, 0, min(N, K) - L) {
            if (L + R > N) continue;
            //cout << L << " " << R << "->";
            vector<int> G;
            rep(i, L) G.push_back(V[i]);
            rep(i, R) G.push_back(V[N - i - 1]);
            sort(G.begin(), G.end());

            int amari = K - R - L;
            int tmp = 0;
            rep(i, G.size()) {
                if (G[i] < 0 && amari) {
                    amari--;
                } else {
                    tmp += G[i];
                }
            }
            ans = max(tmp, ans);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
#include <sstream>
#include <iterator>
#include <complex>
using namespace std;

int main()
{
	int array[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int N;
	cin >> N;
	cout << array[N-1] <<endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String args[]) {
    Scanner in  = new Scanner(System.in);
    int num, h = 0;
    String str = "", front = "", back = "";

    while(true){
      str = in.next();
      if(str.equals("-"))  break;
      num = in.nextInt();
      for(int i = 0; i < num; i++){
        h = in.nextInt();
        back = str.substring(0,h);
        front = str.substring(h);
        str = front + back;
      }
      System.out.println(str);
    }
  }
}



Measured memory_bytes: 26432