akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
#define all(v) v.begin(),v.end()
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

vector<int>g[100005];
vector<bool>done(100005,false);
vector<int>memo(100005);

int dp(int a){
    if(done[a]) return memo[a];
    int ans=0;
    for(int u:g[a]){
        ans=max(ans,dp(u)+1);
    }
    done[a]=true;
    memo[a]=ans;
    return ans;
}

int main (){
    int n,m;
    cin >> n >> m;
    rep(i,m){
        int x,y;
        cin >> x >> y;
        g[x].push_back(y);
    }
    int ans=0;
    for(int v=1;v<=n;v++){
        ans=max(ans,dp(v));
    }
    cout << ans << endl;
    return 0;
}


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

void chmax(ll& a, ll b) {
  if (a < b) a = b;
}

int main() {
  ll N, M;
  cin >> N >> M;
  ll ans = 1;
  
  for (int i = 1; i * i <= M; i++) {
    if (M % i == 0 &&  i * N <= M) {
      chmax(ans, i);
    
      if (M/i * N <= M) {
        chmax(ans, M/i);
      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main()
{
    string S;
    cin >> S;

    int n = S.size();
    vector<ll> ans(n, 0);

    int i = 0;
    while (i < n) {
        int c = 0;
        while (i < n && S[i] == 'R') {
            ++c;
            ++i;
        }

        if (c % 2 == 0) {
            ans[i]   += c/2;
            ans[i-1] += c/2;
        } else {
            ans[i]   += c/2;
            ans[i-1] += c/2+1;
        }

        while (i < n && S[i] == 'L') {
            ++i;
        }
    }

    i = n-1;
    while (i >= 0) {
        int c = 0;
        while (i >= 0 && S[i] == 'L') {
            ++c;
            --i;
        }

        if (c % 2 == 0) {
            ans[i]   += c/2;
            ans[i+1] += c/2;
        } else {
            ans[i]   += c/2;
            ans[i+1] += c/2+1;
        }

        while (i >= 0 && S[i] == 'R') {
            --i;
        }
    }

    for (int i = 0; i < n; ++i) {
        cout << ans[i] << ' ';
    }
    cout << endl;

    return 0;
}


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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    s,t,u=input().split()
    ans=s[0]+t[0]+u[0]
    print(ans.upper())

main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pi pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int s,w;
  cin>>s>>w;
  cout<<(w>=s?"unsafe":"safe")<<endl;
  return 0;
}


Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int n,a,b;
  cin>>n>>a>>b;
  cout<<min(a,b)<<" ";
  if(a+b<=n) cout<<0<<'\n';
  else cout<<a+b-n<<'\n';
  return 0;
}


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

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int n= sc.nextInt();
			if(n == 0) break;
			int m = sc.nextInt();
			int[][] card = new int[m+1][2*n];
			for(int i=0;i<2*n;i++) card[0][i] = i+1;
			for(int i=1;i<=m;i++) {
				int k = sc.nextInt();
				if(k == 0) {
					for(int j=0;j<n;j++) {
						card[i][2*j] = card[i-1][j];
						card[i][2*j+1] = card[i-1][n+j];
					}
				}
				else {
					for(int j=k;j<2*n;j++)card[i][j-k] = card[i-1][j];
					for(int j=0;j<k;j++) card[i][2*n-k+j] = card[i-1][j];
				}
			}
			for(int i=0;i<2*n;i++) System.out.println(card[m][i]);
		}
	}

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

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

