akhauriyash/Code-Regression huggingface dataset:
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<stdlib.h>
#include<queue>
#include<map>
#include<vector>
#include<cmath>
#include<fstream>
#include <set>
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
const int  MAXN =3e5+10;
const int mod = 1e9 + 7;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf= 0x3f3f3f3f;
#define eps 1e-8
#define PI 3.1415926535898
#define lowbit(x) (x&(-x))
using namespace std ;
//getline(cin,s);
//set<ll>::iterator it;
//map<int,int>::iterator it;
typedef long long ll;
char s[1005][1005];
int vis[1005][1005];
int dist[1005][1005];
int n,m;
struct node{
	int x,y,step;
};
int tox[4]={1,-1,0,0};
int toy[4]={0,0,1,-1};
int main()
{
	int x1,y1,xx,yy,flag=0;
	scanf("%d %d",&n,&m);
	scanf("%d %d %d %d",&x1,&y1,&xx,&yy);
	for(int i=1;i<=n;i++) scanf("%s",s[i]+1);
	deque<node> q;
	q.push_back((node){x1,y1,0});
	while(!q.empty())
	{
		node now=q.front();
		q.pop_front();
		int x=now.x,y=now.y,val=now.step;
		if(vis[x][y]) continue;
		vis[x][y]=1;
		if(x==xx&&y==yy) flag=1;
		dist[x][y]=val;
		//printf("%d %d\n",x,y);
		for(int i=0;i<4;i++)
		{
			int nex=x+tox[i],ney=y+toy[i];
			if(nex>=1&&nex<=n&&ney>=1&&ney<=m&&s[nex][ney]=='.')
			{
				q.push_front((node){nex,ney,val});
			}
		} 
		for(int i=-2;i<=2;i++)
		{
			for(int j=-2;j<=2;j++)
			{
				int nex=x+i,ney=y+j;
		    	if(nex>=1&&nex<=n&&ney>=1&&ney<=m&&s[nex][ney]=='.')
		    	{
		    		q.push_back((node){nex,ney,val+1});
				}
			}
		}
	}
	if(flag) printf("%d\n",dist[xx][yy]);
	else printf("-1\n");
	return 0;
}

Measured memory_bytes: 13820
//#define _GLIBCXX_DEBUG
//#define rep(i,n) for (int i = 0; i < (int)(n); i++)
//#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <cstdio>
using namespace std;
///typedef long long ll;

signed main() {
    int n;
    scanf("%d",&n);
    printf("%d",10-(n/200));
}

Measured memory_bytes: 1720
#include <stdio.h>

int main(void){
    int i,j,k,n,m,l,a[100][100],b[100][100];
    long C;
    scanf("%d%d%d",&n,&m,&l);
    
    //??????A
    for(i=0;i<n;i++)
        for(j=0;j<m;j++)
            scanf("%d",&a[i][j]);
    
    //??????B
    for(i=0;i<m;i++)
        for(j=0;j<l;j++)
            scanf("%d",&b[i][j]);
    
    //??????C
    for(i=0;i<n;i++)
        for(j=0;j<l;j++){
            C = 0;
            for(k=0;k<m;k++)
                C += a[i][k] * b[k][j] ;
            printf("%ld", C);
            if(j+1 == l)
                printf("\n");
            else
                printf(" ");
        }
    
    return 0;
}

Measured memory_bytes: 680
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;

struct Time{
    int x;
    int y1;
    int y2;
    int act;
    Time(int x, int y1, int y2, int act): x(x), y1(y1), y2(y2), act(act) {}
    bool operator<( const Time& right ) const {
        return x < right.x;
    }
};

int compress(vector<int> &x, map<int, int> &zip, vector<int> &unzip){
    sort(x.begin(), x.end());
    x.erase(unique(x.begin(), x.end()), x.end());
    for (int i=0;i<x.size();i++){
        zip[x[i]] = i;
        unzip.push_back(x[i]);
    }
    return x.size();
}

int main(){
    int N, x1, x2, y1, y2;
    vector<int> ylist, yunzip;
    map<int, int> yzip;
    vector<Time> Timeline;
    cin >> N;
    for (int i=0;i<N;i++){
        cin >> x1 >> y1 >> x2 >> y2;
        ylist.push_back(y1);
        ylist.push_back(y2);
        Time t1(x1, y1, y2, 0);
        Time t2(x2, y1, y2, 1);
        Timeline.push_back(t1);
        Timeline.push_back(t2);
    }

    compress(ylist, yzip, yunzip);
    sort(Timeline.begin(), Timeline.end());

    vector<int> range(4000, 0);

    ull S = 0ull;
    int prevx = Timeline[0].x;
    ull tate;
    int prev;
    int i = 0;
    while(i < Timeline.size()){
        tate = 0ull;
        prev = -1;
        for (int j=0;j<4000;j++){
            if(prev == -1){
                if(range[j] >= 1){
                    prev = j;
                }
            }else{
                if(range[j] == 0){
                    tate += (yunzip[j] - yunzip[prev]);
                    prev = -1;
                }
            }
        }
        S += (Timeline[i].x - prevx) * tate;
        /*
        cout << tate << endl;
        cout << Timeline[i].x - prevx << endl;
        cout << S << endl;
        */
        prevx = Timeline[i].x;
        int k = i;
        while(i < Timeline.size() && Timeline[i].x == Timeline[k].x){
            Time t = Timeline[i];
            if(t.act == 0){
                for (int j=yzip[t.y1];j<yzip[t.y2];j++){
                    range[j] += 1;
                }
            }else{
                for (int j=yzip[t.y1];j<yzip[t.y2];j++){
                    range[j] -= 1;
                }
            }
            i++;
        }
    }
    cout << S << endl;

    return 0;
}

