akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n, k, a[200100], i, ch=1, seki[200100]={1};
    cin >> n >> k;
    for(i=0;i<n;i++){
        cin >> a[i];
    }
    for(i=k;i<n;i++){
        if(a[i]>a[i-k]) cout << "Yes" <<endl;
        else cout << "No" <<endl;
    }
    return 0;
}

Measured memory_bytes: 5196
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
set<string> words;

int main()
{
	words.clear();
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N; cin >> N;
	vector<string> S(N);
	rep (i, N) cin >> S[i];

	rep (i, N){
		int n = S[i].length();
		for (int len = 1; len <= min(4,n); ++len){
			for (int j = 0; j < n; ++j){
				string t = S[i].substr(j, len);
				words.insert(t);
			} // end for
		} // end for
	} // end rep

	for (int i = 0; i < 27; ++i){
		for (int j = 0; j < 27; ++j){
			for (int k = 0; k < 27; ++k){
				for (int m = 0; m < 26; ++m){
					string s = "";
					if (i != 0) s += (char)('a' + i - 1);
					if (j != 0) s += (char)('a' + j - 1);
					if (k != 0) s += (char)('a' + k - 1);
					s += (char)('a' + m);
					if (!words.count(s)){
						cout << s << endl;
						return 0;
					} // end if
				} // end for
			} // end for
		} // end for
	} // end for

	return 0;
}

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

int n;
int a[100000];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i] < 0) ++cnt;
  }
  
  if (cnt % 2 == 0) {
    long sum = 0;
    for (int i = 0; i < n; ++i) {
      sum += abs(a[i]);
    }
    cout << sum << endl;
  } else {
    long sum = 0;
    int mn = 1.1e9;
    for (int i = 0; i < n; ++i) {
      sum += abs(a[i]);
      mn = min(mn, abs(a[i]));
    }
    cout << sum - 2 * mn << endl;
  }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL)
#define PI pair<int,int>
#define ff first
#define ss second
#define MOD 1000000007
int32_t main()
{
    boost;
   /* #ifndef ONLINE_JUDGE
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
    #endif // ONLINE_JUDGE
	*/
    int n;
    cin>>n;
    float ans=0.0;
    float e=n/2;
    float o=n-e;
    cout<<((float)o/n)<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
//#define mp make_pair
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

struct UFT{ //O(loga(n))
    int n;
    vi d, r;
    UFT(int n) : n(n), d(n, -1), r(n, 0){};
    int root(int i){
        if(d[i] < 0) return i;
        return d[i] = root(d[i]);
    }
    bool same(int x, int y){
        return root(x) == root(y);
    }
    bool unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y) return false;
 
        if(r[x] < r[y]) swap(x, y);
        else if(r[x] == r[y]) r[x]++;
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    int size(int i){
        return -d[root(i)];
    }
};