int main(){
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < 3; i++)
    {
        if(s[i]==t[i])
        {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string as = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string ab = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
int main() {

  string s;
  cin >> s;

  if(s[0]!=s[1]||s[1]!=s[2]) {
    yes();
  }else {
    no();
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string a;
    cin >> a;
    for(int i = 0; i < int(a.size()); i++){
        // ?を全部Dにしてみる
        if(a[i] == '?'){
            a[i] = 'D';
        }
    }
    cout << a << endl;
    return 0;
}


Measured memory_bytes: 3760
#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 watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF ll(1e18)
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define MAXN 100005

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int m,d,m2,d2; cin>>m>>d>>m2>>d2;
	
	if(m!=m2) cout<<1<<'\n';
	else cout<<0<<'\n';
	
	return 0;
}


Measured memory_bytes: 256
s = list(input())
N = len(s)
gx, gy = map(int, input().split())
sx =sy = 0
mv_lists = [[], []]
def is_reach(mv_list, s, g):
	pos_set = set([s])
	for mv in mv_list:
		tmp_pos_set = set()
		for h in pos_set:
			tmp_pos_set.add(h - mv)
			tmp_pos_set.add(h + mv)
		pos_set = tmp_pos_set
	return g in pos_set
hv = 0
tmp_mv = 0
for o in s:
	if o == "F":
		tmp_mv += 1
	else:
		mv_lists[hv].append(tmp_mv)
		tmp_mv = 0
		hv ^= 1
else:
	mv_lists[hv].append(tmp_mv)
if s[0] == "F":
	sx += mv_lists[0][0]
	mv_lists[0] = mv_lists[0][1:]
if is_reach(mv_lists[0], sx, gx) and is_reach(mv_lists[1], sy, gy):
	print("Yes")
else:
	print("No")


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int N = 0;
	cin >> N;
	vector<string> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int a = 0;
	int T = 0;
	int R = 0;
	int W = 0;
	for (int i = 0; i < N; i++) {
		if (A[i] == "AC") {
			a++;
		}
		else if (A[i] == "TLE") {
			T++;
		}
		else if (A[i] == "RE") {
			R++;
		}
		else {
			W++;
		}
	}
	cout << "AC x " << a << endl;
	cout << "WA x " << W << endl;
	cout << "TLE x " << T << endl;
	cout << "RE x " << R << endl;
	return 0;
}

Measured memory_bytes: 6380
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
string s,t;
ll done[3005][3005],dp[3005][3005];
ll n,m;
string lcs;

ll solve(ll i,ll j){
  if(i == n or j == m)return 0;
  if(done[i][j])return dp[i][j];
  ll ans = 0;
  if(s[i] == t[j]){
    ans = max(ans,1+solve(i+1,j+1));
  }
  ans = max(ans,solve(i+1,j));
  ans = max(ans,solve(i,j+1));
  done[i][j] = 1;
  return dp[i][j] = ans;
}

void get_str(ll i,ll j,ll len){
  if(i == n or j == m)return;
  ll x = solve(i+1,j);
  ll y = solve(i,j+1);
  ll z = -INF;
  if(s[i] == t[j]){
    z = solve(i+1,j+1);
  }
  if(z == len-1){
    lcs+=s[i];
    get_str(i+1,j+1,len-1);
  }
  else if(x == len){
    get_str(i+1,j,len);
  }
  else if(y == len){
    get_str(i,j+1,len);
  }
}

int main(){FAST;
cin>>s>>t;
n = s.length();
m = t.length();
ll len = solve(0,0);
if(len){
  get_str(0,0,len);
  cout<<lcs;
}
return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


Measured memory_bytes: 144852
import sys

N,K = map(int,input().split())

if 2*K-1 > N:
    print (-1)
    sys.exit()

ans = []

nc = K+2*N + (N+1) // 2
na = K+1
nb = K + 2*N -1

for i in range(N // 2):


    ans.append([na,nb,nc])
    
    na += 2
    nb -= 1
    nc += 1

na = K
nc = K + 2*N
for i in range((N+1) // 2):


    ans.append([na,nb,nc])


    na += 2
    nb -= 1
    nc += 1

for i in ans:

    print (i[0],i[1],i[2])
    

Measured memory_bytes: 58584
#include <cstdlib>
#include <cmath>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <list>
#define MOD 1000000007
#define INF 1000000000
typedef long long ll;
using namespace std;
typedef pair<int,int> P;

int main(void){
    int n,k;
    cin>>n>>k;
    int ans=1;
    for(int i=0;i<n;i++){
        if(ans+k>ans*2)ans=ans*2;
        else ans+=k;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <map>
#include <string>

using namespace std;

int main()
{
    int N;
    if (scanf("%d", &N) < 1) return 0;

    map<char, int> m;
    for (int i = 0; i < N; i++)
    {
        char x;
        x = getchar();
        x = getchar();
        m[x]++;
    }

    string ans = "Four";
    if (m.size() == 3)
    {
        ans = "Three";
    }

    printf("%s\n", ans.c_str());

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int area = a*b;
        int length = 2*(a+b);
        System.out.println(area + " " + length);
        sc.close();
    }
}


Measured memory_bytes: 26396
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

const int M = 1e5;
int group[2*M];
int val[2*M];

int coll(int i) {
	if (group[i] != i) group[i] = coll(group[i]);
	return group[i];
}

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

	int n, h, w;
	cin >> n >> h >> w;
	for (int x = 0; x < w; ++x) group[x] = x;
	for (int y = w; y < w+h; ++y) group[y] = y;
	for (int i = 0; i < w+h; ++i) val[i] = 1;

	vector<pair<int, pair<int, int>>> cards(n);
	for (int i = 0; i < n; ++i) {
		cin >> cards[i].second.first >> cards[i].second.second >> cards[i].first;
	}
	sort(cards.begin(), cards.end());

	// We will always pick the most valuable card.
	// We will always pick the second most valuable card
	// And so on. therefore a greedy strategy works.
	// To check if we can pick card i, We need to check that for all subsets of cards,
	// the number of columns and rows in their coordinates is at least their count.

	ll res = 0;
	while(! cards.empty()) {
		ll v = cards.back().first;
		int yi = coll(w + cards.back().second.first - 1);
		int xi = coll(cards.back().second.second - 1);
		cards.pop_back();

		if (xi == yi) {
			if (val[xi] >= 1) {
				--val[xi];
				res += v;
			}
		} else {
			if (val[xi] + val[yi] >= 1) {
				group[yi] = xi;
				val[xi] += val[yi] - 1;
				res += v;
			}
		}
	}
	cout << res << '\n';
}


Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>

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

using namespace std;
int mod = 1000000007;

string s;

int main() {
  cin >> s;
  s.at(3) = '8';
  cout << s << endl;
}

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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define vvi vector<vector<int>>
#define vvii vector<vector<pair<int, int>>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = 2e18;
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

// #define MULTIPLE_TEST_CASES

int check(string s, string t) {
  if (s.size() != t.size())
    return INF;
  int ans = 0;
  for (int i = 0; i < s.size(); ++i)
    ans += (s[i] != t[i]);
  return ans;
}

void solve() {
  string s, t;
  cin >> s >> t;

  int ans = INF;
  for (int i = 0; i < s.size(); ++i) {
    ans = min(ans, check(s.substr(i, t.size()), t));
  }
  cout << ans << endl;
}

signed main() {
  // freopen(".in", "r", stdin);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);

  int t = 1;
#ifdef MULTIPLE_TEST_CASES
  cin >> t;
#endif
  while (t--)
    solve();
}

Measured memory_bytes: 3612
n = int(input())
a = list(map(int,input().split()))
d = dict()
for i in a:
    if i not in d:
        d[i] = 1

    else:
        d[i] += 1
count = 0
for key, value in d.items():
    if int(key) > value:
        count += int(value)
    elif int(key) < value:
        count += value - int(key)

print(count)


Measured memory_bytes: 21700
#include <stdio.h>
int main(void){
    // Here your code !
    char str[10];
    int i;
    char yaki[4] = "YAKI";
    int flag = 0;
    
    scanf("%s", str);
    
    for (i = 0; i < 4; i++) {
        if (str[i] != yaki[i]) {
            flag = 1;
            break;
        }
    }
    
    if (flag) {
        printf("No\n");
    } else {
        printf("Yes\n");
    }
    
    return 0;
}


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


int main(){
	
	int a,b;
	while(cin>>a>>b){
		int d[101]={0};
		d[1]=d[2]=1;
		d[a]++;
		d[b]++;
		while(cin>>a>>b,(a+b)){
			d[a]++;
			d[b]++;
		}
		int flg=1;
		for(int i=1;i<=100;i++){
			if(d[i]%2)flg=0;
		}
		
		
		if(flg)cout<<"OK\n";
		else cout<<"NG\n";
	}
	
	return 0;
}


Measured memory_bytes: 1120
#include <iostream>
#include <vector>
#include <utility>
#include <queue>

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

using namespace std;

typedef pair<int, int> Edge; // <weight, dest>

int main() {
  int nbr_vertices, nbr_edges;

  cin >> nbr_vertices >> nbr_edges;

  vector<bool> vertices_linked(nbr_vertices, false);
  vertices_linked[0] = true;
  vector<vector<Edge> > edges_list(nbr_vertices);
  int best_distance = 0;
  int src, dest, dist;

  FOR(i, nbr_edges) {
    cin >> src >> dest >> dist;
    edges_list[src].push_back(make_pair(dist, dest));
    edges_list[dest].push_back(make_pair(dist, src));
  }

  priority_queue<Edge, vector<Edge>, greater<Edge> > queue;

  FOR(i, edges_list[0].size()) {
    queue.push(edges_list[0][i]);
  }

  while (!queue.empty()) {
    Edge edge = queue.top();
    if (!vertices_linked[edge.second]) {
      vertices_linked[edge.second] = true;
      best_distance += edge.first;
      queue.pop();
      FOR(i, edges_list[edge.second].size()) {
        queue.push(edges_list[edge.second][i]);
      }
    } else {
      queue.pop();
    }
  }
  cout << best_distance << endl;
}


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

bool hantei( double x1, double y1, double x2, double y2, double x3, double y3 ) {
  if ( (x1-x2)*(y3-y2) > (y1-y2)*(x3-x2) ) return true;
  return false;
}

int main() {

  double x1,y1,x2,y2,x3,y3,xp,yp;

  while( cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp ) {

    for ( int i = 0; i < 3; i++ ) {
      if ( hantei( x1, y1, x2, y2, x3, y3 ) != hantei( x1, y1, x2, y2, xp, yp ) ) {
	cout << "NO" << endl;
	break;
      }
      if ( i != 2 ) {
	double k;
	k = x1;
	x1 = x2;
	x2 = x3;
	x3 = k;
	k = y1;
	y1 = y2;
	y2 = y3;
	y3 = k;
      }else {
	cout << "YES" << endl;
      }
    }

  }

  return 0;

}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)n; i++)
const int MOD = 1000000007;
// long long a;
int main(){
  int N, M;
  cin >> N >>M;
  vector<string > A(N), B(M);
  REP(i, N) cin >> A[i];
  REP(i, M) cin >> B[i];
  bool flag = false;
  for(int i= 0; i <= N - M; i ++){
    for(int j= 0; j <= N - M; j ++){
      for(int k = 0; k < M; k ++){
	if(A[i + k].substr(j, M) != B[k]){
	  break;
	}
	if(k == M - 1){
	  cout << "Yes" << endl;
	  return 0;
	  ///	  cout << "i,j,k = " << i << "," << j << ","<<k <<endl;
	}
      }
    }
  }
  if(!flag)cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
const int INF = 10e9 + 5;
int main()
{
	int n,k;
	cin >> n >> k;
	vector<int> h(n);
	vector<int> dp(n,INF);
	dp[0] = 0;
	for (int i = 0; i < n; i++) cin >> h[i];
	for (int i = 0; i < n; i++) {
		for (int j = 1; j <= k; j++) {
			if (i + j < n) dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i+j]) );
		}
	}
	
	cout << dp[n - 1];
}


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