Measured memory_bytes: 3424
[W, H, N] = list(map(int, input().split()))
[x, y, a] = [ [], [], [] ]
for _ in range(N):
  input_line = list(map(int, input().split()))
  x.append(input_line[0])
  y.append(input_line[1])
  a.append(input_line[2])
area = []
for i in range(W):
  area.append([])
  for j in range(H):
    area[i].append("")
    
for i in range(N):
  if a[i] == 1:
    for X in range(x[i]):
      for Y in range(H):
        area[X][Y] = "f"
  if a[i] == 2:
    for X in range(x[i], W):
      for Y in range(H):
        area[X][Y] = "f"
  if a[i] == 3:
    for X in range(W):
      for Y in range(y[i]):
        area[X][Y] = "f"
  if a[i] == 4:
    for X in range(W):
      for Y in range(y[i], H):
        area[X][Y] = "f"
        
count = 0
for i in range(W):
  for j in range(H):
    if area[i][j] == "":
      count += 1
      
print(count)

Measured memory_bytes: 3188
# フェルマーの小定理
K = int(input())
S = input()

m = 1000000007


def make_factorial_table(n):
    result = [0] * (n + 1)
    result[0] = 1
    for i in range(1, n + 1):
        result[i] = result[i - 1] * i % m
    return result


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m


fac = make_factorial_table(len(S) + K)

result = 0
for i in range(K + 1):
    result += pow(26, i, m) * mcomb(len(S) - 1 + K - i, len(S) - 1) * pow(25, K - i, m)
    result %= m
print(result)


