akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(void)
{
    int N;//そのまま
    int IMORI; //処理の回数
    int N1[300000];
    int counter=0;
    int COUNTER=0;
    int fafafa=0;
    vector <int> super;
    vector <int> supercope;
    vector <vector <int> > sa;
    cin>>N;
    
    for(int i=0;i<N;i++)
    {
        int a;
        cin>>a;
        super.push_back(a);
    }
    for(int i=0;i<N;i++)
    {
        int cope;
        cope=super[i];
        supercope.push_back(cope);
    }
    
    cin>>IMORI;
    
    for(int i=0;i<IMORI;i++)
    {
        int ta,tb;
        vector <int> ha;
        cin>>ta>>tb;
        ha.push_back(ta);
        ha.push_back(tb);
        sa.push_back(ha);
    }
    
    sort(super.begin(),super.end());
    
    for(int i=0;i<N;i++)
    {
        if(super[i]==supercope[i])
        {
            N1[i]=1;
            COUNTER++;
        }
        else
        {
            N1[i]=0;
        }
    }
    
    for(int i=0;i<IMORI;i++)
    {
        if(i==0 && super==supercope)
        {
             fafafa=1;
             break;
        }
        int to,to1;//変換
        int haha;//置物
        to = sa[i][0]-1;
        to1 = sa[i][1]-1;
        if(N1[to]==1)
        {
            N1[to]=0;
            COUNTER--;
        }
        if(N1[to1]==1)
        {
            N1[to1]=0;
            COUNTER--;
        }
        haha=supercope[to];
        supercope[to]=supercope[to1];
        supercope[to1]=haha;
        
        if(supercope[to]==super[to])
        {
            if(N1[to]==0)
            {
                N1[to]=1;
                COUNTER++;
            }
        }
        if(supercope[to1]==super[to1])
        {
            if(N1[to1]==0)
            {
                N1[to1]=1;
                COUNTER++;
            }
        }
        
        if(COUNTER==N)
        {
            break;
        }
        counter++;
    }
    
    if(counter==IMORI)
    {
        cout<<-1<<endl;
    }
    if(counter!=IMORI && COUNTER==N && fafafa==0)
    {
        cout<<counter+1<<endl;
    }
    if(fafafa==1)
    {
        cout<<0<<endl;
    }
}


Measured memory_bytes: 33764
n,a,b = map(int, input().split())
max_ans = 0
min_ans = 0
bigger_num = max([a, b])
smaller_num = min([a, b])

if n - bigger_num >= smaller_num:
    min_ans  = 0
else:
    min_ans = abs(smaller_num - (n - bigger_num))

max_ans = smaller_num

print(max_ans, min_ans)

Measured memory_bytes: 3060
def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y) #再帰定義
n=int(input())
a=list(map(int,input().split()))
l=[0]*n
r=[0]*n
for i in range(1,n):
  if i==1:
    l[1]=a[0]
    r[-2]=a[-1]
  else:
    l[i]=gcd(l[i-1],a[i-1])
    r[-i-1]=gcd(r[-i],a[-i])
g=[0]*n
for i in range(n):
  if l[i]==0 or r[i]==0:
    g[i]=l[i]+r[i]
  else:
    g[i]=gcd(l[i],r[i])
print(max(g))

Measured memory_bytes: 14488
import java.util.*;

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

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int X = sc.nextInt();

		int count = 0;
		for(int i=0; i<=A; i++) {
			for(int j=0; j<=B; j++) {
				int sum = i*500 + j*100;
				int k = (X - sum) / 50;
				if(k > C || k < 0) continue;
				count++;
			}
		}

		System.out.println(count);
	}

	public static void print(Object o) {
		System.out.print(o);
	}

	public static void println(Object o) {
		System.out.println(o);
	}
}

Measured memory_bytes: 23636
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF (1<<30)-1
using ll = long long;
using namespace std;
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; }

int main(){
  int x; cin >> x;
  for(ll b = -1000; b < 1000; b++){
    for(ll a = b+1; a < 1000; a++){
      if(a*a*a*a*a-b*b*b*b*b == x){
        cout << a << " " << b;
        return 0;
      }
    }
  }
  cout << "\n";
  return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}
//long long int ruizyo(long long int aa, long long int bb){
  //  if(aa==0){
    //    return 1;
    //}
    //else if(aa%2==0){
      //  long long int tt=ruizyo(aa/2,bb);
        //return (tt*tt)%MOD;
    //}
    //else{
      //  return (ruizyo(aa-1,bb)*bb)%MOD;
    //}
//}フェルマ－のア


//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

//bool f[100001];//1000000以下の素数を調べよう！
//rrep(i,2,100001){
  //      f[i]=false;
    //}