#define MOD 1000000007

int A[100005], rem[100005];
long long dp[100005];
vector<int> X[100005];

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

    int N;
    cin >> N;

    for(int i=1; i<=N; i++)
    {
        cin >> A[i];
        A[i]++;
        X[ A[i] ].push_back(i);
    }

    long long ans = 1;
    rem[0] = 3;

    for(int i=1; i<=N; i++)
    {
        ans = ans * rem[ A[i]-1 ] % MOD;
        rem[ A[i]-1 ]--;
        rem[ A[i] ]++;
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6528
n=int(input())
a,b = list(map(int, input().split()))
p = list(map(int, input().split()))

q = list([0,0,0])
for i in p:
    if i <= a:
        q[0] += 1
    elif i > b:
        q[2] += 1
    else:
        q[1] +=1

print(min(q))


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>


template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }

const double EPS =1e-9;
const long INF =999999999;
const long MOD =1000000007; //10^9+7
#define PI 3.14159265258979

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

int main(void){
	int A,B;
	cin>>A>>B;
	if(A==B) puts("Draw");
	else if(A==1) puts("Alice");
	else if(B==1) puts("Bob");
	else if(A>B) puts("Alice");
	else puts("Bob");

	
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int K = 0;
		int N = 0;
		Scanner sc = new Scanner(System.in);
		K = Integer.parseInt(sc.next());
		N = Integer.parseInt(sc.next());
		int A[] = new int[N];
		int i;
		for (i = 0; i < N; i++) {
			A[i] = Integer.parseInt(sc.next());
		}
		int max = 0;
		for (i = 0; i < N - 1; i++) {
			if (max < A[i + 1] - A[i]) {
				max = A[i + 1] - A[i];
			}
		}
		if (max < A[0] + K - A[N - 1]) {
			max = A[0] + K - A[N - 1];
		}
		System.out.println(K - max);
		sc.close();

	}

}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int n;
    cin >> n;
    if(n==0) return 0;
    vector<int> l(n),t(n),r(n),b(n);
    map<int,int> xmp,ymp;
    rep(i,n){
      cin >> l[i] >> t[i] >> r[i] >> b[i];
      xmp[l[i]-1]=-1;
      xmp[l[i]]=-1;
      xmp[r[i]-1]=-1;
      xmp[r[i]]=-1;
      ymp[b[i]-1]=-1;
      ymp[b[i]]=-1;
      ymp[t[i]-1]=-1;
      ymp[t[i]]=-1;
    }
    int xsz=0,ysz=0;
    for(auto &p:xmp) p.second=(xsz++);
    for(auto &p:ymp) p.second=(ysz++);
    vector<vector<LL>> f(xsz,vector<LL>(ysz,0));
    rep(i,n){
      int ld = xmp[l[i]];
      int rd = xmp[r[i]];
      int td = ymp[t[i]];
      int bd = ymp[b[i]];
      repp(x,ld,rd){
        repp(y,bd,td){
          f[x][y]|=(1LL<<i);
        }
      }
    }
    // rep(i,xsz){
    //   rep(j,ysz){
    //     cout << f[i][j] << " ";
    //   }
    //   cout << endl;
    // }
    set<LL> st;
    int count=0;
    queue<pair<int,int>> q;
    vector<int> v={0,1,0,-1,0};
    rep(i,xsz){
      rep(j,ysz){
        if(f[i][j]>-1){
          count++;
          LL cc = f[i][j];
          f[i][j]=-1;
          q.push({i,j});
          while(!q.empty()){
            auto p = q.front();
            q.pop();
            rep(k,4){
              int nx = p.first+v[k];
              int ny = p.second+v[k+1];
              if(0<=nx&&nx<xsz&&0<=ny&&ny<ysz){
                if(f[nx][ny]==cc){
                  f[nx][ny]=-1;
                  q.push({nx,ny});
                }
              }
            }
          }
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}



Measured memory_bytes: 3228
n,q = map(int,input().split())
s = input()
ls = [0]*(n+1)
for i in range(len(s)):
    if s[i:i+2]=="AC":
        ls[i+1] += ls[i]+1
    else:
        ls[i+1] = ls[i]
for j in range(q):
    l,r = map(int,input().split())
    print(ls[r-1]-ls[l-1])

Measured memory_bytes: 6132
#include <iostream>
#include <vector>
#include <set>
#include <array>
#include <list>
#include <string>
#include <algorithm>

using namespace std;

struct Point {
	int x;
	int y;

};

int main() {

	int n;
	cin >> n;
	vector<int> veca(n);
	list<int> lisb;

	for (auto& v : veca)
	{
		cin >> v;
	}

	for (int i = 0; i < n; i++)
	{
		if (i % 2 == 0)
		{
			lisb.push_back(veca[i]);
		}
		else
		{
			lisb.push_front(veca[i]);
		}
	}

	if (n % 2 == 1)
	{
		lisb.reverse();
	}

	for (const auto& v : lisb)
	{
		cout << v << " ";
	}

	cout << endl;

	return 0;
}


Measured memory_bytes: 9216
def main():
    n = int(input())
    a = list(map(int, input().split()))
    cont = 0

    for i in a:
        if i%2 == 1:
            cont += 1
    
    if cont%2 == 0:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 14108
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

A = LI()

ans = True
for a in A:
    if a % 2 != 0:
        continue

    if a % 3 != 0 and a % 5 != 0:
        ans = False

if ans:
    print("APPROVED")
else:
    print("DENIED")


Measured memory_bytes: 9544
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N;
ll dp[100005];
ll arrSix[10];
ll arrNine[10];

ll rec(int n) {
	if(n == 0) {
		return 0;
	}
	if(n < 0) {
		return 1e9;
	}
	ll &ans = dp[n];
	if(ans != -1) {
		return ans;
	}
	ll sixCand = 6;
	ll nineCand = 9;
	for(int i = 0; i < 8; i++) {
		if(arrSix[i] <= n) {
			sixCand = arrSix[i];
		} 
	}
	for(int i = 0; i < 8; i++) {
		if(arrNine[i] <= n) {
			nineCand = arrNine[i];
		}
	}
	ans = min(1 + rec(n - 1), min(1 + rec(n - nineCand), 1 + rec(n - sixCand)));
	return ans;
}

int main() {
	scanf("%lld", &N);
	for(int i = 0; i < 8; i++) {
		arrSix[i] = pow(6, i);
		arrNine[i] = pow(9, i);
	}
	memset(dp, -1, sizeof(dp));
	cout << rec(N);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#include <atcoder/modint>
#include <atcoder/lazysegtree>
using namespace std;
using namespace atcoder;

#define rng(i,l,r) for(int i=int(l);i<int(r);i++)
#define rep(i,r) rng(i,0,r)

using mint = modint998244353;

mint ans,beki[200005],one[200005];
int n,q;

struct S{
	mint sum;
	int size;
};
struct F{
	int d;
};
S op(S l,S r){
	return S{beki[r.size]*l.sum+r.sum,l.size+r.size};
}
S e(){
	return S{0,0};
}
S mapping(F f,S x){
	if(f.d==-1)return x;
	return S{one[x.size]*mint(f.d),x.size};
}
F composition(F f,F g){
	if(f.d==-1)return g;
	return f;
}
F id(){
	return F{-1};
}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cin>>n>>q;
	beki[0]=1;
	rng(i,1,n+1)beki[i]=beki[i-1]*mint(10);
	one[0]=0;
	rng(i,1,n+1)one[i]=one[i-1]*mint(10)+mint(1);
	lazy_segtree<S,op,e,F,mapping,composition,id>seg(n);
	rep(i,n)seg.set(i,S{1,1});
	while(q--){
		int l,r,d;
		cin>>l>>r>>d;
		seg.apply(l-1,r,F{d});
		cout<<seg.all_prod().sum.val()<<endl;
	}
}


Measured memory_bytes: 11352
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#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 mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// -------------------------------------------------------------------------------------



int main() {
  int n;
  cin >> n;
  vector<int> c(n-1), s(n-1), f(n-1);
  rep(i, n-1)
    cin >> c[i] >> s[i] >> f[i];

  rep(i, n) {
    int t = 0;
    for(int j=i; j<n-1; j++) {
      if(s[j] > t) {
        t = s[j] + c[j];
      } else if(t % f[j] == 0) {
        t += c[j];
      } else {
        t = (t/f[j] + 1) * f[j] + c[j];
      }
    }
    cout << t << endl;
  }


  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define lamsort(v,p) sort(v.begin(),v.end(),[](p a, p b){return a.num < b.num;});
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
const long long LLINF = 1LL<<60;
const int INF = 1e9;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお
 
class UnionFind {
public:
    ll S;
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)
 
    // Constructor
    UnionFind(ll n){
    	rep(i,n){
    		par.push_back(i); // 初期では親は自分自身
    		siz.push_back(1);
    	}
        S = n;
    }
 
    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }
 
    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        ll rx = root(x);
        ll ry = root(y);
        if (rx == ry) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[rx] < siz[ry]) swap(rx, ry);
        siz[rx] += siz[ry];
        par[ry] = rx;
        S--;
        return true;
    }
 
    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }
 
    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
	ll allsize() {return S;}
};
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, m; cin >> n >> m;
    UnionFind tree(n);
    rep(i,m) {
        ll u,v,z; cin >> u >> v >> z;
        u--; v--;
        tree.merge(u,v);
    }
    cout << tree.allsize() << endl;
 
    return 0;
}