Measured memory_bytes: 107616
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
#define TAM 100000
int dp[TAM+1];
int main() {
  vector<int> c;
  for ( int i = 1; i <= TAM; i *= 6 ) c.pb(i);
  for ( int i = 9; i <= TAM; i *= 9 ) c.pb(i);
  dp[0] = 0;
  for ( int n = 1; n <= TAM; ++n ) {
    dp[n] = INT_MAX;
    for ( int ci : c )
      if ( ci <= n )
        dp[n] = min ( dp[n], dp[n-ci] + 1 );
  }

  int n;
  cin >> n;
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 640
n = gets.chomp.to_i
edge = Struct.new("Edge", :to, :cost)
tree = Array.new(n+1){Array.new()}
depth = Array.new(n+1)
(n - 1).times do
  a, b, c = gets.chomp.split(" ").map(&:to_i)
  a -= 1
  b -= 1
  tree[a] << edge.new(b, c)
  tree[b] << edge.new(a, c)
end
  
q, k = gets.chomp.split(" ").map(&:to_i)
k -= 1
 
depth[k] = 0
cand = [[k, 0]]
while cand.length > 0
  curr, dist = cand.shift
  tree[curr].each do |e|
    unless depth[e.to]
      depth[e.to] = dist + e.cost
      cand << [e.to, depth[e.to]]
    end
  end
end
q.times do
  x, y = gets.chomp.split(" ").map(&:to_i)
  x -= 1
  y -= 1
  puts depth[x] + depth[y]
end

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 3000;

int N;
double A[MAXN+10], dp[MAXN+10][MAXN+10], ans;

int main()
{
    int i, j;

    scanf("%d", &N);
    for(i=1; i<=N; i++) scanf("%lf", &A[i]);

    dp[0][0]=1;
    for(i=1; i<=N; i++) for(j=0; j<=i; j++)
    {
        dp[i][j]=dp[i-1][j]*(1-A[i]);
        if(j>0) dp[i][j]+=dp[i-1][j-1]*A[i];
    }
    for(i=(N+1)/2; i<=N; i++) ans+=dp[N][i];
    printf("%.10f", ans);
}


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

#define ld long double
#define eps 1e-9

bool cmp(ld A , ld B){return A + eps > B && A - eps < B;}

struct vec{
	ld x , y;
	vec(ld _x = 0 , ld _y = 0) : x(_x) , y(_y){}
	friend vec operator +(vec A , vec B){return vec(A.x + B.x , A.y + B.y);}
	friend vec operator -(vec A , vec B){return vec(A.x - B.x , A.y - B.y);}
	friend ld operator *(vec A , vec B){return A.x * B.x + A.y * B.y;}
	friend ld operator %(vec A , vec B){return A.x * B.y - A.y * B.x;}
	friend vec operator *(vec A , ld B){return vec(A.x * B , A.y * B);}
	ld len(){return sqrt(x * x + y * y);}
	ld angle(){return atan2(y , x);}
};

struct segment{
	vec st , ed , dir;
	segment(vec _a = vec() , vec _b = vec()) : st(_a) , ed(_b) , dir(_b - _a){}
	friend bool havesect(segment A , segment B){
		ld P = A.st.x , Q = A.ed.x , X = B.st.x , Y = B.ed.x;
		if(Q < P) swap(P , Q);
		if(Y < X) swap(X , Y);
		if(X - eps > Q || P - eps > Y) return 0;
		P = A.st.y , Q = A.ed.y , X = B.st.y , Y = B.ed.y;
		if(Q < P) swap(P , Q);
		if(Y < X) swap(X , Y);
		if(X - eps > Q || P - eps > Y) return 0;
		return
			((B.st - A.st) % A.dir) * (A.dir % (B.ed - A.st)) > -eps &&
			((B.st - A.ed) % A.dir) * (A.dir % (B.ed - A.ed)) > -eps &&
			((A.st - B.st) % B.dir) * (B.dir % (A.ed - B.st)) > -eps &&
			((A.st - B.ed) % B.dir) * (B.dir % (A.ed - B.ed)) > -eps;
	}
	friend vec getsect(segment A , segment B){
		ld t = ((A.st - B.st) % B.dir) / (B.dir % A.dir);
		return A.st + A.dir * t;
	}
};

vec getvec(){int x , y; cin >> x >> y; return vec(x , y);}
segment getseg(){vec A = getvec() , B = getvec(); return segment(A , B);}

int main(){
	int Q;
	for(cin >> Q ; Q ; --Q){
		segment A = getseg() , B = getseg(); vec sect(getsect(A , B));
		cout << fixed << setprecision(10) << sect.x << ' ' << sect.y << endl;
	}
	return 0;
}



Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

void solve() {
    string s;
    int k;
    cin >> s >> k;
    set<string> v;
    for (int i = 0; i < s.size(); i++) {
        string ss = "";
        ss += s[i];
        v.insert(ss);
        for (int j = 1; j <= 5 && i + j < s.size(); j++) {
            ss += s[i + j];
            v.insert(ss);
        }
    }

    for (auto tmp:v) {
        k--;
        if (k == 0) {
            cout << tmp << endl;
            return;
        }
    }

}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <map>
#include <vector>

using namespace std;
typedef long long ll;
int main() {
  ll n, x, m;
  cin >> n >> x >> m;
  map<ll, int> mp;
  int idx = 0;
  vector<ll> path;
  do {
    mp[x] = idx++;
    path.emplace_back(x);
    x = x * x % m;
  } while (!mp.count(x));
  int start = mp[x];
  int len = idx - start;
  ll sum = 0;
  for (int i = start; i < idx; ++i)
    sum += path[i];
  ll ans = 0;
  if (n < start) {
    for (int i = 0; i < n; ++i)
      ans += path[i];
  } else {
    for (int i = 0; i < start; ++i)
      ans += path[i];
    ll loop = (n - start) / len;
    ans += loop * sum;
    ll rem = (n - start) % len;
    for (int i = 0; i < rem; ++i)
      ans += path[start + i];
  }
  cout << ans;
}

Measured memory_bytes: 6708
import java.util.*;

public class Main{
public static void main(String[] args){
	Scanner scanner = new Scanner(System.in);
  	int n = scanner.nextInt();
  	long[] nums = new long[n];
  	for(int i = 0;i < n;i++){
      nums[i] = scanner.nextLong();
    }
  	if(n == 1){
      System.out.println(0);
      return;
    }
  	int l = 0;
  	int r = 1;
  	long sum = 0;
  	while(r < n){
      if(nums[l] > nums[r]){
         sum += Math.abs(nums[l] - nums[r]);
        nums[r] = nums[l];
      }
      l++;
      r++;
    }
      System.out.println(sum);
}
}

Measured memory_bytes: 51824
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 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;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskAtCoder19B solver = new TaskAtCoder19B();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskAtCoder19B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            double res = 0;
            for (int i = 0; i < N; i++) {
                double tmp = Double.parseDouble(in.next());
                if (in.next().equals("BTC"))
                    tmp *= 380000.0;
                res += tmp;
            }
            out.println(res);
        }

    }
}



Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t con = 1000000007LL;
  
  int N;
  cin >> N;
  vector<bitset<60>> A(N);
  for(int i = 0; i < N; i++){
    int64_t Ai;
    cin >> Ai;
    A.at(i) = bitset<60>(Ai);
  }
  
  int64_t sum = 0;
  for(int i = 0; i < 60; i++){
    int64_t num0 = 0;
    int64_t num1 = 0;
    for(int j = 0; j < N; j++){
      if(A.at(j).test(i)){
        num1++;
      }else{
        num0++;
      }
    }
    //int64_t sum_temp = ((num0 % con) * (num1 % con)) % con;
    int64_t sum_temp = num0 * num1;
    for(int j = 0; j < i; j++){
      sum_temp *= 2;
      sum_temp %= con;
    }
    sum += sum_temp;
    sum %= con;
  }
  cout << sum << endl; 
}