int main(){
	int n, m;
	cin>>n>>m;
	map<int, int> mp;
	UFT u(1e5+10);
	rep(i, n){
		int k;
		cin>>k;
		rep(j, k){
			int l;
			cin>>l;
			if(mp.count(l)){
				u.unite(mp[l], i);
			}
			else{
				mp[l] = i;
			}
		}
	}
	cout<<(u.size(0)==n?"YES":"NO")<<endl;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;


int main(){
  string s; cin >> s;
  int sz=s.size();

  char a='0',b='1';
  int acnt=0,bcnt=0;
  rep(i,sz){
    if(s[i]!=a){acnt++;}
    if(s[i]!=b){bcnt++;}
    swap(a,b);
  }
  cout << min(acnt,bcnt) << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
int a[1000001],n;
long long kq=1;
const int m=1e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for (int i=2;i<=n;i++)
    {
        int l=i;
        for (int j=2;j<=sqrt(i);j++)
        {
            while (l%j==0)
            {
                l/=j;
                a[j]++;
            }
            if (l==1) break;
        }
        if (l!=1) a[l]++;
    }
    for (int i=1;i<=n;i++) {kq*=(a[i]+1);kq%=m;}
    cout << kq;
}


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

const int MAXN=200000;

int  main()
{   
	int a[MAXN],n;
	cin>>n;
	for(int i=0;i<n;i++)
        cin>>a[i];
	int maxv=-2000000000;
	int minv=a[0];
	for(int i=1;i<n;i++)
	{
    maxv=max(maxv,a[i]-minv);
	minv=min(minv,a[i]);
	}
	cout<<maxv<<endl;
	return 0;
}

Measured memory_bytes: 3868
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
	int n, k;
	int a[123456];
	for (;;) {
		scanf("%d %d", &n, &k);
		if (!n && !k) break;
		rep(i, n) scanf("%d", &a[i]);

		long long int ps = 0;
		rep(i, k) ps += a[i];

		long long int big = ps;
		for (int i = 0; i < n - k; i++) {
			ps -= a[i];
			ps += a[i + k];
			big = max(ps, big);
		}

		printf("%lld\n", big);
	}

	return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(m+1);
    for(int i = 0; i < n; i++)
    {
        int k;
        cin >> k;
        for(int j = 0; j < k; j++)
        {
            int b;
            cin >> b;
            a[b]++;
        }
    }
    int count = 0;
    for(int i = 0; i < m+1; i++)
    {
        if(a[i] == n) count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)


long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

int main()
{
    fast_cin;
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif


    ll K,N;
    cin>>K>>N;

    vector<ll> A(2*N);

    vector<ll> B;

    for(ll i=0;i<N;i++){
        cin>>A[i];
        //if(A[i]==0)
            //A[i]=K;
       // A.push_back(A[i]);
       A[i+N]=A[i];
       //if(A[i+N]==0)
     //   A[i+N]=K;
    }

 
    ll M=2*N;
    for(ll i=0;i<M-1;i++){
        if(A[i]<=A[i+1])
        B.push_back(abs(A[i]-A[i+1]));
        else B.push_back(K-abs(A[i]-A[i+1]));
    }

    // for(ll i=0;i<A.size();i++){
    //     cout<<A[i]<<" ";
    // }
    // cout<<"\n";
    //   for(ll i=0;i<B.size();i++){
    //     cout<<B[i]<<" ";
    // }
    // cout<<"\n";

    ll m=B.size();
    ll q=m/2;

    ll add=0;
    for(ll i=0;i<q;i++){
        add+=B[i];
    }
    ll ans=add;
    for(ll i=q;i<m;i++){
        add=abs(add+B[i]-B[i-q]);
        ans=min(ans,add);
    }
    cout<<ans<<"\n";


}


Measured memory_bytes: 10568
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;

int main(){
  ll n,cnt=0;long double ans=0;cin>>n;
  vll x(n),y(n),m(n);
  rep(i,0,n){cin>>x[i]>>y[i];m[i]=i;}
  do{
    rep(i,0,n-1) {
      ans+=pow(pow(x[m[i+1]]-x[m[i]],2)+pow(y[m[i+1]]-y[m[i]],2),0.5);
    }
    cnt++;
  }while(next_permutation(m.begin(),m.end()));
  cout<<fixed<<setprecision(10)<<ans/cnt<<endl;
}


Measured memory_bytes: 256
N = int(input())
a=list(map(int,input().split()))
b=[0]*8
x=0
for i in range(0,N):
    if a[i]>=3200:
        x=x+1
        continue
    else:
        b[a[i]//400]=1
y=x
for i in range(0,8):
    x=x+b[i]
if x-y==0:
    print(1,x)
else:
    print(x-y,x)

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<array>
#include<deque>
#include<queue>
#include<map>
#include<cmath>
#include<stdio.h>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::array;
using std::queue;
using std::deque;
using std::priority_queue;
using std::multimap;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;
using std::sin;
using std::cos;
using std::log;

using lli = long long int;
using ulli = unsigned long long int;

#define INF 999999999;
#define MOD 1000000007;
#define PI 3.141592653589793;

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int A, P;


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

	cin >> A >> P;
	cout << (A*3+P)/2;



	return 0;
}


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

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

    if (n % 2 == 0) {
        cout << 0.5 << endl;
    } else {
        double a = ((double)n+1)/2;
        cout << a/(double)n << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
using namespace std;
 
int main(){
    double a,b,c,d,e,f,x,y;
    while(cin >> a >> b >> c >> d >> e >> f){
        double detA;
        detA = a * e - b * d;
        x = (c * e - f * b) / detA;
        y = (a * f - c * d) / detA;
        cout << fixed << setprecision(3) << x + 0.0001 << " " << setprecision(3) << y + 0.0001 << endl;
    }
}

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

using namespace std;

const int INF = 1e9 + 5;

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

	int N;
	cin >> N;

	vector<int> h(N);
	for (int i = 0; i < N; i++)
		cin >> h[i];
	
	vector<int> dp(N, INF);
	
	dp[0] = 0;

	for (int i = 1; i < N; i++) {
		int sum1 = INF, sum2 = INF;
		if (i - 1 >= 0)
			sum1 = dp[i-1] + abs(h[i] - h[i - 1]);
		if (i - 2 >= 0)
			sum2 = dp[i - 2] + abs(h[i] - h[i - 2]);
		dp[i] = min(sum1, sum2);
	}

	cout << dp[N-1] << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt() ;
		int k = sc.nextInt();
		String s = sc.next();
      	int i ;
     
  		String[] str = s.split("");
		String temp = str[k-1];
      
      	String  answer[] = new String[n] ;
	
      	for(i = 0; i <= n-1 ; i++){
        	if(i == k-1){
              	answer[i] = temp.toLowerCase();
            }else{
              	answer[i] = str[i];
        	}
        }
      	String r = String.join("", answer);
      	System.out.println(r);
	}
}

Measured memory_bytes: 21844
/*  
    ┬┴┬┴┤(･_├┬┴┬┴ hiding from those WAs
*/

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

void ngk(){
    string s;
    cin >> s;
    int q;
    cin >> q;
    string beg, end;
    bool rev = 0;
    while(q--){
    	int type;
    	cin >> type;
    	if (type == 1)
    		rev ^= 1;
    	else{
    		int f; char c;
    		cin >> f >> c;
    		if (rev == 0){
    			if (f == 1)
    				beg.push_back(c);
    			else
    				end.push_back(c);
    		}
    		else{
    			if (f == 2)
    				beg.push_back(c);
    			else
    				end.push_back(c);
    		}
    	}
    }
	reverse(beg.begin(), beg.end());
	s = beg + s + end;
    if (rev)	reverse(s.begin(), s.end());
    cout << s;
}

int main(int argc, char *argv[]){
    iostream::sync_with_stdio(0);
    int test = 1;
    while(test--){
        ngk();
    }
    return 0;
}