//rrep(i,2,100001){
  //      if(!f[i]){
    //        for(int j=i+i;j<=100000;j+=i){
      //          f[j]=true;
        //    }
        //}
    //}
    //for(int i=3;i<=100000;i+=2){
      //  if(!f[i]){
        //    c[i]++;
      //  }
   // }

//visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに


long long int n,cnt=0,ans=1,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

//-------------------------↓↓↓↓↓↓----------------------------

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

       cin >> n >> a;
       rep(i,n){
           ans=min(ans*2,ans+a);
       }
       Cout(ans);
       
return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <iterator>
#include <iostream>

using namespace std;

int main()
{
	int N, M;
	int K[32];
	cin >> N >> M;
	vector<vector<int>> prefer;
	prefer.reserve(N);
	for (int i = 0; i < N; ++i) {
		cin >> K[i];
		prefer.push_back(vector<int>(K[i], 0));
		for (int j = 0; j < K[i]; ++j) {
			cin >> prefer[i][j];
		}
		sort(prefer[i].begin(), prefer[i].end());
	}
	vector<int> intersection = prefer[0];
	for (int i = 1; i < N; ++i) {
		vector<int> ws = intersection;
		intersection.clear();
		set_intersection(ws.begin(), ws.end(), 
						 prefer[i].begin(), prefer[i].end(), 
						 back_inserter(intersection));
		sort(intersection.begin(), intersection.end());
	}
	cout << (int)intersection.size() << endl;
	return 0;
}

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

typedef long long ll;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

// bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
//     return arg1.first > arg2.first;
// }