Measured memory_bytes: 2560
import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int[] alphabet = new int[26];
		
		while (sc.hasNext()) {
			String s = sc.nextLine();
			for (int i=0; i<s.length(); i++) {
				char c = s.charAt(i);
				if ('a'<=c && c<='z') {
					alphabet[c-97]++;
				}
				else if ('A'<=c && c<='Z') {
					alphabet[c-65]++;
				}
			}
		}
		for (int i=0; i<26; i++) {
			System.out.println((char)(i+97)+" : "+alphabet[i]);
		}
	}
}



Measured memory_bytes: 26064
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[]) {
	string str;
	std::cin >> str;
	if (str.size() == 3) {
		reverse(str.begin(), str.end());
		std::cout << str << '\n';
	}
	else {
		std::cout << str << '\n';
	}
	return 0;
}


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

int main(){
    ll n, t, maxv = -1000000001, minv;
    cin >> n;
    cin >> minv;
    repc(i, 0LL, n-1){
        cin >> t;
        if (maxv < t - minv){
            maxv = t - minv;
        }
        if (t < minv){
            minv = t;
        }
    }
    cout << maxv << endl;
    return 0;
}



Measured memory_bytes: 3112
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] List = new int[n];
		
		for(int a=0;a<n;a++)
			List[a] = sc.nextInt();
		
		int q = sc.nextInt();
		
		for(int i=0;i<q;i++) {
			
			int b = sc.nextInt();
			int m = sc.nextInt();
			int e = sc.nextInt();
			
			rotate(List,b,m,e);
		}
		
		for(int i=0;i<List.length;i++) {
			if(i==0) System.out.print(List[0]);
			else System.out.print(" " + List[i]);
		}
		
		System.out.println();
	}
	
	public static void rotate(int[] list ,int b,int m,int e) {
		int[] cloneList = list.clone();
		for(int k=0;k<e-b;k++) {
			list[b+((k+(e-m)) % (e-b))] = cloneList[b+k];
		}
	}
}


Measured memory_bytes: 40064
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
	string a;
	cin >> a;
	int c = 753;
	for (int i = 0; i < a.size() - 2; i++) {
		string b = a.substr(i, 3);
			if (abs(stoi(b) - 753) < c) {
				c = abs(stoi(b)-753);
			}
	}
	cout << c << endl;
	return 0;
}

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

// DEBUG - Start of snippet
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
	return '"' + s + '"';
}

string to_string(const char& c){
	string res;
	return "'" + res + c + "'";
}
 
string to_string(bool b) {
	return (b ? "True" : "False");
}

string to_string(vector<bool> v) {
	bool first = true;
	string res = "{";
	for (int i = 0; i < static_cast<int>(v.size()); i++) {
	if (!first) {
    	res += ", ";
  	}
  	first = false;
	res += to_string(v[i]);
	}
	res += "}";
	return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
	string res = "";
	for (size_t i = 0; i < N; i++) {
		res += static_cast<char>('0' + v[i]);
	}
	return res;
}
 
template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto &x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}";
	return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
   	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
   	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr<<endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "\t[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else		
#define debug(...) 0
#endif
// DEBUG - End of snippet

// THINK: INT vs LONG LONG?

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

	int n, x, y;
	cin >> n >> x >> y;
	--x, --y;
	vector<vector<int>> adj(n);
	for (int i = 0; i < n - 1; ++i) {
		adj[i].push_back(i + 1);
		adj[i + 1].push_back(i);
	}
	adj[x].push_back(y);
	adj[y].push_back(x);

	debug(adj);	

	vector<int> dist(n);
	auto bfs = [&](int s) {
		vector<bool> vis(n);
		queue<int> q;

		q.push(s);
		vis[s] = true;
		dist[s] = 0;

		while (!q.empty()) {
			int u = q.front();
			q.pop();

			for (int v: adj[u]) {
				if (vis[v]) continue;
				dist[v] = dist[u] + 1;
				vis[v] = true;
				q.push(v);
			}
		}
	};

	vector<int> cnt(n);
	for (int i = 0; i < n; ++i) {
		bfs(i);
		for (int j = i + 1; j < n; ++j) {
			cnt[dist[j]]++;
		}
		dist.assign(n, 0);
	}

	for (int i = 1; i < n; ++i) {
		cout << cnt[i] << '\n';
	}
	cout << '\n';


	return 0;
}

Measured memory_bytes: 3780
mod = 10**9 + 7
X, Y = map(int, input().split())

if (X+Y) % 3 != 0:
    print(0)
    exit()
n = (X+Y)//3
r = Y-n


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


N = 10**6+100
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


print(cmb(n, r, mod))


Measured memory_bytes: 127432
N = int(input())
a_array = list(map(int, input().split()))

P = 10 ** 9 + 7
mod_array = [0] * 60
digit_array = [0] * 60
p = 1
for i in range(60):
    mod_array[i] = p
    p = (p * 2) % P