Measured memory_bytes: 1200
#include <iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    
    if(a<=b){
        if(b<=c){cout<<a<<" "<<b<<" "<<c<<endl;}
        else{if(a<=c){cout<<a<<" "<<c<<" "<<b<<endl;}
             else{cout<<c<<" "<<a<<" "<<b<<endl;}}
    }
    else{
         if(a<=c){cout<<b<<" "<<a<<" "<<c<<endl;}
        else{if(b<=c){cout<<b<<" "<<c<<" "<<a<<endl;}
             else{cout<<c<<" "<<b<<" "<<a<<endl;}}
        
    }
    
    return 0;
}


Measured memory_bytes: 3072
package main

import(
  "fmt"
)

func main() {
  var K int
  var lunlunNum int
  var i int
  fmt.Scan(&K)

  q := make([]int, 0)
  for i=1; i<=9; i++ {
	q = append(q,i)
  }
  
  for i:=1; i<K; i++ {
	if q[0]%10 == 0  {
	  q = append(q, q[0]*10 + q[0]%10)
	  q = append(q, q[0]*10 + q[0]%10 + 1)
	} else if q[0]%10 == 9 {
	  q = append(q, q[0]*10 + q[0]%10 - 1)
	  q = append(q, q[0]*10 + q[0]%10)
	} else {
	  q = append(q, q[0]*10 + q[0]%10 - 1)
	  q = append(q, q[0]*10 + q[0]%10)
	  q = append(q, q[0]*10 + q[0]%10 + 1)
	}
	q = q[1:]
  }
  lunlunNum = q[0]
//  for i:= range q{
//	fmt.Println(q[i])
//  }



  fmt.Println(lunlunNum)
}


Measured memory_bytes: 6272
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<vector>
#include<fstream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<cmath>
#include<typeinfo>

using namespace std;
#define REP(i,m,n) for(int i=m;i<n;++i)
#define REPll(i,m,n) for(ll i=m;i<n;++i)
#define INF 10000000000000000
#define MOD 1000000007
#define ll long long
#define mp make_pair
#define all(v) v.begin(),v.end()