int main(void) {
    string s;
    cin >> s;

    int now=s.at(0), ans=0;
    for(int i=1;i<s.size();i++) {
        now ^= 1;
        if(now!=s.at(i)) ans++;
    }

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


Measured memory_bytes: 512
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;// 998244353;// ;
constexpr long long INF = numeric_limits<LL>::max() / 2;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<vector<LL>>g, rev;
vector<edge>edges;
vector<LL>v;
map<LL, LL>ma;
set<LL>st;
LL h, w, n, m, k, t, s, p, q, last, cnt, sum, ans,a[3][3], b[510000], dp[50000];
string str, ss;
bool f;
char c;
int main() {
	cin >> n;
	cout << (n+1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int sum = in.nextInt() + in.nextInt();
            out.println(sum >= 10 ? "error" : sum);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 22740
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int main()
{
	fast;
	int a,b,c;
	cin>>a>>b>>c;
	if (a+b>=c)
	   cout<<"Yes";
	else
	   cout<<"No";
	return 0;
}

Measured memory_bytes: 256
// Karm Kar, Phal Ki Chinta na Kar:)
#include <iostream>
#include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long int ll;
#define MOD 1000000007
int main()
{
    ll a,b;
    cin>>a>>b;
    ll res=0;
    res=max(res,a-2*b);
    cout<<res;

}



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

int main(){
    stack<int> st;
    int tmp;
    
    while(cin >> tmp){
        if(tmp == 0){
            cout << st.top() << endl;
            st.pop();
        }else{
            st.push(tmp);
        }
    }
    
    return 0;
}

Measured memory_bytes: 3056
//package Atcoder;
import java.util.*;
import java.io.*;
public class Main
{
	static final int mod=(int)1e9+7;
	static final int inf=(int)1e9;
	static final long INF=(long)1e18;
	public static void main(String[] args)
	{
		FastScanner fs=new FastScanner();
		int s=fs.nextInt();
		int w=fs.nextInt();
		if(w>=s)
		{
			System.out.println("unsafe");
		}
		else
		{
			System.out.println("safe");
		}
	}
}
class FastScanner 
{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		public String next() 
		{
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
			
		}
		
		long pow(long x,long n)
		{
			long res=1;
			while(n>0)
			{
			   	if(n%2!=0)
			   	{
			   		res=(res*x);n--;
			   	}
			   	else
			   	{
			   		x=(x*x);n/=2;
			   	}
			}
			return res;
		}
		int gcd(int a,int b)
		{
			if(b==0)
			{
				return a;
			}
			return gcd(b,a%b);
		}
		long longgcd(long a,long b)
		{
			if(b==0)
			{
				return a;
			}
			return longgcd(b,a%b);
		}
		int[] sort(int arr[])
		{
			ArrayList<Integer> list = new ArrayList<Integer>();
			for(int i:arr)list.add(i);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)
			{
				arr[i]=list.get(i);
			}
			return arr;
		}
		char[] charsort(char arr[])
	        {
	    	ArrayList<Character> list = new ArrayList<>();
	    	for(char c:arr)list.add(c);
	    	Collections.sort(list);
	    	for(int i=0;i<list.size();i++)
	    	{
	    		arr[i]=list.get(i);
	    	}
	    	return arr;
	        }
		long[] longsort(long arr[])
		{
			ArrayList<Long> list = new ArrayList<Long>();
			for(long i:arr)list.add(i);
			Collections.sort(list);
			for(int i=0;i<arr.length;i++)
			{
				arr[i]=list.get(i);
			}
			return arr;
		}
		public int nextInt() 
		{
			return Integer.parseInt(next());
		}
		public int[] readArray(int n)
		{
			int[] arr=new int[n];
			for (int i=0; i<n; i++) arr[i]=nextInt();
			return arr;
		}	
		public long nextLong()
		{
			return Long.parseLong(next());
		}
		public long[] longreadArray(int n) 
		{
			long[] a=new long[n];
			for (int i=0; i<n; i++) a[i]=nextLong();
			return a;
		}
}

Measured memory_bytes: 32572
#include <stdio.h>
#include <string.h>

int main()
{
  int K, len;
  char S[101];

  scanf("%d", &K);
  scanf("%s", S);

  len = strlen(S);

  if(len <= K){
    printf("%s", S);
  }
  else{
    for(int i = 0; i < K; i++){
      printf("%c", S[i]);
    }
    printf("...\n");
  }

  return 0;
  }


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

int main() {
  ios_base::sync_with_stdio(false);

  int y, a, b;
  cin >> y;
  a = y / 100, b = y % 100;
  int t1 = ((a > 0) && (a <= 12));
  int t2 = ((b > 0) && (b <= 12));
  if ( t1 && !t2 )
    cout << "MMYY" << endl;
  else if ( !t1 && t2 )
    cout << "YYMM" << endl;
  else if ( t1 && t2 )
    cout << "AMBIGUOUS" << endl;
  else
    cout << "NA" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll dp1[2010][2010];
ll dp2[2010][2010];
ll dp3[2010][2010];
ll dp4[2010][2010];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll h,w;
    cin>>h>>w;
    vector<string>s;
    string s1;
    for(ll i=0;i<h;i++)
    {
        cin>>s1;
        s.push_back(s1);
    }
    for(ll i=1;i<=h;i++)
    {
        for(ll j=1;j<=w;j++)
        {
            if(s[i-1][j-1]=='#')
                dp1[i][j]=0;
            else
                dp1[i][j]=dp1[i][j-1]+1;
        }
        for(ll j=w;j>=1;j--)
        {
            if(s[i-1][j-1]=='#')
                dp2[i][j]=0;
            else
                dp2[i][j]=dp2[i][j+1]+1;
        }
    }
    for(ll j=1;j<=w;j++)
    {
        for(ll i=1;i<=h;i++)
        {
            if(s[i-1][j-1]=='#')
                dp3[i][j]=0;
            else
                dp3[i][j]=dp3[i-1][j]+1;
        }
        for(ll i=h;i>=1;i--)
        {
            if(s[i-1][j-1]=='#')
                dp4[i][j]=0;
            else
                dp4[i][j]=dp4[i+1][j]+1;
        }
    }
    ll maxi=0;
    for(ll i=1;i<=h;i++)
    {
        for(ll j=1;j<=w;j++)
        {
            maxi=max(maxi,dp1[i][j]+dp2[i][j]+dp3[i][j]+dp4[i][j]-3);
        }
    }
    cout<<maxi;
}																		

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

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

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

int main()
{
    ll A, B;
    cin >> A >> B;
    cout << lcm(A, B) << endl;

    return 0;
}

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

int main(){
  vector<int> A(20);
  vector<int> B(40);
  rep(i,2) cin >> A[i] >> B[i];
  if(A[0] != A[1]) cout << 1 << endl;
  else if (A[0] == A[1]) cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<int> N;
  invec<int> A(N);
  
  unordered_set<int> s;
  
  for (auto&& i : A) {
    if (s.count(i))
      return "NO";
    else
      s.insert(i);
  }


  return "YES";
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(0) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}


Measured memory_bytes: 9288
xv=$<.map{|x|x.split.map &:to_i}
n,c=xv.shift
                                                                                                                                                             
xvR=xv.reverse.map{|x,v|[c-x,v]}
xv.unshift([0,0])
xvR.unshift([0,0])

r=0; cumsumX=xv  .map{|x,v|(r+=v)-x}
r=0; cumsumXR=xvR.map{|x,v|(r+=v)-x}
r=0; cummaxX=cumsumX  .map{|x|x<r ? r: r=x}
r=0; cummaxXR=cumsumXR.map{|x|x<r ? r: r=x}

p [cumsumX .map.with_index{|x,k|x-xv[k][0]+cummaxXR[n-k]}.max,
 cumsumXR.map.with_index{|x,k|x-xvR[k][0]+cummaxX[n-k]}.max].max


Measured memory_bytes: 18940
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}



void solve()
{
    int n,m,t,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    // int a,b;
    // cin>>n;
    int a[3][3];
    rep(i,0,3) rep(j,0,3) cin>>a[i][j];
    cin>>n;
    map<int,int> occ;
    while(n--) 
    {
        cin>>t;
        occ[t]++;
    }
    rep(i,0,3)
    {
        count=0;
        rep(j,0,3)
        {
            if(occ[a[i][j]]) count++;
        }
        if(count==3)
        {
            cout<<"Yes";
            return;
        }
    }
    rep(j,0,3)
    {
        count=0;
        rep(i,0,3)
        {
            if(occ[a[i][j]]) count++;
            // cout<<i<<" "<<j<<" ";
        }
        // cout<<"\n";
        if(count==3)
        {
            cout<<"Yes";
            return;
        }
    }
    count=0;
    rep(i,0,3) if(occ[a[i][i]]) count++;
    if(count==3)
    {
        cout<<"Yes";
        return;
    }
    if(occ[a[2][0]]&&occ[a[0][2]]&&occ[a[1][1]]) 
    {
        cout<<"Yes";
        return;
    }
    cout<<"No";
}
 
 
signed main()
{
    #ifndef ONLINE_JUDGE 
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
int check(int *ball, int n, int l, int r)
{
	if (n == 0)
		return 1;
	if (*ball > l && check(ball+1, n-1, *ball, r))
		return 1;
	if (*ball > r && check(ball+1, n-1, l, *ball))
		return 1;
	return 0;
}
int main()
{
	int N, ball[10], i;
	scanf("%d", &N);
	while (N--) {
		for (i = 0; i < 10; i ++)
			scanf("%d", ball+i);
		puts(check(ball+1, 9, ball[0], 0) ? "YES" : "NO");
	}
	return 0;
}

Measured memory_bytes: 0
while True:
    a,o,b = [i for i in input().split()]
    
    if o == '?':
        break
    elif o == '+':
        print(int(a)+int(b))
    elif o == '-':
        print(int(a)-int(b))
    elif o == '*':
        print(int(a)*int(b))
    else:
        print(int(a)//int(b))


Measured memory_bytes: 5604
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


N = int(input())
print("ABC"+str(N))


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

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

    int t, ans = 0, mx = 0;

    for (int i=0; i<5; ++i) {
        cin >> t;
        ans += (t+9) / 10 * 10;
        mx = max(mx, (1000 - t) % 10);
    }
    cout << ans - mx << endl;

    return 0;
}

Measured memory_bytes: 256
L = int(input())
A = [int(input()) for _ in range(L)]
dp = [[1 << 60] * 5 for _ in range(L + 1)]
dp[0] = [0] * 5
for i in range(1, L + 1):
    a = A[i - 1]
    dp[i][0] = dp[i - 1][0] + a
    tm = min(dp[i - 1][0], dp[i - 1][1])
    dp[i][1] = tm + (2 if a == 0 else a % 2)
    tm = min(tm, dp[i - 1][2])
    dp[i][2] = tm + (1 - a % 2)
    tm = min(tm, dp[i - 1][3])
    dp[i][3] = tm + (2 if a == 0 else a % 2)
    tm = min(tm, dp[i - 1][4])
    dp[i][4] = tm + a
print(min(dp[L]))


Measured memory_bytes: 67856
#include<stdio.h>
#include<math.h>
int is_prime(int n)
{
    int k=3;
    if(n==2) return 1;

    if(n<2 || n%2==0) return 0;

    while(k*k<=n)
    {
        if(n%k==0) return 0;
        k++;
    }
    return 1;
}
int main()
{
    int n,i,num[100001],count=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&num[i]);
        if(is_prime(num[i])==1) count++;
    }
    printf("%d\n",count);
    return 0;
}