for a in a_array:
    for i in range(60):
        digit_array[i] += (a & (1 << i)) >> i
# print(digit_array)
ans = 0

for i in range(60):
    ans = (ans + mod_array[i] * digit_array[i] * (N - digit_array[i]) % P) % P

print(ans)


Measured memory_bytes: 122936
import java.util.Scanner;

class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int max = -1;
		int ind = -1;
		for(int i = 0; i < n; ++i){
			int d = sc.nextInt();
			int c = sc.nextInt();
			if( c > max ){
				max = c;
				ind = d;
			}else if( c == max ){
				if( ind > d ) ind = d;
			}
		}
		
		System.out.println( ind + " " + max );
		
	}
}

Measured memory_bytes: 17364
#include<iostream>
using namespace std;
int main() {
  int r;
  cin >> r;
  if(r < 1200){
    cout << "ABC" << endl;
  }else if(r <2800 && r >= 1200){
    cout << "ARC" << endl;
  }else{
    cout << "AGC" << endl;
  }
}

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

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

	if (S == T) {
		cout << "Yes" << endl;
		return 0;
	}
	int n = S.length();
	string now;
	string before = S;
	while (n--) {
		char tail = before[S.length() - 1];
		now = tail + before.substr(0, S.length() - 1);
		if (now == T) {
			cout << "Yes" << endl;
			return 0;
		}
		before = now;
	}
	

	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
#endif

	
	
		int n,m;
		cin>>n>>m;
		vector<int> a(n+1);
		for(int i=1;i<=n;i++)
		{
			cin>>a[i];
		}
		vector<bool> ans(n+1,1);
		for(int i=0;i<m;i++)
		{
			int x,y;
			cin>>x>>y;
		
			
			ans[x]=ans[x] && (a[x]>a[y]);
			ans[y]=ans[y] && (a[y]>a[x]);

			
		}
		int count=0;
		for(int i=1;i<=n;i++)
		{
			if(ans[i])
			{
				count++;
			}
		}

		cout<<count;

	return 0;
}


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

int insertionSort(int A[], int n, int g, int cnt){
    for (int i = g; i < n; i++){
        int v = A[i];
        int j = i-g;
        while (j >= 0 and A[j] > v){
            A[j+g] = A[j];
            j -= g;
            cnt ++;
        }
        A[j+g] = v;
    }
    
    return cnt;
}

int shellSort(int A[], int n){
    int cnt = 0;
    int m = 0;
    while (std::pow(3, m+1) -1 <= n * 2) m ++;
    int G[m];
    for ( int i = 0; i < m; i++) G[i] = (std::pow(3, m-i) - 1) / 2;
    
    cout << m << endl;
    for ( int i = 0; i < m; i++){
        if (i) cout << ' ';
        cout << G[i];
    }
    cout << endl;
    
    for ( int i = 0; i < m; i ++) cnt = insertionSort(A, n, G[i], cnt);
    cout << cnt << endl;
    
    return 0;
}

int main(){
    int n;
    cin >> n;
    int A[n];
    for ( int i = 0; i < n; i++) cin >> A[i];
    shellSort(A, n);
    
    for ( int i = 0; i < n; i++){
        cout << A[i] << endl;
    }
}



Measured memory_bytes: 7160
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl

int main(){
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  int sum = 0;
  rep(i, N){
    sum += A[i];
  }
  int cnt = 0;
  rep(i, N){
    if(4*M*A[i] >= sum) cnt++;
  }
  string ans = "No";
  if(cnt >= M) ans = "Yes";
  cout << ans << endl;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
""""
n,T = LI()
ans = 0
t = LI()
for i in range(n-1):
    ans += min(T,t[i+1]-t[i])
ans += T
print(ans)
"""

#D
n,w = LI()
g = LIR(n)
l = [[] for i in range(4)]
for W,v in g:
    l[W-g[0][0]].append(v)
    l[W-g[0][0]].sort(reverse = True)
l0 = len(l[0])
l1 = len(l[1])
l2 = len(l[2])
l3 = len(l[3])
for i in range(l0-1):
    l[0][i+1] += l[0][i]
l[0].insert(0,0)
for i in range(l1-1):
    l[1][i+1] += l[1][i]
l[1].insert(0,0)
for i in range(l2-1):
    l[2][i+1] += l[2][i]
l[2].insert(0,0)
for i in range(l3-1):
    l[3][i+1] += l[3][i]
l[3].insert(0,0)
ans = 0
for i in range(l0+1):
    for j in range(l1+1):
        for k in range(l2+1):
            for m in range(l3+1):
                if i*g[0][0]+j*(g[0][0]+1)+k*(g[0][0]+2)+m*(g[0][0]+3) <= w:
                    ans = max(ans,l[0][i]+l[1][j]+l[2][k]+l[3][m])
print(ans)
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 40944
#include <iostream>

using namespace std;

int main()
{
    int x, y, z;
    cin >> x >> y >> z;

if ((x == 5 && y == 7 && z == 5) || (x == 7 && y == 5 && z == 5) || (x == 5 && y == 5 && z == 7))
        cout << "YES";

    else 
        cout << "NO";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define space " "
#define MOD (long long) 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename T> void __f(const char* variable_name, T&& value){cout << variable_name << ": " << value << endl;}
template <typename T1, typename... T2> void __f(const char* names, T1&& arg1, T2&&... args){const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << ": " << arg1 << " |";__f(comma + 1, args...);}

const ll N = 5e5 + 5;
ll *v;
ll n;

void solve(){
    cin >> n;
    while(n > 0){
        if(n % 10 == 7){
            cout << "Yes" << endl;
            return;
        }
        n /= 10;
    }
    cout << "No" << endl;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    // cout << "\n\nBLAH BLAH BLAH\n\n";
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var LRD = ReadInts();
            var ans = 0;
            for (int i = LRD[0]; i <= LRD[1]; i++)
            {
                if (i % LRD[2] == 0) ans++;
            }
            WriteLine(ans);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 27336
#include <bits/stdc++.h>
#include <string>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using ll = long long;

int main(){
    int n, k;
    cin >> k >> n;
    vector<int> ie(n);
    rep(i,n){
        cin >> ie[i];
    }
    vector<int> kyo(n);
    rep(j,n-1){
        kyo[j] = ie[j+1] - ie[j];
    }
    kyo[n-1] = k - ie[n-1] + ie[0];
    int mx = 0;
    rep(i,n){
        mx = max(mx, kyo[i]);
    }
    cout << k - mx << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ

signed main(){
    constexpr ll MOD = 998244353;
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    char a; cin >> a;
    if(islower(a)) cout << "a" << endl;
    else cout << "A" << endl;
}



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

using namespace std;

using ll = long long;
using ld = long double;

#define int long long
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

void accell() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
}
int w[3000];

signed main() {
    accell();
    int n;
    cin >> n;
    int a[n];
    int ans[n] = {};
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    ans[n - 1] = a[n - 1];
    for (int i = n - 2; i >= 0; i--) {
        if (i % 2 == 0) ans[n - 1] -= a[i];
        else ans[n - 1] += a[i];
    }
    for (int i = n - 2; i >= 0; i--) {
        ans[i] = 2 * a[i] - ans[i + 1];
    }
    for (int i = 0; i < n; i++) cout << ans[i] << ' ';
    return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#include <cstdio>

using namespace std;

typedef pair<int, int> P;

P field[300];
int N;

void init() {

}

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

int main() {
  while (true) {
    scanf("%d ", &N);
    if (N == 0) {
      return 0;
    }
    init();
    field[0].first = 0;
    field[0].second = 0;
    for (int i = 1; i < N; i++) {
      int n, d;
      scanf("%d %d ", &n, &d);
      int x = field[n].first;
      int y = field[n].second;
      field[i].first = x + dx[d];
      field[i].second = y + dy[d];
    }

    int minx = 0, miny = 0, maxx = 0, maxy = 0;
    for (int i = 0; i < N; i++) {
      int x = field[i].first;
      int y = field[i].second;
      minx = min(minx, x);
      miny = min(miny, y);
      maxx = max(maxx, x);
      maxy = max(maxy, y);
    }
    printf("%d %d\n", maxx - minx + 1, maxy - miny + 1);
  }
}

Measured memory_bytes: 0
A, B = map(int, input().split())
count=0

for i in range(A, B+1, 1):
  s = str(i)
  a = int(s[4])
  b = int(s[3])
  c = int(s[1])
  d = int(s[0])
  
  if a==d and b==c:
    count+=1
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long ll;

#define rep(i, a, n) for (ll i = a; i < (ll)n; ++i)
#define INF 10e12
#define MOD 1000000000 + 7
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;
int main(void)
{
    int n;
    cin >> n;
    cout << n * n * n << endl;
}

Measured memory_bytes: 3492
#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define FOR(i,p,q) for(int i = p; i < q; i++)
typedef long long ll;

int n;
string t;

int main()
{
	cin >> t;
	int out1 = -1;
	int out2 = -1;
	bool found = false;
	
	FOR(i,0,(int)t.length()-1) {
		if (t.at(i) == t.at(i+1)) {
			out1 = i+1;
			out2 = i+2;
			found = true;
			break;
		}
	}
	if (!found) {
		FOR(i,0,(int)t.length()-2) {
			if (t.at(i) == t.at(i+2)) {
				out1 = i+1;
				out2 = i+3;
			}
		}
	}
	cout << out1 << " " << out2 << endl;
	return 0;
}


Measured memory_bytes: 512
class Combination
  #　組み合わせに必要な階乗、逆数、逆元の計算を初期化時に行って、のちの個別の計算を高速にする。
  def initialize(max_n, mod = 10 ** 9 + 7)
    @mod   = mod
    @max_n = max_n

    @fac  = Array.new(@max_n + 1) # 階乗
    @inv  = Array.new(@max_n + 1) # 逆数
    @finv = Array.new(@max_n + 1) # 逆元

    @fac[0]  = @fac[1] = 1
    @finv[0] = @finv[1] = 1
    @inv[1]  = 1
    2.upto(@max_n) do |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
    end
  end

  def nCk(n, k)
    return 0 if (n < 0 || k < 0 || k > n)
    @fac[n] * @finv[n - k] * @finv[k] % @mod
  end

  def nPk(n, k)
    return 0 if (n < 0 || k < 0 || k > n)
    #@fac[n] * @finv[n - k] % @mod
    nCk(n, k) * @fac[k] % @mod
  end
end

$combination = Combination.new(1000000)

$n, $k = gets.chomp.split.map(&:to_i)
$edge  = Array.new($n).map { Array.new() }

($n - 1).times do
  a, b = gets.chomp.split.map(&:to_i).map(&:pred)
  $edge[a] << b;
  $edge[b] << a;
end


$ans    = 1
$MOD    = 10 ** 9 + 7
stack   = [0]
visited = [false] * $n

while (!stack.empty?)
  i          = stack.pop
  visited[i] = true
  if i == 0
    $ans = $combination.nPk($k, $edge[0].size + 1)
  else
    $ans *= $combination.nPk($k - 2, $edge[i].size - 1)
  end
  $ans %= $MOD
  $edge[i].each do |v|
    next if visited[v] == true
    stack << v
  end
end

puts $ans





Measured memory_bytes: 36476
#include <stdio.h>
int main(){
  
  int n,i;
  char str[1001];
  int sum=0;
  

  for(;;){
    scanf("%s",str);
    sum=0;
    if(str[0]=='0'){
      break;
    }

    for(i=0;str[i]!='\0';i++){
      sum+=(str[i]-'0');  
    }
	 
    printf("%d\n",sum);

	


     

  }


  return 0;
}

Measured memory_bytes: 964
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	T := sc.Next()
	out := []byte(T)
	for i, _ := range T {
		if out[i] == '?' {
			if i > 0 && out[i-1] == 'P' {
				out[i] = 'D'
			} else if i < len(out)-1 && (out[i+1] == '?' || out[i+1] == 'D') {
				out[i] = 'P'
				out[i+1] = 'D'
			} else {
				out[i] = 'D'
			}
		}
	}
	fmt.Println(string(out))

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 3704
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
using namespace std;

#ifdef WAFDAYO
#define DBG_PRINT(s, t, u) { cerr << s << " \e[2m=\e[m \e[1m" << t << "\e[m" << u; }
#else
#define DBG_PRINT(s, t, u) {}
#endif
#define dbg(x) DBG_PRINT(#x, x, ", ")
#define dbgln(x) DBG_PRINT(#x, x, endl)
#define idbg(x, i) DBG_PRINT(#x "[" << i << "]", x[i], ", ")
#define idbgln(x, i) DBG_PRINT(#x "[" << i << "]", x[i], endl)

typedef long long i64;
const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;

int main() {

	int h, w, k;
	vector<vector<int>> sb;

	scanf("%d%d%d", &h, &w, &k);
	sb.resize(w);
	for(auto& v : sb) {
		v.resize(h, -1);
	}
	int k_it = 0;
	for(int i = 0; i < h; i++) {
		char buf[312];
		scanf("%s", buf);
		for(int j = 0; j < w; j++) {
			if(buf[j] == '#') {
				sb[j][i] = k_it;
				k_it += 1;
			}
		}
	}

	for(int y = 0; y < h; y++) {
		for(int x = 1; x < w; x++) {
			if(sb[x][y] == -1) {
				sb[x][y] = sb[x - 1][y];
			}
		}
		for(int x = w - 2; x >= 0; x--) {
			if(sb[x][y] == -1) {
				sb[x][y] = sb[x + 1][y];
			}
		}
	}

	for(int y = 1; y < h; y++) {
		for(int x = 0; x < w; x++) {
			if(sb[x][y] == -1) {
				sb[x][y] = sb[x][y - 1];
			}
		}
	}

	for(int y = h - 2; y >= 0; y--) {
		for(int x = 0; x < w; x++) {
			if(sb[x][y] == -1) {
				sb[x][y] = sb[x][y + 1];
			}
		}
	}

	for(int y = 0; y < h; y++) {
		for(int x = 0; x < w; x++) {
			printf("%d%c", sb[x][y] + 1, (x == w - 1) ? '\n' : ' ');
		}
	}

	return 0;
}


// wafdayo~~~


Measured memory_bytes: 1152
as1 = [int(elem) for elem in input().split()]
as2 = [int(elem) for elem in input().split()]
as3 = [int(elem) for elem in input().split()]
n = int(input())
for i in range(n):
  b = int(input())
  if b in as1:
    as1[as1.index(b)] = -1
  elif b in as2:
    as2[as2.index(b)] = -1
  elif b in as3:
    as3[as3.index(b)] = -1

if as1[0] == -1 and as2[0] == -1 and as3[0] == -1:
  print("Yes")
elif as1[1] == -1 and as2[1] == -1 and as3[1] == -1:
  print("Yes")
elif as1[2] == -1 and as2[2] == -1 and as3[2] == -1:
  print("Yes")
elif as1[0] == -1 and as2[1] == -1 and as3[2] == -1:
  print("Yes")
elif as1[2] == -1 and as2[1] == -1 and as3[0] == -1:
  print("Yes")  
elif as1[0] == -1 and as1[1] == -1 and as1[2] == -1:
  print("Yes")
elif as2[0] == -1 and as2[1] == -1 and as2[2] == -1:
  print("Yes")
elif as3[0] == -1 and as3[1] == -1 and as3[2] == -1:
  print("Yes")
else:
  print("No")
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
string s;
int n;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>s;
sort(s.begin(),s.end());
for(int i=0;i<s.size();i++){
    if(s[i]==s[i+1])n++;
}
if(n>0)cout<<"no";
else cout<<"yes";
return 0;}



Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin>>n;
   int a[n];
   for(int i=1;i<=n;i++){
   	cin>>a[i];
   	
   }
   int c=0;
   for(int i=1;i<=n;i++){
   	if(i%2!=0 && a[i]%2!=0){
   		c++;
   	}
   }
   cout<<c;
   
}

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

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS * max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x * x + y * y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;

int main() 
{
	int N, H, W;
	cin >> N >> H >> W;

	ll ans = (N - H + 1)*(N - W + 1);


	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <numeric>
#include <functional>
#include <cmath>
#include <cassert>
#include <string>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
#define PI (acos(-1))

ll lcm(ll a,ll b){
    return a * b / __gcd(a, b);
}
vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

const ll MAX = 510000;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll 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(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll a[101010];
ll solve()
{
    ll n, k;
    cin >> n >> k;
    for(int i=0; i < n; i++){
        cin >> a[i];
    }
    sort(a, a + n);
    COMinit();
    if(k == 1){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 0;
    ll ansp = 0;
    for(int i=0; i < n; i++){
        if (n - 1 - i >= k - 1){
            ans += (a[n - 1 - i] * COM(n - 1 - i, k - 1)) % MOD;
            ansp += (a[i] * COM(n - 1 - i, k - 1)) % MOD;
        }
    }
    cout << (ans - ansp + MOD)%MOD << endl;

    return 0;
}

int main()
{
    //cout.precision(10);
    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();
}


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

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

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

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

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

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  vl A;
  string S;
  cin >> S;
  if (S == "ARC")
    cout << "ABC" << endl;
  else
    cout << "ARC" << endl;

  return 0;
}


Measured memory_bytes: 3568
s=input()
i=c=p=0;b=''
while i<len(s):
    if s[i]==b:
        if c > p:r=b;p=c
        c=0
    b=s[i]
    i+=[3,7][s[i]=='c']
    c+=1
if c>p:r=b
print(['chicken','egg'][r=='e'])

Measured memory_bytes: 7508
#include<stdio.h>

void init(int *card,int n);
void cut(int *card,int n,int k);
void shuffle(int *card,int n);
void output(int *card,int n);

int main()
{
	int card[200];
	int m,n,k,i;

	scanf("%d",&n);
	scanf("%d",&m);
	init(card,n);
	for(i=0;i<m;i++)
	{
		scanf("%d",&k);
		if(k==0)
		{
			shuffle(card,n);
		}
		else
		{
			cut(card,n,k);
		}
	}
	output(card,n);
	return 0;
}

void init(int *card,int n)
{
	int i;
	for(i=0;i<n*2;i++)
	{
		card[i]=i+1;
	}
}

void cut(int *card,int n,int k)
{
	int temp[200],i;
	for(i=0;i<k;i++)
	{
		temp[i]=card[i];
	}
	for(i=k;i<n*2;i++)
	{
		card[i-k]=card[i];
	}
	for(i=0;i<k;i++)
	{
		card[2*n-k+i]=temp[i];
	}
}

void shuffle(int *card,int n)
{
	int temp[100],i;
	for(i=0;i<n;i++)
	{
		temp[i]=card[n+i];
	}
	for(i=n-1;i>=0;i--)
	{
		card[i*2]=card[i];
	}
	for(i=0;i<n;i++)
	{
		card[i*2+1]=temp[i];
	}
}

void output(int *card,int n)
{
	int i;
	for(i=0;i<n*2;i++)
	{
		printf("%d\n",card[i]);
	}
}

Measured memory_bytes: 0
import sys
input = sys.stdin.readline
S = input().strip()
Q = int(input())
f = 0
add = ['', '']
for q in range(Q):
    query = input().strip()
    if query == '1':
        f ^= 1 
    else:
        _, F, C = query.split(' ')
        add[int(F)-1^f] += C
if f == 0:
    print(''.join([add[0][::-1], S, add[1]]))
else:
    print(''.join([add[1][::-1], S[::-1], add[0]]))

Measured memory_bytes: 4416
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;



int main(){

    int i;
    string s;
    cin >> s;
    for(i=1;i<4;i++){
        if(s[i]==s[i-1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;

    return 0;
}

Measured memory_bytes: 256