int main(){
	vector<int>v;
	v.assign(3, 0);
	int n;
	cin >> n;
	int a, b;
	cin >> a >> b;
	REP(i, 0, n) {
		int tmp;
		cin >> tmp;
		if (tmp <= a) {
			v[0]++;
		}
		else if (b < tmp) {
			v[2]++;
		}
		else {
			v[1]++;
		}
	}
	cout << min(min(v[0], v[1]), v[2])<<endl;
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int ans = 0;

    for(int i = 0; i <= 3000; i++) {
        for(int j = 0; j <= 3000; j++) {
            if(!((N - i*R - j*G)%B) && N >= i*R + j*G) {
                ans++;
            }
        }
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3628
def gcd(a,b): 
    if(b==0): 
        return a 
    else: 
        return gcd(b,a%b)


N = int(input())

A = list(map(int, input().split()))
a = A[0]
for i in range(1, len(A)):
    a = gcd(a, A[i])

print(a)



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

using namespace std;
using ll = long long;

int main() {
    int x, y;
    cin >> x >> y;
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> p(a), q(b), r(c);
    for(int i = 0; i < a; ++i) cin >> p.at(i);
    for(int i = 0; i < b; ++i) cin >> q.at(i);
    for(int i = 0; i < c; ++i) cin >> r.at(i);
    sort(p.rbegin(), p.rend());
    sort(q.rbegin(), q.rend());
    vector<int> d;
    for(int i = 0; i < x; ++i) d.push_back(p.at(i));
    for(int i = 0; i < y; ++i) d.push_back(q.at(i));
    for(int i = 0; i < c; ++i) d.push_back(r.at(i));
    sort(d.rbegin(), d.rend());
    ll ans = 0;
    for(int i = 0; i < x+y; ++i) ans += d.at(i);
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 3572
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
#include<set>
#include<queue>
#include<deque>
#include<iomanip>
#include<sstream>
#include<cmath>
#include<tuple>
#include<bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(ll i = 1;i <=  n; i++)
#define rrep(i,n) for(ll i = n -1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
typedef long long int ll;
typedef long double ld;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
int main(void) {
	int n, m,p,q; cin >> n >> m;
	vector<ll> a(n+1, 0),b(n+1,0);
	rep(i, m) {
		cin >> p >> q; p--; q--;
		a[p]++; a[q]++;
	}
	rep(i, n) {
		if (a[i] % 2 == 1) {
			cout << "NO" << endl;
			return 0;
		}
	}cout << "YES" << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
 
using namespace std;
 
#define INF 1000000007
#define LINF 1000000000000000007
 
typedef long long ll;
typedef pair<ll,ll> P;


int x;

int main(){
	cin >> x;
	
	if(x == 3 || x == 5 || x == 7){
		cout << "YES" << endl;
	}
	else cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        static int Main(string[] args)
        {
            new Program().Process();

            return 0;
        }

        private CommonInput cin;

        private void Process()
        {
            this.cin = new CommonInput();

            int n;

            int a, b, c, d, count;

            while (true)
            {
                // ??\?????????????????§????????¨??????????????\??????????????????
                this.cin.GetLine();
                count = 0;

                if (this.cin.Line == null)
                    break;

                n = this.cin.GetNextToInt();

                if (n < 37)
                {
                    for (a = 0; a < 10; a++)
                    {
                        for (b = 0; b < 10; b++)
                        {
                            for (c = 0; c < 10; c++)
                            {
                                for (d = 0; d < 10; d++)
                                {
                                    if (a + b + c + d == n)
                                        count++;
                                }
                            }
                        }
                    }
                }

                Console.WriteLine("{0}", count);
            }
        }
    }

    public class CommonInput
    {
        public CommonInput()
        {
            this._s = new string[0];
            this._i = 0;
        }

        public string Line { get; set; }
        private string[] _s;
        private int _i;
        private char[] _sep = { ' ' };

        public void GetLine()
        {
            this._i = 0;
            do
            {
                this.Line = Console.ReadLine();
            } while (this.Line == "");

            if (this.Line != null)
                this._s = this.Line.Split(this._sep, StringSplitOptions.RemoveEmptyEntries);
        }

        public string GetNext()
        {
            if (this._i < this._s.Length)
                return this._s[this._i++];

            this.GetLine();

            return this._s[this._i++];
        }

        public int GetNextToInt()
        {
            return int.Parse(this.GetNext());
        }

        public long GetNextToLong()
        {
            return long.Parse(this.GetNext());
        }

        public double GetNextToDouble()
        {
            return double.Parse(this.GetNext());
        }
    }
}

Measured memory_bytes: 5640
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#pragma warning (disable: 4996)

long long N, M, S[1 << 18];
long long L[1 << 18], R[1 << 18];
pair<long long, long long> A[1 << 18];

vector<pair<int, int>> X[1 << 18];
vector<int> G;
bool used[1 << 18];

void dfs(int pos) {
	used[pos] = true;
	for (int i = 0; i < X[pos].size(); i++) {
		if (used[X[pos][i].first] == true) continue;

		dfs(X[pos][i].first);
		if (S[X[pos][i].first] == 1) {
			S[X[pos][i].first] = 0;
			S[pos] ^= 1;
			G.push_back(X[pos][i].second);
		}
	}
}

int main() {
	scanf("%lld%lld", &N, &M);
	for (int i = 0; i < N; i++) scanf("%lld%lld", &A[i].first, &A[i].second);
	for (int i = 0; i < M; i++) scanf("%lld%lld", &L[i], &R[i]);
	sort(A, A + N);
	for (int i = 0; i < M; i++) {
		int pos1 = lower_bound(A, A + N, make_pair(L[i], 0LL)) - A;
		int pos2 = lower_bound(A, A + N, make_pair(R[i] + 1LL, 0LL)) - A;
		X[pos1].push_back(make_pair(pos2, i));
		X[pos2].push_back(make_pair(pos1, i));
	}
	for (int i = 0; i < N; i++) {
		if (A[i].second != A[i + 1].second) S[i + 1] = 1;
		else S[i + 1] = 0;
	}
	S[0] = A[0].second;

	// ここから本質
	for (int i = 0; i <= N; i++) {
		if (used[i] == true) continue;
		dfs(i);
		if (S[i] == 1) { cout << "-1" << endl; return 0; }
	}

	// 答えを出力
	sort(G.begin(), G.end());
	cout << G.size() << endl;
	for (int i = 0; i < G.size(); i++) { if (i) cout << " "; cout << G[i] + 1; }
	cout << endl;
	return 0;
}

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



int main(){
  int n;
  cin>>n;
  vector<int>l(100010,0);
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(a>=n){
      cout << 0;
      return 0;
    }
    l.at(a)++;
  }
  bool ans=true;
  if(n%2!=0){
    for(int i=0;i<n;i++){
      if(i==0){
        if(l.at(0)!=1){
          ans =false;
        }
      }
      else if(i%2!=0){
        if(l.at(i)!=0){
          ans=false;
        }
      }
      else if(i%2==0){
        if(l.at(i)!=2){
          ans=false;
        }
      }
    }
  }
  if(n%2==0){
    for(int i=0;i<n;i++){
      if(i%2!=0){
        if(l.at(i)!=2){
          ans=false;
        }
      }
      else if(i%2==0){
        if(l.at(i)!=0){
          ans=false;
        }
      }
    }
  }
  if(ans!=true){
    cout << 0 ;
    return 0;
  }
  long ans2=1;
  for(int i=0;i<n/2;i++){
    ans2*=2;
    ans2%=1000000000+7;
  }
  cout <<ans2;

  
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 50;
const int INF = 19191919;

int main(){
    int a[N][N]={}, b[N][N]={}, c[N][N]={};
    int H,W,h,w;

    cin >>H >>W;
    rep(i,H)rep(j,W) cin >>a[i][j];
    rep(i,H)rep(j,W) cin >>b[i][j];
    cin >>h >>w;
    rep(i,h)rep(j,w) cin >>c[i][j];

    int ans = -INF;
    rep(i,H-h+1)rep(j,W-w+1){
        bool ok = true;
        rep(y,h)rep(x,w)if(b[i+y][j+x] != c[y][x]) ok = false;
        if(!ok) continue;
        int t = 0;
        rep(y,h)rep(x,w) t += a[i+y][j+x];
        ans = max(ans, t);
    }

    if(ans == -INF) cout << "NA" << "\n";
    else cout << ans << "\n";
    return 0;
}



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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  string s;cin>>s;

  int cnt=0;
  for(int i=0;i<s.size()/2;i++){
    if(s[i]!=s[s.size()-i-1])cnt++;
  }
  cout<<cnt<<endl;

  return 0;
}


Measured memory_bytes: 256
o = input()
e = input()
o_count = 0
e_count = 0
ans = ''
for i in range(len(o) + len(e)):
    if i % 2 == 1:
        ans += e[e_count]
        e_count += 1
    else:
        ans += o[o_count]
        o_count += 1
print(ans)


Measured memory_bytes: 2940
import java.util.*;
class Main{
	public static void main(String args[]){
    	Scanner s = new Scanner(System.in);
      	int health = s.nextInt();
      	int numMoves = s.nextInt();
      	int sumMoves = 0;
      	for(int i=0;i<numMoves;i++){
        	sumMoves += s.nextInt();
        }
      	if(sumMoves>=health){
        	System.out.print("Yes");
        }
      	else{
        	System.out.print("No");
        }
    }
}

Measured memory_bytes: 48196
#include <cassert>
#include <iostream>
#include <functional>
#include <iomanip>
#include <set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <deque>
#include <algorithm>
#include  <cstring>
#include <string>
#include <cmath> 
using namespace std;
typedef long long LL;
const int MAX = 210000;
const LL base = 1e9 + 7;


struct Node {
	int x, y, w;
};

double dp[2][3010];
void solve() {

	double result = 0;
	int n;

	cin >> n;
	double p;
	dp[0][0] = 1;

	for (int i = 0; i < n; ++i) {
		cin >> p;
		double up = 1 - p;
		int t = i % 2;
		int nt = (i + 1) % 2;
		fill(dp[nt], dp[nt] + 3010, 0);
		for (int j = 0; j <n; ++j) {
			dp[nt][j+1] += dp[t][j] * p;
			dp[nt][j ] += dp[t][j] * up;
		}
	}
	for (int i = n / 2 + 1; i <= n; ++i) {
		result += dp[n%2][i];
	}
	cout << setprecision(12)<< result << endl;

}

int main() {
	const int inId = 0;
	const int outId = 0;
	if (inId>0) {
		cerr << "redirect stdin to input " << inId << endl;
		string s = "input";
		s += to_string(inId);
		s += ".txt";
		auto r = freopen(s.c_str(), "r", stdin);	
		if (r == nullptr) {
			cerr<< "invalid input file "<< s;
		}
	}
	if (outId>0) {
		cerr << "redirect stdout to stdout " << outId << endl;
		string s = "stdout";
		s += to_string(outId);
		s += ".txt";
		auto r = freopen(s.c_str(), "w", stdout);
		if (r == nullptr) {
			cerr<< "invalid output file "<< s;
		}		
	}
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // close sync between cout and printf
	cout.precision(10);
	solve();
}
 

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(x) cerr <<__LINE__<< ": " <<#x<< " = " << x << endl
#define debug_vec(v) cerr<<__LINE__<<": "<<#v<<" = ";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n, ans = 0;
    cin >> n;
    vector<pii> A[n];
    rep(i, n) {
        int a;
        cin >> a;
        rep(j, a) {
            int x, y;
            cin >> x >> y;
            x--;
            A[i].push_back({x, y});
        }
    }
    rep(bit, 1 << n) {
        rep(i, n) {
            if ((bit >> i & 1) == 0) continue;
            rep(j, A[i].size()) {
                int x, y;
                tie(x, y) = A[i][j];
                if ((bit >> x & 1) != y) {
                    goto end;
                }
            }
        }
        chmax(ans, __builtin_popcount(bit));
        end:;
    }
    cout << ans << endl;
}

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


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

using namespace std;

#define int long long

int maxi=1000000000000000;

vector < int > waste[100005];

int row[100005];

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

        vector < int > a(n);
        int ans=1000000000000;
        for(int i=0;i<n;i++)
                cin>>a[i];

        for(int i=-100;i<=100;i++)
        {
                int temp=0;
                for(int j=0;j<n;j++)
                {
                        temp+=(a[j]-i)*(a[j]-i);
                }
                ans=min(ans,temp);
        }
        cout<<ans<<endl;

        return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define read(arr,n)	for(int i=0;i<n;i++) cin>>arr[i];
#define print(arr,n) for(int i=0;i<n;i++) cout << arr[i]<<' ';cout << endl;
typedef int int32;
#define int ll

using namespace std;

typedef long long ll;

void solve() {
	ll n;
	cin >> n;
	ll sum = 0;
	for (int i =1 ; i <= n; i++) {
		if ((i%3 != 0) && (i%5 != 0)) {
			sum += i;
		}
	}
	
	cout << sum << endl;
}

int32 main() {
	int t = 1;
	//cin >> t;
	int c = 0;
	while (c < t) {
		solve();
		c++;	
	}
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1 << 21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

const int MAX = 200500;

// fac: 階乗, finv: 階乗の逆元, inv: 逆元
ll fac[MAX], finv[MAX], inv[MAX];

void cominit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;

    for(int i=2; i<MAX; i++){
        fac[i] = fac[i-1]*i%mod;
        inv[i] = mod - inv[mod%i]*(mod/i)%mod;
        finv[i] = finv[i-1]*inv[i]%mod;
    }
}

ll com(int n, int k){
    if (n<k) return 0;
    if (n<0 or k<0) return 0;
    return fac[n] * (finv[k]*finv[n-k]%mod)%mod;
}

// abc132d
int main(){
    ll n, k;
    cin >> n >> k;
    cominit();
    for(ll i=1; i<=k; i++){
        ll ans = 0;
        ans = com(n-k+1, i) * com(k-1, i-1) % mod;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 4992
var input = require("fs").readFileSync("/dev/stdin", "utf8");

var words = input.split('\n');

var N = Number(words[0]);
var S = words[1];

var A_CODE = 'A'.charCodeAt();
var result = '';
for (var i = 0; i < S.length; i++) {
    var charCode = (S[i].charCodeAt() - A_CODE + N) % 26;
    result += String.fromCharCode(A_CODE + charCode);
}
console.log(result);


Measured memory_bytes: 7500
#include <iostream>
#include <vector>
#include <map> 
#include <algorithm>
#include <string.h>

using namespace std;

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

typedef long long int ll;



void pre_process(string p, int *back_table){
    int i = 0, j = -1, length = p.length();
    back_table[0] = -1;

    while(i <= length) { 
        while(j != -1 && p[i] != p[j]) j = back_table[j];
        i++; j++;
        back_table[i] = j;
    }

}

void _search(string p, string t, int *back_table){
    int i = 0, j = 0, length = t.length(), m = p.length();

    while(i <= length){
        while(j != 0 && t[i] != p[j]) j = back_table[j];
        i++; j++;
        if(j == m) { cout << "Pattern at: " << i - j << endl; j = back_table[j]; }
    }
}

int func(int arr[],int n,int m) {
    int maxsum;
    int incl[n];
    int excl[n];
    incl[0] = arr[0];
    excl [0] = 0;
    for(int i=1;i<n;i++) {
        if(i-m-1 >=0) {
            incl[i] = max(incl[i-m-1],excl[i-m-1]) + arr[i];
        }
        else
            incl[i] = arr[i];
        
        excl[i] = max(excl[i-1],incl[i-1]);
        maxsum = max(maxsum,max(incl[i],excl[i]));
    }

    return maxsum;
}

int show(int x, float y){
    return x + y;
}


int show(int x){ return x; }

float fn_(int x = show(2, 3.3)){
    return x;
}

int fn(int x = show(2)){
    return x;
}

int solve(string s, int n){
    int dp[n + 1];
    dp[0] = 0;

    for(int i = 1; i <= n; i++){
        if(i > 1 && s[i - 2] <= '2' && s[i - 1] <= '6')
            dp[i] = dp[i - 1] + dp[i - 2] + 1;
        else
            dp[i] = dp[i - 1];
    }

    for(int i : dp) cout << i << ' ';
    cout << endl;

    return dp[n] + 1;
}

int main() {

    vector<int> v;
    int x; cin >> x;
    v.push_back(x);
    cin >> x;
    v.push_back(x);
    cin >> x;
    v.push_back(x);
    sort(v.begin(), v.end());
    cout << v[0] + v[1] << flush;    
    // for(int i = 0; i < 4; i++){
    //     int elt = a[i];
    //     int j = i - 1;
    //     while(j >= 0 && elt < a[j]){
    //         a[j + 1] = a[j];
    //         j--;
    //     }
    //     a[j + 1] = elt;
    // }

    // for(int i : a) cout << i << ' ';
    // cout << endl;

    return 0;
}

Measured memory_bytes: 256
/*  
   |\_/|
   |* *|
   \_+_/
          */
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

int main(){

  cin.tie(0);     // cout と cin の同期を切る
  ios::sync_with_stdio(false);  /* cの stdioストリーム (printfとか)と*/

  
  int a[12];

  int cnt[100]={ };
  
  for(int i=0;i<12;i++){
    cin>>a[i];

    cnt[a[i]]++;
    
  }

  bool judge=0;
  
  for(int i=0;i<12;i++){

    if(cnt[a[i]]%4!=0){
      judge=1;
    }

  }  

  if(judge){
    cout<<"no"<<endl;
  }else {
    cout<<"yes"<<endl;
  }
  
  return 0;

}



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

int main(void){
    int h, w;
    cin >> h >> w;
    char grid[h+2][w+2];
    for (int i=1; i<=h; i++) for (int j=1; j<=w; j++) cin >> grid[i][j];
    for (int i=1; i<=h; i++){
        for (int j=1; j<=w; j++){
            if (grid[i][j]=='#' && grid[i-1][j]!='#' && grid[i+1][j]!='#' && grid[i][j-1]!='#' && grid[i][j+1]!='#'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main(int argc, const char * argv[]) {
    int A, B, C, D;
    cin >> A;
    cin >> B;
    cin >> C;
    cin >> D;
    
    bool aoki_win = false;
    do {
        // Takahashi no kougeki
        C = C - B;
        if (C <= 0) {
            break;
        }
        // Aoki no kougeki
        A = A - D;
        if (A <= 0){
            aoki_win = true;
            break;
        }
    }while((A > 0) && (C > 0));

    if (!aoki_win) {
        cout << "Yes";
    }else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3624
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
class Program
{
	static void Main(string[] args)
	{
		int x = int.Parse(Console.ReadLine());
		string ans = "NO";
		if (x == 7 || x == 5 || x == 3)
		{
			ans = "YES";
		}
		Console.WriteLine(ans);

	}
}

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

using namespace std;
int val[3][100009];int n ;long long int dp[100009][3];
long long int func(int i , int prev)
{  
	if(i>=n)
	{
		long long int p = 0 ; 
		return(0);
	}
	if(dp[i][prev]!=-1)
	return(dp[i][prev]);
	
	long long int p = 0 ; 
	
	if(prev==0)
	{
		return(dp[i][prev]=max(val[1][i]+func(i+1,1), val[2][i]+func(i+1,2)));
	}
	else if(prev==1)
	{
		return(dp[i][prev]=max(val[0][i]+func(i+1,0), val[2][i]+func(i+1,2)));
	}
	else
	{
		return(dp[i][prev]=max(val[1][i]+func(i+1,1), val[0][i]+func(i+1,0)));
	}
	
}
int main()
{
cin>>n; 
for(int i =0 ; i<n; i++)
{
	scanf("%i%i%i",&val[0][i],&val[1][i],&val[2][i]);
}
memset(dp,-1,sizeof(dp));
long long int ans = max(max(func(0,0),func(0,1)),func(0,2));
cout<<ans;

return(0);
}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define mp make_pair

using namespace std;

typedef long long int64;
typedef vector<int> vi;
typedef pair<int, int> ii;

class TaskB {
 public:
  const int64 MODULO = 998244353;

  void solveOne(istream &in, ostream &out) {
    int a, b, c, d;
    in >> a >> b >> c >> d;
    int h = c - a;
    int w = d - b;
    vector<vector<vector<int64>>> ways(2, vector<vector<int64>>(h + 1, vector<int64>(w + 1)));
    ways[0][h][w] = 1;
    for (int hh = h; hh > 0; --hh) {
      for (int ww = w; ww >= 0; --ww) {
        ways[0][hh][ww] %= MODULO;
        ways[1][hh][ww] %= MODULO;
        ways[0][hh - 1][ww] += ways[0][hh][ww] * (b + ww);
        ways[1][hh][ww] += ways[0][hh][ww];
        if (ww > 0) {
          ways[0][hh][ww - 1] += ways[1][hh][ww];
          ways[1][hh][ww - 1] += ways[1][hh][ww] * (a + hh - 1);
        }
      }
    }
    int64 res = 0;
    for (int ww = w; ww >= 0; --ww) {
      int64 cur = ways[0][0][ww];
      cur %= MODULO;
      for (int i = 0; i < ww; ++i) {
        cur = cur * a % MODULO;
      }
      res = (res + cur) % MODULO;
    }
    out << res << "\n";
  }

  void solve(std::istream &in, std::ostream &out) {
    int nt = 1;
    for (int it = 0; it < nt; ++it) {
      solveOne(in, out);
    }
  }
};


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  TaskB solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 214540
#include<bits/stdc++.h>
using namespace std;
typedef int q;
typedef double w;
typedef string s;
int main(){
    q a,b,c,d,l,e;
    q z,x,f,v,o,n,m,k,j,h;
    cin>>a>>b>>c>>d>>l>>e;
    z=b-a;
    x=c-a;
    f=d-a;
    n=l-a;
    v=c-b;
    o=d-b;
    m=l-b;
    k=d-c;
    j=l-c;
    h=l-d;
    if(z>e||x>e||f>e||n>e||v>e||o>e||m>e||k>e||j>e||h>e)cout<<":(";
    else{cout<<"Yay!";}
return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;} 
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll A(N);
        rep(i, 0, N) cin >> A[i];
        A.push_back(0);

        ll ans = 0;
        // rep(i, 0, N) {
        //         ans += A[i] / 2;
        //         A[i] %= 2;
        // }

        // rep(i, 0, N-1) {
        //         if (A[i] == 1 and A[i+1] == 1) {
        //                 ++ans;
        //                 A[i+1] = 0;
        //         }
        // }

        // rep(i, 0, N-1) {
        //         ll x = min(A[i], A[i+1]);
        //         ans += x;
        //         A[i] -= x;
        //         A[i+1] -= x;
        // }

        // rep(i, 0, N) {
        //         ans += A[i] / 2;
        // }

        // cout << ans << endl;

        ll sm = 0;
        rep(i, 0, N+1) {
                if (A[i] == 0) {
                        ans += sm / 2;
                        sm = 0;
                }
                sm += A[i];
        }

        cout << ans << endl;
}


Measured memory_bytes: 4828
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define mod 1000000007 
ll power(ll n,ll x)
{
	if(n==0)
	return 1; 
	else if(n==1)
		return x;
	ll  y=power(n/2,x);
	y=(y*y)%mod;
	if(n%2)
		y=(y*x)%mod;
	return y;
}
int main ()
{
// 	#ifndef ONLINE_JUDGE
//        freopen("input.txt","r",stdin);
//     freopen("output.txt","w",stdout);
// #endif
	ll n;
	cin>>n;
	if(n<2)
	{
		cout<<0;
		return 0;
	}
	ll z=power(n,10);
	z=(z-(power(n,9)*2)%mod)%mod;
	z=(z+power(n,8))%mod;
	z=(z+mod)%mod;

	cout<<z;
}


Measured memory_bytes: 3632
a = [list(map(int,input().split())) for _ in range(3)]
o = [[0] * 3 for _ in range(3)]
n = int(input())
for _ in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if b == a[i][j]:
                o[i][j] = 1

if sum(o[0]) == 3 or sum(o[1]) == 3 or sum(o[2]) == 3 or o[0][0] == o[1][0] == o[2][0] == 1 or o[0][1] == o[1][1] == o[2][1] == 1 or o[0][2] == o[1][2] == o[2][2] == 1 or o[0][0] == o[1][1] == o[2][2] == 1 or o[0][2] == o[1][1] == o[2][0] == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    x = LI()
    print(x.index(0)+1)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 76472
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <cstdio>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) ((abs((a)-(b)))<EPS)

int a[100001];
int n,l;

bool check(double f){
	double lf=l;
	double rec=0;
//	if(f>=0.4&&f<=0.45){
//		cout<<endl;
//	}
	//bool flag=false;
	for(int j=0;j<3;j++){
		for(int i=1;i<=86400;i++){
			if(j==1&&i==1){
				rec=lf;
			}
			if(j==2&&i==1){
				if(EQ(rec,lf)||rec<lf)return true;
				return false;
			}
//			if(j==1&&a[i]!=0&&!flag){
//				rec=lf;
//				flag=true;
//			}
//			else if(j==2&&a[i]!=0){
//				if(EQ(rec,lf))return true;
//				return false;
//			}
			double b=-a[i]+f;
			lf+=b;
			if(EQ(lf,0)||lf<0)return false;
			lf=min(lf,1.0*l);
		}
	}
	return true;
}

int main(){

	while(cin>>n>>l&&!(n==0&&l==0)){
		memset(a,0,sizeof(a));
		int s,t,u;
		for(int j=0;j<n;j++){
			cin>>s>>t>>u;
			for(int i=s+1;i<=t;i++)a[i]=u;
		}
		double ub=10000000;
		double lb=0;
		int cnt=100;
		while(cnt--){
			double mid=(ub+lb)/2;
			if(check(mid))ub=mid;
			else lb=mid;
		}
		printf("%.10f\n",ub);
	}
	return 0;
}

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

int main ()
{
    vector<pair<double,int> > v1(8);
    vector<pair<double,int> > v2(8);
    vector<pair<double,int> > v3(8);
    vector<pair<double,int> > tmp;
    for (auto &i : v1) cin >> i.second >> i.first;
    for (auto &i : v2) cin >> i.second >> i.first;
    for (auto &i : v3) cin >> i.second >> i.first;
    sort(v1.begin(), v1.end());
    sort(v2.begin(), v2.end());
    sort(v3.begin(), v3.end());

    cout << v1[0].second << " " << v1[0].first << endl;
    cout << v1[1].second << " " << v1[1].first << endl;
    cout << v2[0].second << " " << v2[0].first << endl;
    cout << v2[1].second << " " << v2[1].first << endl;
    cout << v3[0].second << " " << v3[0].first << endl;
    cout << v3[1].second << " " << v3[1].first << endl;

    tmp.push_back(v1[2]);
    tmp.push_back(v1[3]);
    tmp.push_back(v2[2]);
    tmp.push_back(v2[3]);
    tmp.push_back(v3[2]);
    tmp.push_back(v3[3]);

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

    cout << tmp[0].second << " " << tmp[0].first << endl;
    cout << tmp[1].second << " " << tmp[1].first << endl;

    return 0;
}

Measured memory_bytes: 1304
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

int main(){
  double t,x;
  cin>>t>>x;

  printf("%.9f\n", t/x);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#include<map>
#include<cmath>
#include<set>
using namespace std;
#define rep(i,n) for(int i =0;i < n;i++)
int main() {
	int n, m, a, b; int l[51][51];
	rep(i, 51) {
		rep(j, 51) {
			l[i][j] = 0;
		}
	}
	cin >> n >> m;
	rep(i, m) {
		cin >> a >> b;
		l[a][b]++;
		l[b][a]++;
	}
	for(int i = 1;i <= n;i++) {
		int ans = 0;
		for(int j = 1; j <=n;j++)  {
			ans += l[i][j];
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		String word = sc.nextLine();
		int count = 0;

		while(true){
			String S = sc.next();

			if(S.equals("END_OF_TEXT")){
				break;
			}

			String text = S.toLowerCase();

			if(text.equals(word)){
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}
}

Measured memory_bytes: 26224
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int W = scan.nextInt();
    int H = scan.nextInt();
    int x = scan.nextInt();
    int y = scan.nextInt();
    int r = scan.nextInt();

    if ((x - r >= 0) && (x + r <= W) && (y - r >= 0) && (y + r <= H)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 26412
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define flush fflush(stdout)
#define debug printf("Hello\n")
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
int n, m, k, x, y, sum, cnt, ans, a[200005], b[200005];
vector <int>v;
int main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	scanf("%d", &n);
	FOR(i, 1, n) {
		scanf("%d", &a[i]);
	}
	FORD(i, n, 1) {
		if (b[i] % 2 != a[i]) {
			v.pb(i);
			int sq = sqrt(i);
			FOR(j, 1, sq) {
				if (i%j==0) {
					b[j]++;
					b[i/j]++;
				}
			}
			if (sq*sq==i) b[sq]--;
			//FOR(j, 1, n) printf("%d ", b[j]);
			//printf("\n");
		}
	}
	printf("%d\n", v.size());
	for (int i=0; i<v.size(); i++) {
		printf("%d%c", v[i], i==v.size()-1?'\n':' ');
	}
	return 0;
}

Measured memory_bytes: 3192