Measured memory_bytes: 2124
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;

typedef pair<ll, ll> P;

const int MOD = 1000000007;
const ll INF = 1LL << 60;


// LRUD
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
// const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
// const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

vector<vector<int> > vvi;
vector<vector<vector<int> > > vvvi;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


int main(int argc, char**argv){
    int n, m;
    cin >> n >> m;
    int s[m][10];
    vector<int> ns(m);
    for (int i = 0; i < m; i++){
        cin >> ns[i];
        for (int j = 0; j < ns[i]; j++){
            cin >> s[i][j];
        }
    }
    vector<int> p(m);
    for (int i = 0; i < m; i++) cin >> p[i];

    int ans = 0;

    for (int bit = 0; bit < (1<<n); bit++){
        int all_on = true;

        for (int i = 0; i < m; i++){
            int n_on = 0;
            for (int j = 0; j < ns[i]; j++){
                if (bit & 1<<(s[i][j]-1)) n_on++;
            }
            if (n_on % 2 != p[i]) all_on = false;
        }

        if (all_on) ans++;
    }

    cout << ans << endl;

    return 0;
}
















Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    String A;
    String B;
    String C;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.A = sc.next();
        this.B = sc.next();
        this.C = sc.next();
    }
    
    //解答処理
    private String solve() {
        String answer = "NO";
        if (A.charAt(A.length()-1)==B.charAt(0) && B.charAt(B.length()-1)==C.charAt(0)) {
        	answer = "YES";
        }
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()%
//#define int long long

signed main(){
    int n; cin >> n;
    vector<int> d(n);
    rep(i,n) cin >> d[i];
    sort(ALL(d));
    cout << d[n/2] - d[n/2-1] << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std ;
int main () {
	int a , b ;
	cin>>a>>b;
	if(a==1)
	a=14;
	if(b==1)
	b=14;
	if(a>b)
	cout<<"Alice\n";
	else if(b>a)
	cout<<"Bob\n";
	else 
	cout<<"Draw\n";
	return 0  ;
}

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

int main(){
	int N, M, x, y, i, ans = 0;
	scanf("%d%d", &N, &M);
	int *num = (int *)malloc(sizeof(int) * N);
	int *can_red = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		num[i] = 1;
		can_red[i] = 0;
	}
	can_red[0] = 1;
	for(i = 0; i < M; i++){
		scanf("%d%d", &x, &y);
		x--;
		y--;
		if(can_red[x] == 1){
			can_red[y] = 1;
		}
		if(num[x] == 1){
			can_red[x] = 0;
		}
		num[x]--;
		num[y]++;
	}
	for(i = 0; i < N; i++){
		ans += can_red[i];
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
int n, k, r, s, p, a;
char t[100001];
char x[100001];
int main() {
	scanf("%d%d%d%d%d", &n, &k, &r, &s, &p);
	scanf(" %s", t);
	for (int i = 0; i < n; i++) {
		if (t[i] == 'r')x[i] = 'p';
		if (t[i] == 's')x[i] = 'r';
		if (t[i] == 'p')x[i] = 's';
		if (i >= k) {
			if (x[i] == x[i - k])x[i] = 'x';
		}
		if (x[i] == 'r')a += r;
		if (x[i] == 's')a += s;
		if (x[i] == 'p')a += p;
	}
	printf("%d\n", a);
}

Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<list>
#include<functional>
#define mp make_pair
#define X first
#define Y second
#define INF 1987654321987654321
#define PI 3.14159265358979323846264
#define MOD 20091101
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef complex<double> base;
ll POW(ll a, ll b) { if (b == 0)return 1; if (b == 1)return a; if (b & 1)return (a*POW(a, b - 1)) % MOD; ll t = POW(a, b / 2); return (t*t) % MOD; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };//동북남서

Pll p[200000];
ll cnt[2];
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	cnt[0] = n + 1, cnt[1] = m + 1;
	fup(i, 0, n - 1, 1)
	{
		ll x;
		scanf("%lld", &x);
		p[i] = Pll(x, 0);
	}
	fup(i, n, n + m - 1, 1)
	{
		ll x;
		scanf("%lld", &x);
		p[i] = Pll(x, 1);
	}
	sort(p, p + n + m);
	ll ans = 0;
	fup(i, 0, n + m - 1, 1)
	{
		int c = p[i].Y;
		ans += cnt[1-c] * p[i].X;
		cnt[c]--;
	}
	printf("%lld", ans);
}

Measured memory_bytes: 3328
n=int(input())
s=input()
l,r=n//2+1,0
while l-r>1:
    t=(l+r)//2
    g=s[:t]
    q={}
    q[s[t:2*t]]=1
    d=s[t:2*t]
    for i in range(2*t,n):
        d=d[1:]+s[i]
        if d in q:
            q[d]+=1
        else:
            q[d]=1
    if g in q:
        r=t
    else:
        d=s[t:2*t]
        for i in range(t,n-t):
            q[d]-=1
            if q[d]==0:
                del q[d]
            d=d[1:]+s[i+t]
            g=g[1:]+s[i]
            if g in q:
                r=t
                break
        else:
            l=t
print(r)


Measured memory_bytes: 6388
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  int N,ans=0;
  cin>>N;
  double x[N],B=0.0;
  string u[N];
  for(int i=0;i<N;i++) cin>>x[i]>>u[i];
  for(int i=0;i<N;i++){
    if(u[i]=="JPY") ans+=x[i];
    else B+=x[i];
  }
  cout<<ans+B*380000.0<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f0(i, n) for(int i=(0); i<n; i++)
#define f1(i, n) for(int i=(1); i<=n; i++)
#define Val(x) (((x)))

using namespace std;
typedef long long ll;

main(){
    ios_base::sync_with_stdio(0);


    ll n, a, b; cin >> n >> a >> b;
    if(a > b){
        cout << 0; exit(0);
    }
    if(a==b){
        cout << 1; exit(0);
    }
    if(n==1){
        if(a != b) cout << 0;
        else cout << 1;
        exit(0);
    }
    ll x = (n - 2)*a, y = (n - 2)*b;
    cout << y - x + 1;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define strall(v) (v).cbegin(),(v).cend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
  int n,ans = 100005;
  string s;
  cin >> s;
  n = s.size();
  for(int i=0;i<2;i++){
    int cnt = 0;
    for(int j=0;j<n;j++)
    if(i == 0){
      if(((j+1)%2) != 0) {if(s[j] == '1') cnt++;}
      else {if(s[j] == '0') cnt++;}
    }else{
      if(((j+1)%2) != 0) {if(s[j] == '0') cnt++;}
      else {if(s[j] == '1') cnt++;}
    }
    chmin(ans,cnt);
  }
  cout << ans << endl;
}

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

void die(){
	cout << "No";
	exit(0);
}
long long arr[100005];
int main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	string s; cin >> s;
	if(s.length() % 2 == 1) die();
	
	for(int i = 0;i < s.length();i++){
		if(i % 2 == 0){
			if(s[i] != 'h') die();
		}
		else if(s[i] != 'i') die();
	}
	
	cout << "Yes";
	
}


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

const int MAX = 510000;
const int mod = 1000000007;

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

//mod mでの a の逆元を求める
long long modinv(long long a) {
    long long b = mod, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod; 
    if (u < 0) u += mod;
    return u;
}

// a^n を mod で割ったあまり
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}




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

    ll b,w;
    cin>>b>>w;
    COMinit();
    ll n = b+w;
    ll p=0,q=0;
    for(int i=1;i<=n;i++){
        ll ans = (0 + (1LL - p + q + mod)%mod*inv[2]%mod)%mod;
        cout << ans <<"\n";
        p += modinv(modpow(2,i)) * COM(i-1,b-1)%mod;
        q += modinv(modpow(2,i)) * COM(i-1,w-1)%mod;
        if(p>=mod) p-=mod;
        if(q>=mod) q-=mod;
    }

    
}

