akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;
ll mod = (int)1e9 + 7;
ll binPow(ll a, ll n){
    ll res = 1;
    while(n){
        if(n & 1){
            res *= a;
            res %= mod;
        }
        a *= a;
        a %= mod;
        n >>= 1;
    }
    return res;
}
ll fact(ll n,int st = 2){
    ll res = 1;
    for(ll i = st; i <= n; ++i){
        res *= i;
        res %= mod;
    }
    return res;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    ll n,a,b;
    cin >> n >> a >> b;
    ll ans = binPow(2,n);
    --ans;
    ll t1n = fact(n,n - a+1);
    ll t1m = fact(a);
    ll ans2 = (binPow(t1m, mod - 2) * t1n)%mod;
    ll t2n = fact(n,n - b+1);
    ll t2m = fact(b);
    ll ans3 = (binPow(t2m, mod - 2) * t2n)%mod;
    cout << ((ans + 2*mod)-(ans2 + ans3))%mod<<'\n'; 
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

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

using namespace std;

int main()
{
	int N;
	string in;
	bool flag = true;

	cin >> in;
	
	sort(in.begin(),in.end());

	in.erase(std::unique(in.begin(), in.end()), in.end());

	char start = 'a';
	char end = 'z';
	string ans = "None";



	for (char i = start; i <= end; ++i)
	{
		if (count(in.cbegin(), in.cend(), i) == 0)
		{
			ans = i;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#include <cstring>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define sz(x) ((int)(x).size())
#define pii pair<int, int>
#define trav(a,x) for (auto& a : x)
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const ll mod = 998244353;



int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int a, b, c; cin >> a >> b >> c;
    cout << c << " " << a << " " << b;


    return 0;
}












Measured memory_bytes: 3152
def examB():
    N = I(); A,B = LI()
    P = LI()
    exam = [0]*3
    for i in P:
        if i<=A:
            exam[0] +=1
        elif i<=B:
            exam[1] +=1
        else:
            exam[2] +=1
    ans = min(exam)
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examB()

Measured memory_bytes: 38384
n=int(input())
index=int(n/2)-1
x=list(map(int,input().split()))
y=[]
for i in range(n):
  y.append(x[i])
y.sort()
med=y[index]
for i in range(n):
    if x[i]>med:
        print(med)
    else:
        print(y[index+1])    
    
    



Measured memory_bytes: 26180
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100001;

vector <int> adj[MAXN];
int memo[MAXN];

int dfs(int node)
{
    if(memo[node] != -1)return memo[node];
    int res = 0;
    for(auto x : adj[node])
        res = max(res,dfs(x) + 1);
    return memo[node] = res;
}

int main()
{
    int a,b,n,m;
    scanf("%d %d",&n,&m);
    for(int i = 0; i <m; i++)
    {
        scanf("%d %d",&a,&b);
        adj[a].push_back(b);
    }
    memset(memo,-1,sizeof(memo));
    int res = 0;
    for(int i = 1; i <=n; i++)
        res = max(res,dfs(i));
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 8192
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys;input = sys.stdin.readline
inp,ip = lambda :int(input()),lambda :[int(w) for w in input().split()]

import sys
sys.setrecursionlimit(10**6)

def dfs(u):
    global grpah,vis,dp
    vis.add(u)
    for i in graph[u]:
        if i not in vis:
            dfs(i)
        dp[u] = max(dp[u],dp[i] + 1)

n,m = ip()
graph = {i:[] for i in range(1,n+1)}
for i in range(m):
    a,b = ip()
    graph[a].append(b)
dp = [0]*(n+1)

vis = set()
for i in range(1,n+1):
    if i not in vis:
        dfs(i)
#print(dp)
print(max(dp))

Measured memory_bytes: 163508
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val array = (1..n).map {
        readLine()!!.toInt()
    }

    var min = array[0]
    var max = array[1] - min
    array.forEachIndexed { index, num ->
        if (index == 0) return@forEachIndexed
        if (max < (num - min)) max = num - min
        if (min > num) {
            min = num
        }
    }
    println(max)
}


Measured memory_bytes: 52144
#!/usr/bin/env python3
import sys


def f(n):
    cnt = 0
    while n % 2 == 0:
        cnt += 1
        n //= 2
    return cnt

def solve(N:int, A: "List[int]"):
    print(sum([ f(n) for n in A ]))



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4340
#include <iostream>
#include <vector>
#include <functional>

template<class T> class segment_tree {
	int N = 1; // the number of leaves
	std::vector<T> value;

public :
	const std::function<T(T, T)> op; // binary operation
	const T id; // identity element

	segment_tree(const std::vector<T>& v, const std::function<T(T, T)>& f, const T& t) : op(f), id(t) {
		int n = v.size();
		while (N < n) N *= 2;
		value.resize(N * 2, id);
		for (int i = 0; i < n; ++i) value[N + i] = v[i];
		for (int i = N - 1; i > 0; --i) value[i] = op(value[i * 2], value[i * 2 + 1]);
	}
	segment_tree(const int& n, const std::function<T(T, T)>& f, const T& t) : op(f), id(t) {
		while (N < n) N *= 2;
		value.resize(N * 2, id);
	}

	void point_update(const int& k, const T& t) {
		value[N + k] = t;
		for (int i = (N + k) / 2; i > 0; i /= 2) value[i] = op(value[i * 2], value[i * 2 + 1]);
	}

	T range_fold(const int& L, const int& R, const int& k = 1, const int& l = 0, int r = -1) const {
		if (r == -1) r = N;
		if (r <= L || R <= l) return id;
		if (L <= l && r <= R) return value[k];
		int mid = (l + r) / 2;
		return op(range_fold(L, R, k * 2, l, mid), range_fold(L, R, k * 2 + 1, mid, r));
	}

	const T& operator[](const int& k) const {return value[N + k];}
};

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

	int N, K;
	std::cin >> N >> K;
	std::vector<int> A(N);
	for (int i = 0; i < N; i++) std::cin >> A[i];

	segment_tree<int> dp(300001, [](int a, int b){return std::max(a, b);}, 0);
	for (int i = 0; i < N; i++) {
		int m = dp.range_fold(A[i] - K, A[i] + K + 1);
		dp.point_update(A[i], m + 1);
	}
	std::cout << dp.range_fold(0, 300001) << '\n';
}

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

int main(void){

  int n;
  std::cin >> n;
  std::vector<int> A(n);
  std::map<int, int> COUNT;
  for(int i=0; i<n; i++){
    std::cin >> A[i];
    if(COUNT.find(A[i]) == COUNT.end()){
      COUNT[A[i]] = 0;
    }
    COUNT[A[i]]++;
  }

  for(int i=0; i<n; i++){
    auto it = COUNT.find(A[i]);
    if((*it).second >= 2){
      std::cout << (*(COUNT.rbegin())).first << std::endl;
    }else{
      COUNT.erase(A[i]);
      std::cout << (*(COUNT.rbegin())).first << std::endl;
      COUNT[A[i]] = 1;
    }
  }

  return 0;
}

Measured memory_bytes: 7936
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
def unite(x, y):
    p = find(x)
    q = find(y)
    if p == q:
        return None
    if p > q:
        p,q = q,p
    par[p] += par[q]
    par[q] = p
def same(x, y):
    return find(x) == find(y)
def size(x):
    return -par[find(x)]
n, q = map(int, input().split())
par = [-1 for i in range(n)]
for i in range(q):
    t, u, v = map(int, input().split())
    if t == 0:
        unite(u, v)
    else:
        print(1 if same(u, v) else 0)

Measured memory_bytes: 11528
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    String s = sc.next();
    if (s.equals("Sunny")) {
      pw.println("Cloudy");
    }
    if (s.equals("Cloudy")) {
      pw.println("Rainy");
    }
    if (s.equals("Rainy")) {
      pw.println("Sunny");
    }
  }
}