Measured memory_bytes: 2036
#include<stdio.h>
int main(){
    
    int a,b;
    scanf("%d %d", &a,&b);
    
    if(a>=b){
        for(int i=0;i<=a-1;i++){
            printf("%d",b);
        };
        printf("\n");
        return 0;
    }
    
    for(int j=0;j<=b-1;j++){
            printf("%d",a);
        };
    printf("\n");
        return 0;

}


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

int main() {
  int A,B,C,K;
  cin>>A>>B>>C>>K;
  int sum;
  if (A>=K)
    sum = K;
  else if(A+B>=K)
    sum=A;
  else if(A+B+C>=K)
    sum = 2*A +B-K;
  cout<<sum<<endl;
}



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

int main(){
  int n;
  string s;
  cin >> n >> s;
  
  int count = 0;
  rep(i,n-2){
    string tmp = s.substr(i,3);
    if(tmp=="ABC") count++;
  }
  
  cout << count << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------


string L;
int N;
ll mo=1000000007;
ll S[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>L;
	L="0"+L;
	N=L.size();
	ll ret=0;
	ll v=1,a=1;
	
	int c=1;
	S[0]=1;
	FOR(i,N) {
		S[i+1]=S[i];
		if(L[i]=='1') S[i+1]=S[i+1]*2%mo;
	}
	
	for(i=N-1;i>=1;i--) {
		if(L[i]=='1') {
			v=v*2%mo;
			ret+=a*S[i]%mo;
		}
		a=a*3%mo;
	}
	ret+=v;
	cout<<(ret%mo)<<endl;
	
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 1132
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define allR(v) v.rbegin(), v.rend()
#define PRINT(v) for (auto x : (v)) cout <<x <<" " ; cout <<endl;
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
typedef pair<int,int> Pi;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
const int inf = 1001001001;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m=numeric_limits<T>::max()){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }

template<class T> struct edge { int to; T cost;};


int main() {
  int X; cin >>X;
  int g = gcd(360, X);
  int res = 360 / g;
  cout <<res <<endl;
}

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

int main()
{
  int N, T;
  int c_min = 9999;
  cin >> N >> T;
  for(int n=0; n<N; ++n)
  {
    int c, i;
    cin >> c >> i;
    if(i <= T && c <c_min)
      c_min = c;
  }
  if(c_min == 9999)
  {
    cout << "TLE" << endl;
  }
  else
  {
    cout << c_min << endl;
  }
  return 0;
}


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

using namespace std;


int main(void)
{
    long long a,b,n;

    cin >> a >> b >> n;
    
    long long i = (b-1<n)?b-1:n;
    
    cout << (long long)(a*i/b)<< endl;
    
    
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000001
#define MAXN        200005
#define mod         1000000007
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i,count=0;
    cin>>n;
    ll a[n+1];
    for(i=1;i<=n;i++){
        cin>>a[i];
    }
    for(i=2;i<=n-1;i++){
        vector<ll> vi;
        vi.pb(a[i-1]);
        vi.pb(a[i+1]);
        vi.pb(a[i]);
        sort(vi.begin(),vi.end());
        if(vi[1]==a[i]){
            count++;
        }
    }
    cout<<count;
}

Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]