Measured memory_bytes: 14208
#include <iostream>

using namespace std;

int solve(int a, int b)
{
	if (a <= b) {
		return a;
	}
	else {
		return a - 1;
	}
}

int main()
{
	int a, b;
	cin >> a >> b;
	cout << solve(a, b) << endl;
}


Measured memory_bytes: 256
N, X, Y = map(int, input().split())
count = [0] * N
a = 0
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        a = min(j - i, abs(X - i) + abs(Y - j) + 1)
        count[a] += 1

for i in range(1, N):
    print(count[i])

Measured memory_bytes: 3444
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int dp[200005][35],t[200005];
P<int,int> a[200005];
bool cmp(P<int,int> x,P<int,int> y){
	RE x.F*(y.S+1)>y.F*(x.S+1);
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	cin>>n>>m;
	int la,lt;
	la=lt=0;
	P<int,int> in;
	FOR(i,1,n){
		cin>>in.F>>in.S;
		if(in.F){
			a[++la]=in;
		}else t[++lt]=in.S+1;
	}
	sort(t+1,t+lt+1);
	FOR(i,1,lt)t[i]=t[i]+t[i-1];
	FOR(i,0,la)FOR(j,1,30)dp[i][j]=m+1;
	sort(a+1,a+la+1,cmp);
	FOR(i,1,la){
		FOR(j,1,30){
			dp[i][j]=min(dp[i-1][j],dp[i-1][j-1]+1+(dp[i-1][j-1]+1)*a[i].F+a[i].S);
		}
	}
	int ans=0,ind;
	FOR(i,0,30){
		if(dp[la][i]>m)continue;
		ind=upb(t+1,t+lt+1,m-dp[la][i])-t;
		gmax(ans,i+ind-1);
	}
	cout<<ans;
	RE 0;
}