Measured memory_bytes: 21844
// AOJ 0590: Available Areas
// 2017.10.1 bal4u@uu
// 2017.11.14

#include <stdio.h>

int check(int s)
{
	int x, u, v, w;

	for (u = 3, w = v = 4, x = -1; v <= s; x--, u += 2, w += 4, v += w) {
//printf("s %d, x %d, u %d, v %d\n", s, -x, u, v);
		if ((s + x) % u == 0) return 0;
	}
	return 1;
}

char buf[15], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int n, ans;

	fgets(p=buf, 15, stdin), n = getint();
	ans = 0; 
	while (n --) {
		fgets(p=buf, 15, stdin);
		if (check(getint())) ans++;
	}
	printf("%d\n", ans);
	return 0;
}

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

char map[1002][1002];

struct solve {
	int x, y, depth;
};

int startx, starty;

int main() {
	for (int i = 0; i < 1002; i++)for (int j = 0; j < 1002; j++) map[i][j] = 'X';

	int h, w, cheese;
	cin >> h >> w >> cheese;

	for (int i = 0; i < h; i++)for (int j = 0; j < w; j++) {
		char temp;
		cin >> temp;
		if (temp == 'S') {
			starty = i + 1;
			startx = j + 1;
		}
		map[i + 1][j + 1] = temp;
	}

	int ans = 0;

	for (int i = 1; i <= cheese; i++) {

		bool used[1002][1002] = { 0 };
		used[starty][startx] = true;
		solve point = { startx,starty, 0 };
		queue<solve> q;
		q.push(point);
		while (!q.empty()) {
			solve u = q.front(); q.pop();

			if (map[u.y][u.x] == i + '0') {

				startx = u.x;
				starty = u.y;
				ans += u.depth;
				break;
			}

			if ((map[u.y + 1][u.x] != 'X') && (used[u.y + 1][u.x] == false)) {
				solve temp = { u.x , u.y + 1 , u.depth + 1 };
				used[u.y + 1][u.x] = true;
				q.push(temp);
			}
			if ((map[u.y - 1][u.x] != 'X') && (used[u.y - 1][u.x] == false)) {
				solve temp = { u.x , u.y - 1 , u.depth + 1 };
				used[u.y - 1][u.x] = true;
				q.push(temp);
			}
			if ((map[u.y][u.x + 1] != 'X') && (used[u.y][u.x + 1] == false)) {
				solve temp = { u.x + 1 , u.y , u.depth + 1 };
				used[u.y][u.x + 1] = true;
				q.push(temp);
			}

			if ((map[u.y][u.x - 1] != 'X') && (used[u.y][u.x - 1] == false)){
				solve temp = { u.x - 1 , u.y , u.depth + 1 };
				used[u.y][u.x - 1] = true;
				q.push(temp);
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 5104
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int d = fabs(a-b);
    int e = fabs(b-c);
    int f = fabs(a-c);
    int g = max({d, e, f});
    cout << d+e+f-g << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <ctime>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=100+10;
const int maxm=100000+10;
const int mod=(int)1e9+7;
const int INF=0x3f3f3f3f;
const ll LINF=(1LL<<62);
const double eps=1e-8;
const double PI=acos(-1.0);
#define mst(a,b) memset(a,b,sizeof(a))
#define rep(i,a,b) for (int i=(a);i<b;i++)
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define lowbit(x) x&(-x)
#define X first
#define Y second
int a[maxn],n;
vector<pii> ans;
void hehe(int op){
    if (op){
        for (int i=2;i<=n;i++){
            ans.push_back(make_pair(i-1,i));
        }
    } else {
        for (int i=n-1;i>=1;i--){
            ans.push_back(make_pair(i+1,i));
        }
    }
}
int main(){
#ifdef local
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
#endif
    //ios::sync_with_stdio(false); cin.tie(0);
    scanf("%d",&n);
    int mn=INF,mx=-INF,p1,p2;
    for (int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if (a[i]>mx){
            mx=a[i];
            p1=i;
        }
        if (a[i]<mn){
            mn=a[i];
            p2=i;
        }
    }
    if (mx>0&&mn<0){
        if (abs(mx)>abs(mn)){
            for (int i=1;i<=n;i++){
                if (a[i]<0){
                    ans.push_back(make_pair(p1,i));
                    a[i]+=mx;
                }
            }
            hehe(1);
        } else {
            for (int i=1;i<=n;i++){
                if (a[i]>0){
                    ans.push_back(make_pair(p2,i));
                    a[i]+=mn;
                }
            }
            hehe(0);
        }
    }
    if (mx<=0) hehe(0); else if (mn>=0) hehe(1);
    printf("%d\n",ans.size());
    for (int i=0;i<ans.size();i++){
        printf("%d %d\n",ans[i].X,ans[i].Y);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    int n, k; cin >> n >> k;
    ll ans = 0;
    for(int i = k+1; i <= n; i++){
        int ab = n/i;
        ans += ab*(i-k);
        ans += max((n - ab*i)-(k-1), 0);
    }
  if(k == 0) ans -= n;
    cout << ans << endl;
}



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

dc = {}

def cnt_str(s , d:dict):
    if s in d.keys():
        d[s]+=1
    else:
        d[s]=1

for i in range(n):
    cnt_str(input(), dc)

maxc = max([c for k, c in dc.items()])

[print(s) for s in sorted(dc.keys()) if dc[s]==maxc]
    

Measured memory_bytes: 143088
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll D,N; cin >> D >> N;
    res = pow(100,D) * (N==100?101:N);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 512
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

S = str(input())

if S == 'ABC':
    print('ARC')
else:
    print('ABC')

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

using namespace std;

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

    char tmp=' ';
    string ans ="Good";
    for(char c: s){
        if(tmp == c){
            ans = "Bad";
        }else{
            tmp = c;
        }
    }

    cout << ans << endl;
}

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

#define ll long long
#define pb push_back
#define fori(a,b) for(int i=a;i<b;i++)
#define ford(b,a) for(int i=b;i>=a;i--)
typedef pair<int, int> pi;
#define PI 3.14159265359
//long long mod=1000000007;
//int count=INT_MAX;

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};
int isPal(string a,string b){
    int n=a.size();
    fori(0,n){
        if(a[i]!=b[i]) return 0;
        
    }
    return 1;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    //cin>>t;
    //cout<<t;
    //scanf("%d",&t);
    while(t--){
        ll n;
        cin>>n;
        string ans;
        // ll p=(ll)(log(n)/log(26LL);
        // p++;
        // ll done=(ll)pow(26,p-1);
        // n=n-done;

        // ll d=1;
        while(n>0){
            //d*=26LL;
            ll c=n%26LL;
            //cout<<c<<" ";
            //ans.pb('a'+(int)c-1);
            if(c==0LL){
                ans.pb('z');
                n/=26LL;
                n--;
            }
            else{
                ans.pb('a'+(int)c-1);
                n/=26LL;
            }
            //n=n/26LL;
            //d=d*26LL;
        }
        ford(ans.size()-1,0){
            cout<<ans[i];
        }
    }
    
    return 0;
}

Measured memory_bytes: 3652
function sort_with_number_count(array){
  var ranks = {};
  for(var i=0;i<array.length;i++){
    if(ranks[array[i]]==undefined){ranks[array[i]]=0;}
    ranks[array[i]]++;
  }

  var array_with_sorted_rank = [];
  const keys = Object.keys(ranks)
  for(var i=0;i<keys.length;i++){
    var key = keys[i];
    array_with_sorted_rank.push([key, ranks[key]]);
  }
  array_with_sorted_rank.sort(function(a, b){return b[1]-a[1];})

  return array_with_sorted_rank.map(x => parseInt(x[0]));
}

function change_count(array, number){

  var result = 0;
  for(var i=0;i<array.length;i++){
    if(array[i]!=number){result++;}
  }
  return result;
}

function main(input){
  const lines = input.split('\n');
  const N=parseInt(lines[0].trim());
  const vs= lines[1].trim().split(' ').map(x => parseInt(x));

  var odds = [];
  var evens = [];
  for(var i=0;i<N;i++){
    if(i%2==0){
      evens.push(vs[i]);
    }else{
      odds.push(vs[i]);
    }
  }

  const odds_sorted_minority  = sort_with_number_count(odds);
  const evens_sorted_minority  = sort_with_number_count(evens);

  var result = 0;
  var odds_first = odds_sorted_minority[0];
  var evens_first = evens_sorted_minority[0];
  if(N==2){
    if(odds_first==evens_first){
      result = 1;
    }
  }else{

    if(odds_first==evens_first){

      var evens_second = evens_sorted_minority[1];
      if(evens_second==undefined){evens_second = evens_first+1;}

      var odd_first_even_second = change_count(odds, odds_first) + change_count(evens, evens_second)

      var odds_second = odds_sorted_minority[1];
      if(odds_second==undefined){odds_second = odds_first+1;}
      var odd_second_even_first = change_count(odds, odds_second) + change_count(evens,  evens_first)

      result = Math.min(odd_first_even_second, odd_second_even_first);
    }else{
      result = change_count(odds, odds_first) + change_count(evens, evens_first);
    }
  }

  console.log(result);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 54676
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

#define MAX(x,y) (x>y?x:y)
#define MIN(x,y) (x<y?x:y)
#define ABS(x) (x>0?x:-(x))
#define INF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

typedef long long int lli;

void swap(int* a, int* b)
{
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

void ll_swap(lli* a, lli* b)
{
    lli tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

int gcd(int a, int b)
{
    if (a < b)
        swap(&a, &b);

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

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

long power(long x, int n) {
    long ans = 1;
    while (n > 0) {
        if ((n & 1) == 1) {
            ans = ans * x;
        }
        x = x * x;
        n >>= 1;
    }
    return ans;
}

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
		printf("res:%lld a:%lld\n", res,a);
	}
	return res;
}


lli comb(lli n, lli r)
{
    if (n == 0)
        return 0;

    if (r == 0 || r == n)
        return (1);
    else if (r == 1)
        return (n);
    return (comb(n - 1, r - 1) + comb(n - 1, r));
}

/*
#define MAX 100000
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;
}
*/


int main()
{
    char s[200], t[200];
    char t2[200];

    scanf("%s%s", s, t);

    sort(s, s + strlen(s));
    sort(t, t + strlen(t));

  
    for (int i = 0; i < strlen(t); i++)
        t2[i] = t[strlen(t)-1-i];

    if (strcmp(s, t2) < 0)
        printf("Yes");
    else
        printf("No");
}

Measured memory_bytes: 256
s1=list(input())
s2=list(input())
s3=list(input())
tmp='a'
for i in range(1000):
  if tmp=='a':
    if len(s1)==0:
      print('A')
      break
    tmp=s1.pop(0)
  if tmp=='b':
    if len(s2)==0:
      print('B')
      break
    tmp=s2.pop(0)
  if tmp=='c':
    if len(s3)==0:
      print('C')
      break
    tmp=s3.pop(0)
  

Measured memory_bytes: 3060
from collections import defaultdict

N = int(input())
A = list(map(int, input().split()))

modCount = defaultdict(int)

for a in A:
    modCount[a % 4] += 1

ness = modCount[1] + modCount[3] + modCount[2] % 2
if ness <= modCount[0] + 1:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 14636
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n;i++)
int main(void) {
	int n, a[100000], o = 0, c = 0;;cin >> n;
	rep(i, n) { cin >> a[i]; a[i]--; }
	for (;;) {
		if (o == 1) {
			cout << c << endl;
			return 0;
		}
		else if (c >= n) {
			cout << -1 << endl;
			return 0;
		}
		o = a[o];c++;
	}
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int n,ans,q[1<<17],f[1<<17],dp[1<<17],a[1<<17];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	memset(q,0x3f,sizeof(q));
	for(int i=1;i<=n;i++){
		f[i]=upper_bound(q+1,q+n,-a[i])-q;
		q[f[i]]=-a[i];
		ans=max(ans,f[i]);
	}
	cout<<ans<<endl;
 }


Measured memory_bytes: 4920
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import fractions
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

A, B, C, D = getNM()

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def split(n, m1, m2):
    opt1 = n // m1
    opt2 = n // m2
    opt3 = n // lcm_base(m1, m2)
    return n  - (opt1 + opt2 - opt3)
print(split(B, C, D) - split(A - 1, C, D))

Measured memory_bytes: 63980
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const pair<F,S>& p) {
    os << "(" << p.first << "," << p.second << ")"; return os; }
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "["; for(const T& a: v){ os << a << ", "; } os << "]"; return os; }
template <typename K, typename V> ostream& operator<<(ostream& os, const map<K,V>& m) {
    os << "{"; for(const auto& p: m){ os << p.first <<":"<< p.second << ", "; } os << "}"; return os; }


int main(){
    string s;
    cin >> s;
    if(s == "Sunny"){
        cout << "Cloudy" << endl;
    }else if(s == "Cloudy"){
        cout << "Rainy" << endl;
    }else{
        cout << "Sunny" << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD=1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
void YN(bool x){
  if(x) cout<<"Yes";
  else cout<<"No";
}

int main() {
  int N,T=0; cin>>N;
  vector<int> S(N);
  rep(i,N){
    cin>>S.at(i);
    T+=S.at(i);
  }
  bool ok=true;
  rep(i,N){
    if(S[i]>=T-S[i]) ok=false;
  }
  YN(ok);
}


Measured memory_bytes: 3620
from itertools import combinations

n = int(input())
s = input()
rs = s.count("R")
gs = s.count("G")
bs = s.count("B")
ans = rs * gs * bs

for i in range(n):
    for j in range(i + 1, n):
        k = j + j - i
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
print(ans)

Measured memory_bytes: 9100
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n;
    cin >> n;
    double ans = 0, x;
    string u;
    for(int i = 0; i < n; i++){
        cin >> x >> u;
        if(u == "JPY") ans += x;
        else                      ans += x * 380000;
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
	int n, m, i, f[1002] = {0};
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		int c, d;
		cin >> c >> d;
		f[c]++;
		f[d]--;
	}
	int ans = n + 1;
	for (i = 1; i < n + 2; i++) {
		f[i] += f[i - 1];
		if (f[i]) ans += 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3104
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
using namespace std;
typedef pair<int,int> P;//Pでpair<-,->を表す。
typedef long long LL; 
LL MOD=1000000007;

int main()
{ 
    LL h,w;
    cin>>h>>w;
    if(h==1||w==1){
        cout<<1<<endl;
        return 0;
    }
    if(h%2==0||w%2==0){cout<<h*w/2<<endl;}
    else{cout<<(h*w+1)/2<<endl;}
    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  char C[2][3];

  for (int i = 0; i < 2; i++) {
    for (int k = 0; k < 3; k++) {
      cin >> C[i][k];
    }
  }

  for (int i = 0; i < 3; i++) {
    if (C[0][i] != C[1][2 - i]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


Measured memory_bytes: 888
import sys

N,X,Y = map(int, input().split())

d = [0]*(N-1)

for i in range(N-1):
    for j in range(i+1,N):
        d[min(j-i,abs((X-1)-i)+1+abs((Y-1)-j))-1] += 1
        #print(i,j,min(j-i,abs((X-1)-i)+1+abs((Y-1)-j))-1)

for i in range(len(d)):
    print(d[i])

Measured memory_bytes: 74272
#include <bits/stdc++.h>
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(x) cout<<#x<<"="<<x<<endl;
#define endl '\n'
#define M 1000000007
#define int long long
#define INF 1e18
#define max_n 1000000

using namespace std;

void solve()
{
	ll h, w, m;
	cin >> h >> w >> m;
	unordered_map<ll, ll> r;
	unordered_map<ll, ll> c;
	map<pair<ll, ll>, ll> g;
	map<ll, bool> mxx, myy;
	for (int i = 0; i < m; ++i)
	{
		ll x, y;
		cin >> x >> y;
		x--, y--;
		g[ {x, y}] = 1;
		r[x]++; c[y]++;
	}
	ll ans = 0;
	for (auto it : g)
	{
		ans = max(ans, r[it.first.first] + c[it.first.second] - 1);
	}
	ll xx = 0, yy = 0;
	ll mx = 0, my = 0;
	for (int i = 0; i < h; ++i)
	{
		mx = max(mx, r[i]);
	}
	for (int i = 0; i < w; ++i)
	{
		my = max(my, c[i]);
	}
	for (int i = 0; i < h; ++i)
	{
		if (mx == r[i])mxx[i] = true;
	}
	for (int i = 0; i < w; ++i)
	{
		if (c[i] == my)myy[i] = true;
	}
	for (auto it : mxx)
		for (auto it2 : myy)
		{
			if (g[ {it.first, it2.first}] != 1)
			{
				ans = max(ans, mx + my);
				break;
			}
		}
	cout << ans << endl;
}

int32_t main()
{
	IOS
	ll T = 1;
	// cin >> T;
	for (ll i = 1; i <= T; ++i)
	{
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}

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

int main(void)
{
    int n, l;
    cin >> n >> l;
    int sumAll = 0;
    int tast = 0;
    int minTast = 1000;
    int sumMin;

    for(int i=1; i <= n; i++)
    {
        sumAll += l + i - 1;
    }
    for (int i = 1; i <= n ; i++)
    {
        tast = l + i - 1;
        if(abs(tast) < minTast)
        {
            minTast = abs(tast);
            sumMin = sumAll - tast;
        }
    }
    cout << sumMin << endl;
}

Measured memory_bytes: 256
from collections import defaultdict

N = int(input())
a = [int(x) for x in input().split()]

c = defaultdict(lambda: 0)
for a_i in a:
    c[a_i] += 1

ans = 0
for i, j in c.items():
    if i > j:
        ans += j
    elif i < j:
        ans += j - i
print(ans)


Measured memory_bytes: 18676
#include<iostream>
#include<algorithm>

using namespace std;
int main(){
  int n,k,i,j;
  cin >> n >> k;
  int a[n];
  for(i=0;i<n;i++)cin >> a[i];
  sort(a,a+n);
  int ret=a[n-1];
  for(i=0;i<=n-k;i++){
    ret=min(ret,a[i+k-1]-a[i]);
  }
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef pair< double,double> dd;
#define pb push_back
#define eb emplace_back
#define sz(a) int((a).size))
#define all(c) c.begin(),c.end()
#define FOR(i,a,b) for(i=a; i<b; i++)
#define FORR(i,a,b) for(i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define x first
#define y second
#define mp make_pair

const int INF = 1000000009;
const long long INFLL = (ll)INF * (ll)INF;
 
int number(int n,int b)
{
	int x=0;
	while(n!=0)
	{
		n=n/b;
		x++;
	} 
	return x;
}
int32_t main()
{
	int n,b;
	cin>>n>>b;
	int result;
	result = number(n,b);
	cout<<result;
	IOS;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    string s;cin >> s;
    vector<int> sm(n+1);
    REP(i,n){
        if(s[i]=='R'){
            sm[i+1]=sm[i]+1;
        }
        else{
            sm[i+1]=sm[i];
        }
    }
    int ans=inf;
    REP(i,n+1){
        int r1=sm[i],w1=i-r1,r2=sm[n]-sm[i],w2=n-i-r2;
        chmin(ans,max(w1,r2));
    }
    cout << ans << endl;
}

Measured memory_bytes: 4384
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, m;std::cin >> n >> m;
  std::cout << (n-1)*(m-1) << '\n';
}


Measured memory_bytes: 256
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B = sl()
    print("=" if ord(A) == ord(B) else "<" if ord(A) < ord(B) else ">")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.Scanner;

class Main {

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

        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int d = scan.nextInt();

        if (a == b && c == d || a == c && b == d || a == d && c == b) {
            System.out.println("yes");

        } else {
            System.out.println("no");
        }
    }
}



Measured memory_bytes: 26228
#[allow(unused_macros)]
macro_rules! parse_line {
    [$( $x:tt : $t:ty ),+] => {
        //declare variables
        $( let $x: $t; )+
        {
            use std::str::FromStr;
            // read
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            #[allow(deprecated)]
            let mut splits = buf.trim_right().split_whitespace();
            // assign each variable
            $(
                $x = splits.next().and_then(|s| <$t>::from_str(s).ok()).unwrap();
            )+
            // all strs should be used for assignment
            assert!(splits.next().is_none());
        }
    };
}

fn main() {
    parse_line![n: u32];

    let suffix = match n % 10 {
        2 | 4 | 5 | 7 | 9 => "hon",
        0 | 1 | 6 | 8 => "pon",
        _ => "bon",
    };

    println!("{}", suffix);
}


Measured memory_bytes: 2100
#include <cstdio>
#include <algorithm>
using namespace std;
struct me{
    int x,y;
}v[100005];
bool com(struct me a, struct me b){
    return a.x<b.x;
}
int main(){
    int n,q;
    scanf("%d%d",&n,&q);
    for(int i=1;i<=q;i++){
        scanf("%d%d",&v[i].x,&v[i].y);
        if(v[i].x>v[i].y)
            swap(v[i].x,v[i].y);
    }
    sort(v+1,v+1+q,com);
    int s=0;
    int p=0xfffffff,j=1;
    for(int i=1;i<=n;i++){
        if(i==p) {
            s++;
            p=0xfffffff;
        }
        for(j;v[j].x==i;j++){
            p=min(v[j].y,p);
        }

    }
    if(p!=0xfffffff)
        s++;
    printf("%d\n",s);
}

Measured memory_bytes: 896
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var n string
	fmt.Scan(&n)

	var ans []string
	for i := 0; i < len(n); i++ {
		ans = append(ans, string(n[0]))
	}
	origNum, _ := strconv.Atoi(n)
	ansNum, _ := strconv.Atoi(strings.Join(ans, ""))
	if ansNum < origNum {
		for i := 0; i < len(ans); i++ {
			num, _ := strconv.Atoi(ans[i])
			ans[i] = strconv.Itoa(num + 1)
		}
	}
	fmt.Println(strings.Join(ans, ""))
}


Measured memory_bytes: 1840
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long  
const int MAX = 1000001; 
  
// structure to store queries 
struct Query 
{ 
    int l, r, idx; 
}; 
  
// cmp function to sort queries according to r 
bool cmp(Query x, Query y) 
{ 
    return x.r < y.r; 
} 
  
// updating the bit array 
void update(int idx, int val, int bit[], int n) 
{ 
    for (; idx <= n; idx += idx&-idx) 
        bit[idx] += val; 
} 
  
// querying the bit array 
int query(int idx, int bit[], int n) 
{ 
    int sum = 0; 
    for (; idx>0; idx-=idx&-idx) 
        sum += bit[idx]; 
    return sum; 
} 
  
void answeringQueries(int arr[], int n, Query queries[], int q) 
{ 
    // initialising bit array 
    int bit[n+1]; 
    memset(bit, 0, sizeof(bit)); 
  
    // holds the rightmost index of any number 
    // as numbers of a[i] are less than or equal to 10^6 
    int last_visit[MAX]; 
    memset(last_visit, -1, sizeof(last_visit)); 
  
    // answer for each query 
    int ans[q]; 
    int query_counter = 0; 
    for (int i=0; i<n; i++) 
    { 
        // If last visit is not -1 update -1 at the 
        // idx equal to last_visit[arr[i]] 
        if (last_visit[arr[i]] !=-1) 
            update (last_visit[arr[i]] + 1, -1, bit, n); 
  
        // Setting last_visit[arr[i]] as i and updating 
        // the bit array accordingly 
        last_visit[arr[i]] = i; 
        update(i + 1, 1, bit, n); 
  
        // If i is equal to r of any query  store answer 
        // for that query in ans[] 
        while (query_counter < q && queries[query_counter].r == i) 
        { 
            ans[queries[query_counter].idx] = 
                     query(queries[query_counter].r + 1, bit, n)- 
                     query(queries[query_counter].l, bit, n); 
            query_counter++; 
        } 
    } 
  
    // print answer for each query 
    for (int i=0; i<q; i++) 
        cout << ans[i] << endl; 
} 
  
// driver code 
int main() 
{ 
	int n,q;
	cin>>n>>q;
	int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    Query queries[q]; 
    for(ll i=0;i<q;i++)
    {
        cin>>queries[i].l>>queries[i].r;
        queries[i].l--;
        queries[i].r--;
        queries[i].idx=i;
    }
    sort(queries, queries+q, cmp); 
    answeringQueries(a, n, queries, q); 
    return 0; 
} 


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

int main(){
    int N;
    cin >> N;
    vector<ll> a(3*N);
    for(int i=0;i<3*N;i++) cin >> a[i];


    priority_queue< ll,vector<ll>,greater<ll> > left_q;
    priority_queue< ll,vector<ll> > right_q;
    vector<ll> left_sum(N+1),right_sum(N+1);
    left_sum[0] = right_sum[0] = 0;
    for(int i=0;i<N;i++){
        left_q.push(a[i]);
        left_sum[0] += a[i];
        right_q.push(a[3*N-1-i]);
        right_sum[N] += a[3*N-1-i]; 
    }
    for(int i=0;i<N;i++){
        left_q.push(a[N+i]);
        left_sum[i+1] = left_sum[i] + (a[N+i]-left_q.top());
        left_q.pop();
        right_q.push(a[2*N-1-i]);
        right_sum[N-1-i] = right_sum[N-i] + (a[2*N-1-i]-right_q.top());
        right_q.pop();
    }
    ll ret = left_sum[N]-right_sum[N];
    for(int i=0;i<N+1;i++){
        // cout << left_sum[i] << " " << right_sum[i] << endl;
        ret = max(ret,left_sum[i]-right_sum[i]);
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 5996
l = []
l.append(list(map(int, input().split())))
l.append(list(map(int, input().split())))
l.append(list(map(int, input().split())))
# print(l)

x = int(input())
for i in range(x):
  n = int(input())
  for x in range(3):
    for y in range(3):
      if l[x][y] == n:
        l[x][y] = -1
# print(l)
isBingo = False
if l[0][0] * l[0][1] * l[0][2] == -1:
  isBingo = True
if l[1][0] * l[1][1] * l[1][2] == -1:
  isBingo = True
if l[2][0] * l[2][1] * l[2][2] == -1:
  isBingo = True
if l[0][0] * l[1][0] * l[2][0] == -1:
  isBingo = True
if l[0][1] * l[1][1] * l[2][1] == -1:
  isBingo = True
if l[0][2] * l[1][2] * l[2][2] == -1:
  isBingo = True
if l[0][0] * l[1][1] * l[2][2] == -1:
  isBingo = True
if l[2][0] * l[1][1] * l[0][2] == -1:
  isBingo = True
if isBingo:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38460
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

const int M=100010;

int main(){
  int n;
  cin>>n;
  
  map<ll,ll> m;
  m[0]=1;
  
  ll a,sum=0;
  rep(i,n){
    cin>>a;
    sum+=a;
    m[sum]++;
  }
  
  ll b,ans=0;
  for(auto u:m){
    b=u.second;
    ans=ans+b*(b-1)/2;
  }
  
  cout<<ans<<endl;
  
  return 0;
}

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

int main()
{
    int N, X, Y;
    cin >> N >> X >> Y;
    X--;
    Y--;
    auto M = Y - X + 1;
    vector<int> res(N-1, 0);
    for(int i=0; i<(M-1)/2; i++){
        res[i] += M;
    }
    if(M%2 == 0){
        res[M/2-1] += M/2;
    }
    for(int i=0; i<X; i++){
        for(int j=0; j<i+1; j++){
            res[j]++;
        }
        for(int j=0; j<(M-1)/2; j++){
            res[j+i+1] += 2;
        }
        if(M%2 == 0){
            res[(M-1)/2+i+1]++;
        }
    }
    for(int i=0; i<N-Y-1; i++){
        for(int j=0; j<i+1; j++){
            res[j]++;
        }
        for(int j=0; j<(M-1)/2; j++){
            res[j+i+1] += 2;
        }
        if(M%2 == 0){
            res[(M-1)/2+i+1]++;
        }
    }
    for(int i=0; i<X; i++){
        for(int j=0; j<N-Y-1; j++){
            res[X+1+j-i] += 1;
        }
    }

    for(auto v : res){
        cout << v << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    long n;
    scanf("%ld", &n);
    char str[n+1];
    scanf("%s", str);
    
    long nCount = 0;
    for(long i = 0; i < n; i++){
        if(str[i] == 'R'){
            nCount++;
        }
    }
    long nAns = 0;
    for(long i = 0; i < nCount; i++){
        if(str[i] == 'W'){
            nAns++;
        }
    }
  
    printf("%ld", nAns);
    return 0;
}


Measured memory_bytes: 3396
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<complex>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
	int n;
	cin>>n;
	lol(i,100000){
		if(i*i>n){
			cout<<(i-1)*(i-1)<<endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int a,b,aa[110000],c,cnt=0;
double d;
string s,ss;
signed main()
{
	cin>>a>>b>>c;
	cnt+=c;
	rep(i,a){
		cin>>aa[i];
		cnt+=(b-1)/aa[i]+1;
	}
	cout<<cnt;
}

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

int main(void) {
    int H, W, D;
    cin >> H >> W >> D;

    vector<int> x(W*H+1);
    vector<int> y(W*H+1);
    vector<int> d(W*H+1);

    for (int i=0;i<H;i++) {
        for (int j=0;j<W;j++) {
            int a;
            cin >> a;
            x[a] = i;
            y[a] = j;
        }
    }

    for (int i=D+1;i<=W*H;i++) {
        d[i] = d[i - D] + abs(x[i] - x[i - D]) + abs(y[i] - y[i - D]);
    }

    int Q;
    cin >> Q;
    while (Q--) {
        int L, R;
        cin >> L >> R;
        cout << d[R] - d[L] << endl;
    }

    return 0;
}


Measured memory_bytes: 2176
n=int(input())
import math
li=[]
l=[]
for i in range (0,n):
  li.append(list(map(int,input().split())))
for i in range (0,n-1):
  for j in range (i+1,n):
    a=li[j][0]-li[i][0]
    b=li[j][1]-li[i][1]
    l.append(math.sqrt(a*a+b*b))
k=math.floor(n*(n-1)/2)
x=0
for i in range (0,k):
  x=x+(n-1)*l[i]/k
print(x)

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args)throws IOException {
		FastReader sc = new FastReader();
		PrintWriter pw = new PrintWriter(System.out);
		int n = sc.nextInt();
		int m = (int)Math.ceil(n * 1.0 / 1000.0);
		System.out.println(1000 * m - n);

	}
}





class FastReader {
	BufferedReader br;
	StringTokenizer st;

	public FastReader() {
		br = new BufferedReader(new
		                        InputStreamReader(System.in));
	}

	String next() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException  e) {
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(next());
	}

	long nextLong() {
		return Long.parseLong(next());
	}

	double nextDouble() {
		return Double.parseDouble(next());
	}

	String nextLine() {
		String str = "";
		try {
			str = br.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return str;
	}
}

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

int main() {
    int n,x;
    while(1){
        cin>>n>>x;
        if(n==0&&x==0)break;
        ll count=0;
        rep(i,n){
            rep(j,n){
                rep(k,n){
                    if(i!=j&&j!=k&&k!=i){
                        if(x==i+j+k+3)count++;
                    }
                }
            }
        }
        cout<<count/6<<endl;
    }
    return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<int> a(n);
int tmp=0;
int ans=0;
cin>>a[0];
for(int i=1;i<n;i++){
cin>>a[i];
if(a[i]==a[i-1]){
tmp++;
}else{
	tmp++;
ans+=tmp/2;
tmp=0;
}

}
if(a[n-1]==a[n-2]){
	tmp++;
	ans+=tmp/2;
}
cout<<ans<<endl;
return 0;
}


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

int main(){
  int n ,cost[2] ,ticket[2];
  double total;
  cin >> n;
  for( int i=0 ; i<n ; i++ ){
    cin >> cost[0] >> cost[1] >> ticket[0] >> ticket[1]; // 料金1 ,2 券の枚数1 ,2
    total = cost[0] * ticket[0] + cost[1] * ticket[1];
    if( ticket[0] < 5 ) ticket[0] = 5;
    if( ticket[1] < 2 ) ticket[1] = 2;
    total = min( total , (double)((cost[0]*ticket[0] + cost[1]*ticket[1])*0.8) );
    cout << total << endl;
    total = 0;
  }
}

Measured memory_bytes: 1232