# print(n, a, b, c)

ans = 0
last_index = -1
for ai in a:
    ans += b[ai-1]
    if ai - last_index == 1:
        ans += c[ai-2]
    last_index = ai

print(ans)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    int cnt[n] = {};
    rep(i, 0, q) {
        int a;
        cin >> a;
        a--;
        cnt[a]++;
    }
    int p[n];
    rep(i, 0, n) {
        p[i] = k - (q - cnt[i]);
    }
    rep(i, 0, n) {
        if (p[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}


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

int main(){
	double L;
  	cin >> L;
  
  	double tate = L / 3, yoko = L / 3, taka = L / 3;
 
  	cout << fixed << setprecision(6) << tate * yoko * taka << endl;
}

Measured memory_bytes: 256
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 15;
const int mod = 1000000007;

struct P {
  int x,y,z;
  P(){}
}p[maxn];
int n;

struct Q{
  int x,id;
  Q(){}
  bool operator<(const Q& a)const {
    return x<a.x;
  }
}q[maxn + maxn];

ll ans[maxn+1];

bool vis[maxn];
int px[maxn], cx;
int py[maxn], cy;
ll ansx[maxn],ansy[maxn];
void dfs(int cur, int cnt){
  if(cur==n+n){
    int tt=0;
    for(int i=0;i<n;i++){
      ansx[q[i].id] = abs(q[i].x) *(ll)p[q[i].id].z;
      while(tt<cx&&px[tt]<i)tt++;
      if(tt<cx){
        ansx[q[i].id] = min(ansx[q[i].id], abs(q[i].x - q[px[tt]].x) * (ll)p[q[i].id].z);
      }
      if(tt-1>=0){
        ansx[q[i].id] = min(ansx[q[i].id], abs(q[i].x - q[px[tt-1]].x) * (ll)p[q[i].id].z);
      }
    }
    tt=0;
    for(int i=n;i<n+n;i++){
      ansy[q[i].id] = abs(q[i].x) *(ll)p[q[i].id].z;
      while(tt<cy&&py[tt]<i)tt++;
      if(tt<cy){
        ansy[q[i].id] = min(ansy[q[i].id], abs(q[i].x - q[py[tt]].x) * (ll)p[q[i].id].z);
      }
      if(tt-1>=0){
        ansy[q[i].id] = min(ansy[q[i].id], abs(q[i].x - q[py[tt-1]].x) * (ll)p[q[i].id].z);
      }
    }
    ll ret = 0;
    for(int i=0;i<n;i++)ret+=min(ansx[i],ansy[i]);
    ans[cnt] = min(ans[cnt],ret);
    return;
  }
  if(cur>=n){
    if(!vis[q[cur].id]){
      py[cy++] = cur;
      dfs(cur+1, cnt+1);
      cy--;
    }
    dfs(cur+1, cnt);
  } else {
    dfs(cur+1, cnt);
    vis[q[cur].id] = 1;
    px[cx++] = cur;
    dfs(cur+1, cnt+1);
    cx--;
    vis[q[cur].id] = 0;
  }
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  cin>>n;
  for(int i=0;i<n;i++)cin>>p[i].x>>p[i].y>>p[i].z;
  for(int i=0;i<n;i++){
    q[i].x = p[i].x;
    q[i].id = i;
    q[i+n].x = p[i].y;
    q[i+n].id = i;
  }
  sort(q,q+n);
  sort(q+n, q+n+n);
  for(int i=0;i<=n;i++)ans[i] = 1000000000LL * 1000000000LL;
  dfs(0, 0);
  for(int i=0;i<=n;i++)cout<<ans[i]<<endl;
  return 0;
}

Measured memory_bytes: 3572
n = int(input())

a = []

for i in range(n):
  	# input as str
	s, p = input().split()
    # p -> integer
	p = int(p)
    # create list
	a.append((s, p, i+1))

# sort
a.sort(key=lambda x:x[1], reverse=True)

# sort
a.sort(key=lambda x:x[0])

# output
for i in range(n):
	print(a[i][2])

Measured memory_bytes: 3060
def mapt(fn, *args):
    return tuple(map(fn, *args))

def main():
    n, k = mapt(int, (input().split(" ")))
    a = sorted(mapt(int, input().split(" ")))
    if k >= len(a): print(0); exit()
    while k > 0:
        a.pop()
        k -= 1
    print(sum(a))
    
main()

Measured memory_bytes: 31584
#include <stdio.h>
int main()
{
    int i,count=0,x,y,z;
    scanf("%d %d %d",&x,&y,&z);
    for(i=x;i<=y;i++)
    {
        if(z%i==0)
        count++;
    }
    printf("%d\n",count);


    return 0;
}



Measured memory_bytes: 2128
#include <stdio.h>

int main(void){
   
   int a;
   char s[20];
   
   scanf("%d",&a);
   scanf("%s",s);
   
   if (a < 3200) {
      printf("red\n");
   }
   else {
      printf("%s\n",s);
   }
   
   return 0;
}


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

using namespace std;

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

    vector<int> h(n);
    for (int i = 0; i < n; ++i) {
        cin >> h[n - 1 - i];
    }

    int ans = 0;
    int curr = 0;
    for (int i = 1; i < n; ++i) {
        if (h[i] >= h[i - 1]) {
            curr++;
        } else {
            curr = 0;
        }
        ans = max(ans, curr);
    }

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


Measured memory_bytes: 640
// -*- coding: utf-8 -*-
// Last-Updated : <2014/06/20 08:17:51 by samui>

#include <algorithm>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <bitset>

#define MP(a, b) std::make_pair(a, b)
#define X first
#define Y second
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); ++(i))
#define rer(i,l,n) for(int (i) = l; (i) <= (int)(n); ++(i))
#define reu(i,l,n) for(int (i) = l; (i) < (int)(n); ++(i))
template<typename T,typename U> inline void amin(T &x,U y){ if(y<x) x = y;}
template<typename T,typename U> inline void amax(T &x,U y){ if(x<y) x = y;}
template<typename TYPE,std::size_t SIZE>
std::size_t len(const TYPE (&array)[SIZE]){return SIZE;}