Measured memory_bytes: 59648
#include <bits/stdc++.h>
#define foi(i,k,n) for (int i = (int)k; i < (int)n; ++i)

using namespace std;
using ll = long long;
using ii = pair<int,int>;

const double pi = acos(-1.0);

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  double r; cin >> r;
  cout << fixed << setprecision(4) << 2.0*pi*r << '\n';
  return 0;
}


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

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


Measured memory_bytes: 256
//Multiplication 1

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<ll,string> p;
using g = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int a,b;cin>>a>>b;
    cout<<a*b<<nnn;
    return 0;
}

Measured memory_bytes: 3632
n, k = map(int, input().split())
A = list(map(int, input().split()))
for i in range(k):
    B = [0] * (n+1)
    for j in range(n):
        B[max(0, j-A[j])] += 1
        B[min(n, j+A[j]+1)] -= 1
    A[0] = B[0]
    for j in range(1, n):
        A[j] = A[j-1]+B[j]
    if A == [n]*n:
        print(*A)
        exit()
print(*A)
    

Measured memory_bytes: 169104
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

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

  int ans = 0;
  REP(i, N){
    int cnt1 = 0, cnt2 = 0;
    REP(j, N){
      if(A[i] > A[j]){
        if(i < j) cnt1++;
        else cnt2++;
      }
    }
    (ans += cnt1*((K*(K+1)/2)%MOD)) %= MOD;
    (ans += cnt2*((K*(K-1)/2)%MOD)) %= MOD;
  }

  cout << ans%MOD << "\n";

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
const long long md=1e9+7;
const int maxn=2000000;
long long fac[maxn+10],inv[maxn+10];
long long powd(long long x,long long y){
	long long res=1;
	while(y){
		if(y&1) res=res*x%md;
		x=x*x%md;
		y>>=1;
	}
	return res;
}
long long C(int x,int y){
	return fac[x+y]*inv[x]%md*inv[y]%md;
}
int Abs(int x){
	return x>0?x:-x;
}
long long getsum(int x1,int y1,int x2,int y2){
	return (C(x2+1,y2+1)+md-C(x2+1,y1)+md-C(x1,y2+1)+C(x1,y1))%md;
}
int main(){
//	freopen("E.in","r",stdin);

	int x1,x2,x3,x4,x5,x6;
	int y1,y2,y3,y4,y5,y6;

	fac[0]=1;
	for(int i=1;i<=maxn;i++)
		fac[i]=fac[i-1]*i%md;
	inv[maxn]=powd(fac[maxn],md-2);
	for(int i=maxn;i>=1;i--)
		inv[i-1]=inv[i]*i%md;

	scanf("%d%d%d%d%d%d",&x1,&x2,&x3,&x4,&x5,&x6);
	scanf("%d%d%d%d%d%d",&y1,&y2,&y3,&y4,&y5,&y6);

	long long ans=0,st,tt;
	for(int i=x3;i<=x4;i++)
	{
		st=getsum(Abs(i-x2),Abs(y3-1-y2),Abs(i-x1),Abs(y3-1-y1));
		tt=getsum(Abs(i-x5),Abs(y3-y5),Abs(i-x6),Abs(y3-y6));
		st=st*tt%md;
		ans=(ans-st*(y3+i-1)%md+md)%md;
		st=getsum(Abs(i-x5),Abs(y4+1-y5),Abs(i-x6),Abs(y4+1-y6));
		tt=getsum(Abs(i-x2),Abs(y4-y2),Abs(i-x1),Abs(y4-y1));
		st=st*tt%md;
		ans=(ans+st*(y4+i)%md)%md;
	}

	for(int i=y3;i<=y4;i++)
	{
		st=getsum(Abs(i-y2),Abs(x3-1-x2),Abs(i-y1),Abs(x3-1-x1));
		tt=getsum(Abs(i-y5),Abs(x3-x5),Abs(i-y6),Abs(x3-x6));
		st=st*tt%md;
		ans=(ans-st*(x3+i-1)%md+md)%md;
		st=getsum(Abs(i-y5),Abs(x4+1-x5),Abs(i-y6),Abs(x4+1-x6));
		tt=getsum(Abs(i-y2),Abs(x4-x2),Abs(i-y1),Abs(x4-x1));
		st=st*tt%md;
		ans=(ans+st*(x4+i)%md)%md;
	}

	printf("%lld\n",ans);
	return 0;
}


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