// 幾何ライブ
typedef long double LD;
const LD INF = 1e100;
const LD EPS = 1e-8;
const LD PI = acos(-1);
typedef std::pair<LD,LD> PLD;
typedef std::vector<std::pair<LD,LD>> VPLD2;

class Point{
public:
  LD x,y;
  Point(LD x = 0,LD y = 0): x(x),y(y){ };
  Point operator + (Point p) {return Point(x+p.x,y+p.y);};
  Point operator - (Point p) {return Point(x-p.x,y-p.y);};
  Point operator * (LD a) {return Point(x*a,y*a);};
  Point operator / (LD a) {return Point(x/a,y/a);};
  LD abs(){return std::sqrt(x*x+y*y);};
  Point unit(){LD u = abs();return Point(x,y)/u; };
};
typedef Point Vector2D;
LD dotProduct(const Vector2D a,const Vector2D b){
  return a.x*b.x+a.y*b.y;
}
LD crossProduct(const Vector2D a, const Vector2D b){return a.x*b.y-a.y*b.x;}
LD angle(Vector2D a,Vector2D b){
  return acos(dotProduct(a,b)/(a.abs()*b.abs()));
}
LD norm(Vector2D a){return a.x*a.x+a.y*a.y;}
Point projection(Point a1,Point a2,Point a3){
  // 点a3にたいする線分a1-a2上への射影をもとめる。
  LD d = dotProduct(a3-a1,a2-a1)/norm(a2-a1);
  return (a1+(a2-a1)*d);
}
Point reflection(Point a1,Point a2,Point a3){
  return (a3+(projection(a1,a2,a3)-a3)*2);
}
int ccw(Point a1,Point a2,Point a3){
  Vector2D a = a2-a1;
  Vector2D b = a3-a1;
  if(crossProduct(a,b) > EPS) return 1; // a1,a2,a3が反時計まわり
  if(crossProduct(a,b) < -EPS) return -1;//a1,a2,a3が時計まわり
  if(dotProduct(a,b) < -EPS) return +2; //a3--a1--a2 で直線
  if(norm(a)< norm(b)) return -2; // a1--a2--a3 の順で直線
  return 0; // a1--a3--a2の順番
}