int main(){
	int i,j,r,c,date[101][101]={0};
	char input[1024],*num;
	
	fgets(input,sizeof(input),stdin);
	sscanf(input,"%d %d",&r,&c);
	
	fgets(input,sizeof(input),stdin);
	num=strtok(input," ");
	date[0][0]=atoi(num);
	
	date[0][c]+=date[0][0];
	date[r][0]+=date[0][0];
	date[r][c]+=date[0][0];
	for(i=0;i<r;i++){
		if(i!=0){
			fgets(input,sizeof(input),stdin);
			num=strtok(input," ");
			date[i][0]=atoi(num);
			
			date[i][c]+=date[i][0];
			date[r][0]+=date[i][0];
			date[r][c]+=date[i][0];
		}
		for(j=1;j<c;j++){
			num=strtok(NULL," ");
			date[i][j]=atoi(num);
			
			date[i][c]+=date[i][j];
			date[r][j]+=date[i][j];
			date[r][c]+=date[i][j];
		}
	}
	
	for(i=0;i<r+1;i++){
		for(j=0;j<c+1;j++){
			printf("%d",date[i][j]);
			if(j!=c){
				printf(" ");
			}
		}
		printf("\n");
	}
	
	
	return 0;
}

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

using namespace std;

typedef long long llint;
const long long MOD = 1e9 + 7;

/* べき乗(mのn乗)を計算する関数. O(logn) */
template <typename T>
T modpow(T m, T n, const T &p) {
  if (n == 0) return 1;
  T ret = modpow(m * m % p, n / 2, p);
  if (n % 2) ret *= m;
  return ret % p;
}
/* フェルマーの小定理を使って二項係数を計算. O(r) */
template <typename T>
T binomial(T n, T r, const T &p) {
  if (r > n - r) return binomial(n, n - r, p);
  T ansMul = 1;
  T ansDiv = 1;
  for (T i = 0; i < r; i++) {
    ansMul *= (n - i);
    ansDiv *= (i + 1);
    ansMul %= p;
    ansDiv %= p;
  }
  // ansDivの逆元
  T ans = (ansMul * modpow(ansDiv, p - 2, p)) % p;
  return ans;
}

int main() {
  llint n, m, k;
  cin >> n >> m >> k;

  llint ans = 0;
  for (llint d = 1; d < n; d++) {
    ans += d * (n - d) * m * m;
    ans %= MOD;
  }
  swap(n, m);
  for (llint d = 1; d < n; d++) {
    ans += d * (n - d) * m * m;
    ans %= MOD;
  }

  ans *= binomial(n * m - 2, k - 2, MOD);
  ans %= MOD;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b;
	cin >> a >> b;
	if (a < 10 && b < 10) cout << a * b << endl;
	else cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <cstring>

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using PP = pair<ll, pair<ll,ll>>;
#define rep(i,n) for (ll i = 0; i < (n); ++i)

int x;

int main() {
    cin >> x;

    (x < 30) ? cout << "No" << endl : cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int k;
 string s;
 cin>>k>>s;
 if(s.length()>k)
 {
 	cout<<s.substr(0,k)+"..."<<endl;
 }
 else
 cout<<s<<endl;
 return 0;
}


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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int N;
  cin >> N;
  vector<vector<int>> a(N);
  rep(i, N) rep(j, N - 1) {
    int k;
    cin >> k;
    k--;
    a[i].push_back(k);
  }
  rep(i, N) reverse(a[i].begin(), a[i].end());
  dumpv(a, N);
  vector<P> q;
  function<void(int)> scan = [&](int i) {
    if (a[i].size() == 0) return;
    int j = a[i].back();
    if (a[j].size() == 0) return;
    if (a[j].back() == i) {
      dump("scan", i, j);
      if (j > i) swap(i, j);
      q.push_back(P(i, j));
    }
  };
  rep(i, N) scan(i);
  int ans = N * (N - 1) / 2;
  for (int d = 0; d < N * (N - 1) / 2; d++) {
    dump(a, q);
    if (!q.size()) {
      ans = d;
      break;
    }
    sort(q.begin(), q.end());
    q.erase(unique(q.begin(), q.end()), q.end());
    vector<P> q2;
    swap(q2, q);
    for (P p : q2) {
      int i = p.first, j = p.second;
      a[i].pop_back();
      a[j].pop_back();
    }
    for (P p : q2) {
      int i = p.first, j = p.second;
      scan(i);
      scan(j);
    }
  }
  dump(ans, a);
  rep(i, N) {
    if (a[i].size() != 0) {
      dump(i, a[i]);
      cout << -1 << endl;
      return;
    }
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 4352
import sys


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


sys.setrecursionlimit(1000000)
mod = 1000000007


# A
def A():
    return


# B
def B():
    n, k = LI()
    h = LI()
    ans = 0
    for i in h:
        if i >= k:
            ans += 1
    print(ans)
    return


# C
def C():
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


# Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 49904
from sys import exit
import numpy as np
#import copy
#from collections import deque



N,M,X =map(int, input().split())
C=[list(map(int, input().split())) for _ in range(N)]

tmp=float("inf")

for i in range(2**N):
    s=np.zeros(M+1)
    for j in range(N):
        if (i>>j)&1 :
            s+=C[j]
    if min(s[1:])>=X:
        tmp=min(s[0],tmp)

if tmp==float("inf"):
    tmp=-1
print(int(tmp))





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

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

int main(){
  vector<string> s(3);
  rep(i,3) cin >> s.at(i);

  vector<int> p(3,0);
  int now=0;

  while(1){
    if(p.at(now)==s.at(now).size()) break;

    int po = p.at(now);
    p.at(now)++;
    char next = s.at(now).at(po);
    
    //cout << now <<" " <<next << endl;
    
    if(next=='a') now=0;
    else if(next=='b') now=1;
    else now=2;
  }

  if(now==0) cout << "A";
  else if(now==1) cout << "B";
  else cout << "C";
  
}

Measured memory_bytes: 3636
D=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(D):
    s.append(list(map(int,input().split())))

last=[0]*26
ans=0
for d in range(1,D+1):
    t=int(input())
    last[t-1]=d
    temp=0
    for i in range(26):
        if i==t-1:
            temp=s[d-1][t-1]
        else:
            temp=-c[i]*(d-last[i])
        ans+=temp
    print(ans)




Measured memory_bytes: 9220