int main(int argc, char *argv[])
{
  Vector2D c,d;
  int x0,x1,y0,y1;
  std::cin>>x0>>y0>>x1>>y1;
  c = Vector2D(x1-x0,y1-y0);
  int t;
  int a,b;
  std::cin>>t;
  while(t>0){
    std::cin>>a>>b;
    int e = ccw(Point(x0,y0),Point(x1,y1),Point(a,b));
    if(e == 1) std::cout<<"COUNTER_CLOCKWISE"<<std::endl;
    else if(e == -1) std::cout<<"CLOCKWISE"<<std::endl;
    else if(e == 2) std::cout<<"ONLINE_BACK"<<std::endl;
    else if(e == -2) std::cout<<"ONLINE_FRONT"<<std::endl;
    else std::cout<<"ON_SEGMENT"<<std::endl;
    t--;
  }
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <queue>
#include <utility>
#include <tuple>
#include <climits>
using namespace std;
using Int = long long;

int main()
{
    vector<bool> notprime(100001);
    vector<int> sum(100001);
    notprime[0] = notprime[1] = true;
    for (int i = 2; i * i <= 100000; i++) {
        if (notprime[i]) continue;
        for (int j = i + i; j <= 100000; j += i) {
            notprime[j] = true;
        }
    }
    for (int n = 3; n <= 100000; n += 2) {
        bool r = !notprime[n] && !notprime[(n+1)/2];
        sum[n] = sum[n-2] + r;
    }
    int Q; cin >> Q;
    for (int i = 0; i < Q; i++) {
        int l, r; cin >> l >> r;
        cout << sum[r] - sum[l - 2] << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
//such a genius problem!

#include <bits/stdc++.h>

#define FI(i,a,b) for(int i=(a);i<=(b);i++)
#define FD(i,a,b) for(int i=(a);i>=(b);i--)

#define LL long long
#define Ldouble long double
#define PI 3.14159265358979323846264338327950288419

#define PII pair<int,int>
#define PLL pair<LL,LL>
#define mp make_pair
#define fi first
#define se second

using namespace std;

#define mod 1000000007
#define C 2001

int n, a[200005], b[200005];
int grid[4005][4005], dp[4005][4005], ans;

int po(int A, int B){
	int c = 1, d = A;
	while(B){
		if(B & 1) c = 1LL * c * d % mod;
		d = 1LL * d * d % mod;
		B >>= 1;
	}
	return c;
}

int fact[8004], inv[8004];

int ncr(int N, int R){
	return (1LL * fact[N] * inv[R]) % mod * inv[N - R] % mod;
}

int main(){
	fact[0] = inv[0] = 1;
	FI(i, 1, 8000){
		fact[i] = 1LL * fact[i - 1] * i % mod;
		inv[i] = po(fact[i], mod - 2);
	}
	
	scanf("%d", &n);
	FI(i, 1, n){
		scanf("%d %d", &a[i], &b[i]);
		grid[C - a[i]][C - b[i]]--;
		grid[C + a[i]][C + b[i]]++;
	}
	FI(i, 1, 4002) FI(j, 1, 4002){
		dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
		if(grid[i][j] < 0){
			dp[i][j] = (dp[i][j] - grid[i][j]) % mod;
		}
		if(grid[i][j] > 0){
			ans = (ans + 1LL * grid[i][j] * dp[i][j]) % mod;
		}
	}
	FI(i, 1, n) ans = (ans - ncr(2 * (a[i] + b[i]), 2 * b[i])) % mod;
	ans = 1LL * ans * po(2, mod - 2) % mod;
	printf("%d\n", (ans + mod) % mod);
	return 0;
}


Measured memory_bytes: 126976