akhauriyash/Code-Regression huggingface dataset:
program probD
  implicit none
  integer H,W,i,j,k,black
  integer tmp_mat(0:60,0:60)
  integer,allocatable :: s(:,:)
  character(50) ::tmp

  read(*,*) H,W
  allocate(s(0:H+1,0:W+1))

  black=0
  s=-1
  tmp_mat=0
  tmp_mat(0,:)=-1;tmp_mat(:,0)=-1
  tmp_mat(H+1,:)=-1;tmp_mat(:,W+1)=-1
  tmp_mat(1,1)=1
  
  do i=1,H
     read(*,*) tmp
     do j=1,W
        if(tmp(j:j)=='.') then
           s(i,j)=0
        end if
        if(tmp(j:j)=='#') then
           s(i,j)=1
           tmp_mat(i,j)=-1
           black=black+1
        end if
     end do
  end do


  k=0

  do while(k<H*W+1)
     k=k+1
     do i=1,H
        do j=1,W
           if(tmp_mat(i,j)==k)then
              if(tmp_mat(i,j+1)==0.and.s(i,j+1)==0) then
                 tmp_mat(i,j+1)=k+1
              end if
              if(tmp_mat(i,j-1)==0.and.s(i,j-1)==0) then
                 tmp_mat(i,j-1)=k+1
              end if
              if(tmp_mat(i+1,j)==0.and.s(i+1,j)==0) then
                 tmp_mat(i+1,j)=k+1
              end if
              if(tmp_mat(i-1,j)==0.and.s(i-1,j)==0) then
                 tmp_mat(i-1,j)=k+1
              end if
           end if
        end do
     end do
     if(tmp_mat(H,W)>0) exit
  end do
  

  if(tmp_mat(H,W)==0) then
     write(*,*) -1
  else
     write(*,*)H*W-tmp_mat(H,W)-black
  end if
    
end program probD


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
double dp[305][305][305];
int  main(){
    int n; cin>>n;
        vector<int >a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int  ons=count(a.begin(),a.end(),1);
    int  tws=count(a.begin(),a.end(),2);
    int  ths=count(a.begin(),a.end(),3);
    //cout<<ons<<tws<<ths;
    memset(dp,0,sizeof(dp));
    for(int  k=0;k<=ths;k++){
        for(int  j=0;j<=ths+tws;j++){
            for(int  i=0;i<=ons+tws+ths;i++){
                if(i+j+k==0) continue;
                else{
                    double val=n;
                    if(i>0) val+=dp[i-1][j][k]*i;
                  //  cout<<val;
                    if(j>0) val+=dp[i+1][j-1][k]*j;
                    if(k>0) val+=dp[i][j+1][k-1]*k;
                    val=(double)val/(double)(i+j+k);
                    dp[i][j][k]=val;
                }
            }
        }
    }
    // cout<<dp[0][0][0]<<endl;
    cout<<setprecision(16)<<dp[ons][tws][ths];
    // cout<<dp[ons-1][tws][ths];
    // cout<<dp[ons-2][tws][ths];
    return 0;
}

Measured memory_bytes: 221952
M(char*a){return*1[&a]-*a;}char c[];v;main(i){memset(c,48,15);for(;~scanf("%d,",&v);)if(c[v]++,++i==6)c[14]=c[1],v=strstr(c,"11111"),qsort(c,14,i=1,M),puts(v?"straight":*c-52?*c-51?*c-50?"null":c[1]-50?"one pair":"two pair":c[1]-50?"three card":"full house":"four card"),memset(c,48,15);}

Measured memory_bytes: 0
import java.util.*;

public class Main {

    static final int MOD=1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++)a[i]=sc.nextInt();
        int ans = 0;
        for(int i=0;i<n;i++){
            ans = ans^a[i];
        }
        if(ans==0) System.out.println("Yes");
        else System.out.println("No");

    }
}




Measured memory_bytes: 52440
#include<iostream>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  for(int i=0;i<100;i++){
    c=c-b;
    if(c<=0){
      cout<<"Yes";
      return 0;
    }
    a=a-d;
    if(a<=0){
      cout<<"No";
      return 0;
      }
  }
}

Measured memory_bytes: 3632
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    string S;
    cin>>S;
    int n=S.length();
         if (S[2]==S[3] && S[4]==S[5])
            cout<<"Yes"<<endl;
         else
            cout<<"No"<<endl;

     return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "Yes" : "No"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
template <class T>
inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return 1;
	}
	return 0;
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >> p.second;
	return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
	rep(i, v.size()) { is >> v[i]; }
	return is;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
int main() {
	int n, k;
	ll ans = 0LL;
	cin >> n >> k;
	V v(n);
	cin >> v;
	V tri;
	ll cnt = 0LL;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < min(n,k)- i+1; j++) {
			tri.clear();
			tri.pb(INF);
			cnt = 0LL;
			for (int left = 0; left < i; left++) {
				tri.pb(v[left]);
				cnt += v[left];
				//chmax(ans, cnt);
			}
			for (int right = n - 1; right >= n - j; right--) {
				tri.pb(v[right]);
				cnt += v[right];
				//chmax(ans, cnt);
			}
			sort(all(tri));
			for (int at = 0; tri[at] < 0 and at < k - i - j; at++) {
				cnt -= tri[at];
				//chmax(ans, cnt);
			}
		//	clog << i << " " << j <<   "   " <<cnt << endl;
			chmax(ans, cnt);
		}
	}
	cout << ans << endl;
}
/*
n^2*nlogn : n
*/

Measured memory_bytes: 3608
// https://atcoder.jp/contests/abc142/tasks/abc142_c
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli b = 0, c, h, k, n, w, ans = 0, count = 0, tmp = 0;
  string s, t;
  cin >> n;
  vlli a(n), e(n);
  // map<lli, lli> d;
  rep(i, 0, n)
  {
    cin >> a[i];
    // d[i] = a[i];
  }
  rep(i, 0, n)
  {
    e[a[i] - 1] = i + 1;
  }
  rep(i, 0, n)
  {
    cout << e[i] << ' ';
  }
  cout << endl;
}

Measured memory_bytes: 2432
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e18;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;
//priority_queue< P, vector<P>, greater<P> > q;//ダイクストラの時、greaterで小さい順

signed main(){
  string s;
	cin >> s;
  int ans = 0;
  REP(i,(s.size()/2)){
    if(s[i]!=s[s.size()-1-i]) ans ++;
  }
	cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long
int main(){
    int a,b;
    cin>>a>>b;
    cout<<(a-1)*(b-1)<<endl;
    return 0;
}



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

int main() {
  int a, b, count=0;
  cin >> a >> b;

  for (int i = a; i <= b; i++) {
    if ((i/10000 == i%10) && ((i/1000)%10 == (i/10)%10)) {
      count++;
    }
  }

  std::cout << count << '\n';
  
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int H =sc.nextInt();
        int W = sc.nextInt();
        HashSet<Integer> delRow = new HashSet<>();
        HashSet<Integer> delCol = new HashSet<>();

        StringBuilder sb1 = new StringBuilder();
        for(int i=0;i<W;i++) sb1.append(".");
        String stdRow = sb1.toString();
        StringBuilder sb2 = new StringBuilder();
        for(int i=0;i<H;i++) sb2.append(".");
        String stdCol = sb2.toString();

        String[] dic = new String[H];
        for(int i=0;i<H;i++) {
            dic[i]=sc.next();
            if(dic[i].equals(stdRow)) delRow.add(i);
        }
        for(int col=0;col<W;col++){
            StringBuilder cur = new StringBuilder();
            for(int i=0;i<H;i++) cur.append(dic[i].charAt(col));
            if(stdCol.equals(cur.toString())) delCol.add(col);
        }
        for(int row=0;row<H;row++){
            if(delRow.contains(row)) continue;
            StringBuilder temp = new StringBuilder();
            for(int col=0;col<W;col++){
                if(delCol.contains(col)) continue;
                temp.append(dic[row].charAt(col));
            }
            System.out.println(temp.toString());
        }
    }
}


Measured memory_bytes: 23764
#include<algorithm>
#include<cstdio>
#include<string>
#include<iostream>

using namespace std;

int main()
{
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	int a, b, c, d;
	a = h - (y + r);
	b = w - (x + r);
	c = y - r;
	d = x - r;
	if (a >= 0 && b >= 0 && c >= 0 && d >= 0)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#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 - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
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> pii;
typedef pair<long long, long long> pll;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 500050;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;


void solve() {
	string S; cin >> S;
	print(S.substr(0, 3));
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	mt.seed((int)(time(0)));
	//REP(_, 10000)test();
	//int q;
	//cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 3644
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)

int main() {
  double A, B, H, M;
  cin >> A >> B >> H >> M;

  double a = (H + (M / 60)) / 12.0,
         b = M / 60.0;

  double theta = abs(a-b) * 2 * M_PI;
  theta = min(theta, 2 * M_PI - theta);

  cout << fixed << setprecision(15) << sqrt(A*A + B*B - 2*A*B*cos(theta)) << endl;

  return 0;
}


Measured memory_bytes: 4228
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
            var X = input[0];
            var Y = input[1];
            var ans = 0;

            for (long i = X; i <= Y; i *= 2)
            {
                if (i <= Y) ans++;
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13268
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 10000000007; //10^9+7

int main(){
  int n;
  int d[100];
  cin>>n;
  REP(i,n)cin>>d[i];
  sort(d,d+n);
  int now=0;
  int cnt=0;
  REP(i,n){
    if(now<d[i]){
      now=d[i];
      cnt++;
    }
  }
  print(cnt);
}

Measured memory_bytes: 256
import numpy as np
from itertools import combinations
 
N, D = map(int, input().split())
X = np.array([list(map(int, input().split())) for i in range(N)]) #二次元配列
cnt = 0
 
for p1, p2 in combinations(X, 2): #Xから二個選ぶ組み合わせ
    cnt+= (sum((p1-p2)**2)**.5).is_integer() #.is_integer()　整数かを判定
print(cnt)

Measured memory_bytes: 12516
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int n, m;
	int[][] a;
	boolean[][] q;
	ArrayList<P> list;

	class P{
		int x, y;

		P(int x, int y){
			this.x=x;
			this.y=y;
		}
	}

	void run(){
		boolean first=true;
		for(;;){
			n=sc.nextInt();
			if(n==0){
				break;
			}
			m=sc.nextInt();
			a=new int[n+1][m+1];
			q=new boolean[n+1][m+1];
			list=new ArrayList<P>();
			for(int j=0; j<=n; j++){
				for(int i=0; i<=m; i++){
					String s=sc.next();
					if(s.equals("?")){
						q[j][i]=true;
						list.add(new P(i, j));
					}else{
						a[j][i]=Integer.parseInt(s);
					}
				}
			}
			if(first){
				first=false;
			}else{
				println("");
			}
			solve();
		}
	}

	void solve(){
		for(;;){
			int[] sumM=new int[m];
			int[] sumN=new int[n];
			int[] qM=new int[m];
			int[] qN=new int[n];
			boolean[] oneM=new boolean[m];
			boolean[] oneN=new boolean[n];

			for(int i=0; i<m; i++){
				int count=0;
				for(int j=0; j<n; j++){
					if(q[j][i]){
						qM[i]=j;
						count++;
					}else{
						sumM[i]+=a[j][i];
					}
				}
				oneM[i]=count==1;
			}

			for(int j=0; j<n; j++){
				int count=0;
				for(int i=0; i<m; i++){
					if(q[j][i]){
						qN[j]=i;
						count++;
					}else{
						sumN[j]+=a[j][i];
					}
				}
				oneN[j]=count==1;
			}

			boolean update=false;

			for(int i=0; i<m; i++){
				if(oneM[i]){
					oneN[qM[i]]=false;// ツつ「ツづァツづア
					q[qM[i]][i]=false;
					a[qM[i]][i]=a[n][i]-sumM[i];
					update=true;
				}
			}

			for(int j=0; j<n; j++){
				if(oneN[j]){
					q[j][qN[j]]=false;
					a[j][qN[j]]=a[j][m]-sumN[j];
					update=true;
				}
			}

			if(!update){
				break;
			}
		}

		boolean all=true;
		for(int j=0; j<n; j++){
			for(int i=0; i<m; i++){
				all&=!q[j][i];
			}
		}
		if(all){
			for(P p : list){
				println(""+a[p.y][p.x]);
			}
		}else{
			println("NO");
		}
	}

	void dfs(){
		boolean[] oneM=new boolean[m];
		boolean[] oneN=new boolean[n];

		for(int i=0; i<m; i++){
			int count=0;
			for(int j=0; j<n; j++){
				if(q[j][i]){
					count++;
				}
			}
			oneM[i]=count==1;
		}

		for(int j=0; j<n; j++){
			int count=0;
			for(int i=0; i<m; i++){
				if(q[j][i]){
					count++;
				}
			}
			oneN[j]=count==1;
		}

		for(int j=0; j<n; j++){
			// 1ツづ按づ個つェツつ?づェツづ篠個按津ィ
			if(oneN[j]){

			}
		}
	}

	void debug(Object... os){
		System.err.println(deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

}

Measured memory_bytes: 12000
import functools
import math

a,b = input().split()


def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

a = divisor(int(a))
b = divisor(int(b))
ans_list = list(set(a) & set(b))

# print(ans_list)
an = 1

for i in range(len(ans_list)):
    if is_prime(ans_list[i]):
#         print(ans_list[i])
        an += 1

print(an)

Measured memory_bytes: 5772
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
struct edge{int to,cap,rev;};//ikisaki youryou gyakuhen
class MF{//max flow
	public:
	int n;
	vector<vector<edge> >G;//[MAX];
	vector<bool>used;//[MAX];
	MF(int size){
		n=size;
		G=vector<vector<edge> >(n);
	}
	void add_edge(int from, int to, int cap){
		edge q={to,cap,int(G[to].size())};
		G[from].push_back(q);
		q={from,0,int(G[from].size()-1)};
		G[to].push_back(q);
	}
	int dfs(int v,int t, int f) {
		if(v==t)return f;
		used[v]=1;
		for(int i=0;i<G[v].size();i++){
			edge &e=G[v][i];
			if(used[e.to]||e.cap<=0) continue;
			int d =dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
		return 0;
	}
	int mf(int s,int t) {//from s to t,ford_fulkerson
		int flow=0,f;
		while(1){
			used=vector<bool>(n,false);
			f=dfs(s,t,inf);
			if(f==0)return flow;
			flow+=f;
		}
	}
};
int main(){
	int n,m;
	cin>>n>>m;
	vp in(m);
	rep(i,m)cin>>in[i].first>>in[i].second;
	rep(i,m){
		MF mf(n*2+1);
		rep(j,n)mf.add_edge(j,n+j,1);
		int s=n,t=n*2;
		rep(j,i){
			mf.add_edge(n+in[j].first-1,in[j].second-1,1);
			mf.add_edge(n+in[j].second-1,in[j].first-1,1);
		}
		mf.add_edge(n+in[i].first-1,t,1);
		mf.add_edge(n+in[i].second-1,t,1);
		if(mf.mf(s,t)==2)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    vector<vector<int>> a(3, vector<int>(3));
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> a[i][j];
        }
    }
    cin >> n;
    for (int k = 0; k < n; k++)
    {
        int b;
        cin >> b;
        for (int l = 0; l < 3; l++)
        {
            for (int m = 0; m < 3; m++)
            {
                if (a[l][m] == b)
                {
                    a[l][m] = 0;
                }
            }
        }
    }
    if (1)
    {
        for (int x = 0; x < 3; x++) //hori
        {
            if (a[0][x] == 0 && a[1][x] == 0 && a[2][x] == 0)
            {
                cout << "Yes";
                return 0;
            }
        }
        for (int c = 0; c < 3; c++) //vert
        {
            if (a[c][0] == 0 && a[c][1] == 0 && a[c][2] == 0)
            {
                cout << "Yes";
                return 0;
            }
        }
        if (a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0)
        {
            cout << "Yes";
            return 0;
        }
        if (a[2][0] == 0 && a[1][1] == 0 && a[0][2] == 0)
        {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

Measured memory_bytes: 3644
import sys
def input(): return sys.stdin.readline().strip()

def main():
    n,m=map(int,input().split())
    s = {i for i in range(1,m+1)}
    for _ in range(n):
        k,*aa=map(int,input().split())
        s&=set(aa)
    print(len(s))

main()

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n;
    cin >> n;
    vector<pll> ab(n);
    rep(i, n)
    {
        int a, b;
        cin >> a >> b;
        ab[i] = make_pair(a, b);
    }

    sort(ALL(ab), [](auto lhs, auto rhs) {
        return lhs.first + lhs.second > rhs.first + rhs.second;
    });

    ll ans = 0;
    rep(i, n)
    {
        if (i % 2 == 0)
            ans += ab[i].first;
        else
            ans -= ab[i].second;
    }
    cout << ans << endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template <class T> vector<T> factoring_vector(T N) {
    vector<T> ans(N + 1);
    T mx   = N;
    ans[1] = -1;
    while (mx != 0) {
        N           = mx;
        long long i = 2;
        while (i * i <= N) {
            if (N % i == 0) {
                ans[i]++;
                N /= i;
            } else {
                i++;
            }
        }
        ans[N]++;
        mx--;
    }
    return ans;
}

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

    ll N;
    cin >> N;
    ll ans = 1;

    auto fc = factoring_vector(N);
    for (auto &&i : fc) {
        ans *= i + 1;
        MOD(ans);
    }
    std::cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef long double ld;
    typedef pair<int,int> P;
    typedef pair<ll,ll> l_l;
    typedef vector<int> vi;
    typedef vector<vi> vvi;
    typedef vector<ll> vl;
    typedef vector<P> vp;
    #define fi first
    #define se second
    #define rep(i,n) for(int i = 0; i < (n); ++i)
    #define rrep(i,n) for(int i = 1; i <= (n); ++i)
    #define drep(i,n) for(int i = (n)-1; i >= 0; --i)
    const int INF=1001001000;
    const int mINF=-1001001000;
    const ll LINF=1010010010010010000;
    template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
    a = b;
    return true;
    }
    return false;
    }
    template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
    a = b;
    return true;
    }
    return false;
    }
    //グリッド：（典型）dp,dfs,bfs,最短経路,その他
    int main(){
        string s;cin>>s;
        int n=s.size();
        deque<char> dq;
        rep(i,n) dq.push_back(s[i]);
        ll ans=0;
        while(dq.size()){
            char f=dq.front();
            char b=dq.back();
            //cout<<dq.size()<<endl;
            if(f==b){
                dq.pop_front();
                if(dq.size()!=0) dq.pop_back();
            }
            else if(f!=b&&f=='x'){
                dq.push_back('x');
                ans++;
            }
            else if(f!=b&&b=='x'){
                dq.push_front('x');
                ans++;
            }
            else{
                cout<<-1<<endl;
                return 0;
            }
        }
        cout<<ans<<endl;
        return 0;
    }

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

int main(){
	int N;
	scanf("%d",&N);
	int i;
	int *P=malloc(N*sizeof(int));
	for (i=0;i<N;i++){
		scanf("%d",&P[i]);
	}
	int ans=0;
	if (P[0]==1){
		int t=P[0];
		P[0]=P[1];
		P[1]=t;
		ans++;
	}
	for (i=1;i<N;i++){
		if (P[i]==i+1){
			if (P[i+1]==i+2){
				int t=P[i];
				P[i]=P[i+1];
				P[i+1]=t;
				ans++;
			}
			else{
				int t=P[i];
				P[i]=P[i-1];
				P[i-1]=t;
				ans++;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, m, X, Y;
  cin >> n >> m >> X >> Y;
  vector<int> x(n),y(m);
  for (int i=0;i<n;i++){
    cin >> x[i];
  }
  for (int i=0;i<m;i++){
    cin >> y[i];
  }
  int xm=-101,ym=101;
  for (int i=0;i<n;i++){
    xm=max(xm,x[i]);
  }
  for (int i=0;i<m;i++){
    ym=min(ym,y[i]);
  }
  if(max(X,xm)<min(Y,ym)){
    cout << "No War" << endl;
  }
  else {
    cout << "War" << endl;
  }
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    int count = 0;
    for(int i = a; i <= b; i++){
        if(i / 10000 == i % 10){
            if( (i % 10000) / 1000 == ((i - i % 10) / 10) % 10){
                count++;
            }
        }
    }
    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int t[3];
int u[3];
int func(int k){
  if(t[k]==0)return 0;
   
  for(int i=0;i<3;i++)u[i]=t[i];
   
  int sum=k,cnt=t[0]+1;
  t[k]--;
  while(1){
    if(sum==2){
      if(t[2]==0){
        if(t[1]>0)cnt++;
        break;
      }
       
      t[2]--;
      cnt++;
      sum=1;
    }else if(sum==1){
      if(t[1]==0){
        if(t[2]>0)cnt++;
        break;
      }
       
      t[1]--;
      cnt++;
      sum=2;
    }
  }
  for(int i=0;i<3;i++)t[i]=u[i];
  return cnt;
}
 
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    int a;
    scanf("%d",&a);
    a%=3;
    t[a]++;
  }
 
  if(t[0]==n){
    printf("1\n");
  }else{
    printf("%d\n",max(func(1),func(2)));
  }
  return 0;
}

Measured memory_bytes: 3224
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
	Scanner scan = new Scanner(System.in);
	int x = scan.nextInt();
	int y = scan.nextInt();
	int z = scan.nextInt();
	if(x<y&&y<z&&x<z) System.out.println("Yes");
	else System.out.println("No");
	}
}

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

using namespace std;

#define int long long

const int N = 1e5 + 100;

int a[N], b[N], c[N], arr[N];
int n, m, it, sum;

int32_t main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < n; i++)
	cin >> a[i];
    for (int i = 0; i < m; i++) {
	cin >> b[i] >> c[i];
	arr[i] = i;
    }
    sort(a, a + n);
    sort(arr, arr + m, [&] (int i, int j) {return c[i] > c[j];});
    for (int o = 0; o < m; o++) {
	int i = arr[o];
	while (it < n && c[i] > a[it] && b[i]) {
	    a[it++] = c[i];
	    b[i]--;
	}
    }
    for (int i = 0; i < n; i++)
	sum += a[i];
    return cout << sum, 0;
}

Measured memory_bytes: 3456
fun main(args: Array<String>) {
    val (a,b) = readLine()!!.split(" ").map { it.toInt() }

    if (a == b) {
        println("Draw")
    } else {
        if (a == 1) {
            println("Alice")
        } else {
            if (b == 1) {
                println("Bob")
            } else {
                if (a < b) {
                    println("Bob")
                } else {
                    println("Alice")
                }
            }
        }
    }
}

Measured memory_bytes: 36340
$Q = scalar(<STDIN>);
@P=(2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317);
$S[5]=1;$s=1;
for($i=5;$i<=100000;$i+=4){
	$f=1;
	$ii=($i+1)/2;
	for($j=0;$P[$j]*$P[$j]<=$ii;$j++){
		if($ii%$P[$j]==0) { $f=0; last; }
		if($i%$P[$j]==0) { $f=0; last;}
	}
	if ($f) {
		for(;$P[$j]*$P[$j]<=$i;$j++){
			if($i%$P[$j]==0) { $f=0; last;}
		}
		$s=$s+1 if ($f);
	}
	$S[$i+2]=$s;
	$S[$i+4]=$s;
}

for($i=$Q;$i>0;$i--){
	($l,$r)=split " ",<STDIN>;
	print $S[$r+2]-$S[$l],"\n";
}


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

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

    if(n==1){
        cout << 1;
    }else if(n %2 == 0){
        cout << (1/2.0);
    } else{
        cout << (n/2+1)/(n*1.0);
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repa(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define PI (acos(-1))
#define _GLIBCXX_DEBUG

int main(){
  
  int h, w;
  cin >> h >> w;

  vector<vector<char>> v(h, vector<char>(w));

  rep(i, h){
    rep(j, w){
      cin >> v[i][j];
    }
  }

  vector<bool> y(h, false);
  vector<bool> x(w, false);

  rep(i, h){
    rep(j, w){
      if(v[i][j] == '#'){
        y[j] = true;
        x[i] = true;
      }
    }
  }

  rep(i, h){
    if(x[i]){
      rep(j, w){
        if(y[j]) cout << v[i][j];
        if(j == w-1) cout << endl;
      }
    }
  }

}

Measured memory_bytes: 256
n = int(input())
l = {}
for i in range(n):
  a = input()
  if not a in l:
    l[a] = 1
  else:
    l[a] += 1
#print(n)
#print(l)
l2 = sorted(l.items(), key=lambda val:-val[1])
#print(l2)
max_val = l2[0][1]
#print(max_val)
l3 = []
for k, v in l2:
  if max_val == v:
    #print(k)
    l3.append(k)
    continue
  break
for k in sorted(l3):
  print(k)

Measured memory_bytes: 118104
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Pair[] p = new Pair[n];
		for (int i = 0; i < n; i++)
			p[i] = new Pair(scanner.nextInt(), scanner.nextInt());
		Arrays.sort(p);
		int ans = 1 << 25;
		for (int i = 1; i < n - 1; i++)
			for (int j = i; j >= 0; j--) {
				int dx = p[i + 1].x - p[j].x;
				int dy = p[i + 1].y - p[j].y;
				if (dx * dx >= ans)
					break;
				ans = Math.min(ans, dx * dx + dy * dy);
			}
		System.out.println(ans);
	}

	class Pair implements Comparable<Pair> {
		int x, y;

		@Override
		public String toString() {
			return "Pair [x=" + x + ", y=" + y + "]";
		}

		public Pair(int x, int y) {
			super();
			this.x = x;
			this.y = y;
		}

		@Override
		public int compareTo(Pair o) {
			return x - o.x;
		}

	}
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int n;
vector<P> xl;
vector<P> rl;

int main() {
  cin >> n;

  xl.resize(n);
  for (int i = 0; i < n; ++i) {
    ll x, l;
    cin >> x >> l;
    xl[i] = P(x, l);
  }

  rl.resize(n);
  for (int i = 0; i < n; ++i) {
    rl[i] = P(xl[i].first + xl[i].second, xl[i].first - xl[i].second);
  }
  sort(rl.begin(), rl.end());

  int ans = 0;
  int r = -1e9 - 5;
  for (int i = 0; i < n; ++i) {
    if (r <= rl[i].second) {
      ans++;
      r = rl[i].first;
    }
  }
  cout << ans << endl;
  return 0;
}




Measured memory_bytes: 3328
import sys
import bisect
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
c.sort()
ans=0
for i in b:
  x=bisect.bisect_left(a,i)
  y=n-bisect.bisect_right(c,i)
  ans+=x*y
print(ans)

Measured memory_bytes: 22720
s = input()

def compute(state,s):
	value = int(s[0])
	for i,e in enumerate(state):
		if e == '0':
			value -= int(s[i+1])
		else:
			value += int(s[i+1])
	if value == 7:
		return True
	else:
		return False

def output(state,s):
	string = ''
	for i in range(3):
		string += s[i]
		if state[i] == '0':
			string += '-'
		else:
			string += '+'
	string += s[-1]
	string += '=7'
	return string


for i in range(2**3):
	state = format(i,'03b')
	if compute(state,s):
		print(output(state,s))
		exit()

Measured memory_bytes: 3064
import std.stdio;
import std.string;
import std.conv,std.array,std.datetime;
void main(){

	while(1){
		auto cs = readln().chomp().split();
		if( cs[0]=="0" ){	break;	}
		final switch( Date( 2004, to!int(cs[0]), to!int(cs[1])).dayOfWeek() ){
		case 0:writeln("Sunday");break;
		case 1:writeln("Monday");break;
		case 2:writeln("Tuesday");break;
		case 3:writeln("Wednesday");break;
		case 4:writeln("Thursday");break;
		case 5:writeln("Friday");break;
		case 6:writeln("Saturday");break;
		}
	}

}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	string f = s.substr(0, 2);
	string e = s.substr(2, 2);
	if (f > "00" && f <= "12") {
		if (e == "00" || e > "12")
			cout << "MMYY\n";
		else
			cout << "AMBIGUOUS\n";
	}
	else {
		if (e == "00" || e > "12")
			cout << "NA\n";
		else
			cout << "YYMM\n";
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String arg[]){
		Scanner sc= new Scanner(System.in);
		String n = sc.next();
		long sum=0;
		for(int i=0;i<n.length();i++){
			sum=sum+Integer.parseInt(String.valueOf(n.charAt(i)));
		}
		
		if(sum%9==0)
			System.out.println("Yes");
		else 
			System.out.println("No");
	}
}

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

int main(){
    int N, Y;
    cin >> N >> Y;
    int res10000 = -1, res5000=-1, res1000=-1;
    for(int a=0; a<=N; ++a){
        for(int b=0; b + a <=N; ++b){
            int c = N - a - b;
            int total = a*10000 + b*5000 + c*1000;
            if(total == Y){
                res10000 = a;
                res5000 = b;
                res1000 = c;
            }
        }
    }

    cout << res10000 << " "<< res5000 <<" "<< res1000 <<endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val a = (0 until 5).map {
        val x = readLine()!!.toInt()
        val y = if (x % 10 == 0) 10 else x % 10
        Pair(x , 10 - y)
    }
    val b = a.sortedBy { it.second }
    print(b.sumBy { it.first + it.second } - b.last().second)
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  int H, N; cin >> H >> N;
  int A[N]; rep(i,N) cin >> A[i];
  rep(i,N) H -= A[i];
  string result = H<=0 ? "Yes" : "No";
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 640
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    sort(ALL(vec));
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const stc& lhs, const stc& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a; cin >> a; string s; cin >> s;
    if(a >= 3200) cout << s;
    else cout << "red";
    cout << endstr;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
	int n;
	cin >>n;
	int l[n];
	rep(i,n)cin >>l[i];
	int count=0;
	sort(l,l+n);
	rep(i,n)rep(j,i)rep(k,j)
		if(l[i]!=l[j] && l[j]!=l[k] && l[k]+l[j]>l[i])
			count++;
	cout << count;
	return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
const ll inf=1e18;

//繰り返し自乗法
ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%mod;
    }
    x=x*x%mod;
    n>>=1;
  }
  return ans;
}

//階乗,factで初期化
vector<ll> tfact(1e7+1);
void fact(ll n) {
  for(ll i=0;i<=n;i++) {
    if(i==0) {
      tfact[i]=1;
    }
    else {
      tfact[i]=tfact[i-1]*i%mod;
    }
  }
}

//nCk 繰り返し高速
ll comb(ll n, ll k) {
  return tfact.at(n)*mpow(tfact.at(k),mod-2)%mod*mpow(tfact.at(n-k),mod-2)%mod;
}

ll f(ll n,ll m) {
  return comb(n+m,n);
}

ll g(ll n,ll m) {
  ll res=0;
  for(ll i=1;i<=n+1;i++) {
    res=(res+f(i,m))%mod;
  }
  return res;
}

int main() {
  vec r(2);
  vec c(2);
  for(ll i=0;i<2;i++) {
    cin >> r[i] >> c[i];
  }
  fact(4e6);
  ll ans=g(r[1],c[1]);
  if(r[0]>0) {
    ans=(ans-g(r[0]-1,c[1])+mod)%mod;
  }
  if(c[0]>0) {
    ans=(ans-g(r[1],c[0]-1)+mod)%mod;
  }
  if(r[0]>0&&c[0]>0) {
    ans=(ans+g(r[0]-1,c[0]-1))%mod;
  }
  cout << ans << endl;
}

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

  
int main() {
  int N;
  cin >>N;
  vector<uint64_t> a(3*N);
  rep(i,3*N)cin>>a[i];
  sort(a.begin(),a.end(),greater<uint64_t>());//大きい順に並べ替え
  uint64_t sum = 0;//2番目の人の強さの和=＝大きい順にした時のi=1,3,5...(N個続ける)
  rep(i,N){
    sum += a[2*i+1];
  }
  cout<<sum<<endl;
  
  
  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define size(s) s.size()
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
int main()
{
	ll h,n;
	ll cnt=0;
	int a[100100];
	cin>>h>>n;
	REP(i,n)
	{
		cin>>a[i];
		cnt+=a[i];
	}
	if(cnt>=h)
		cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}


Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>



using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,n) for(int i=0;i<(int)n;++i)
#define FORNUM(p, x) for (int num = p; num < (int)(x); ++num)
#define FORI(p, x) for (int i = p; i < (int)(x); ++i)
#define FORJ(p, x) for (int j = p; j < (int)(x); ++j)
#define FORK(p, x) for (int k = p; k < (int)(x); ++k)
#define FORL(p, x) for (int l = p; l < (int)(x); ++l)

typedef pair<int,int>P;
#define INF 1000000000
 
struct edge { 
	int from, to,cap,rev; 
	edge (int from, int to, int cap, int rev){
		this->from=from; this->to=to; this->cap=cap; this->rev=rev;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;

int n;
int a[105];

int main(){

	cin >> n;
	FORI(0, n) {
		cin >> a[i];
	}
	int mi = 1005;
	int ma = -1;
	FORI(0, n) {
		mi = min(mi, a[i]);
		ma = max(ma, a[i]);
	}
	cout << ma - mi << endl;

	return 0;
}


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

using namespace std;

int main(){
    vector<int> pos(5);
    int k;   
    cin>>pos[0]>>pos[1]>>pos[2]>>pos[3]>>pos[4]>>k;
    sort(pos.begin(),pos.end());
    
    cout<<((pos[4]-pos[0]>k)?":(":"Yay!")<<endl; 
    return 0;
}

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

ll INF = (1LL<<60);
ll N,M;
ll a[20];
ll p[20];

ll lcm(ll a,ll b){
  ll c=__gcd(a,b);
  a/=c;
  if(a>INF/b)return INF;
  else return a*b;
}

ll calc(int bit){
  ll k=1;
  for(int i=0;i<N;i++){
    if(bit>>i&1)
      k=lcm(k,a[i]);
  }
  return M/k;
}


int main(){
  cin>>N>>M;
  for(int i=0;i<N;i++)cin>>a[i];
  for(int i=0;i<N;i++)cin>>p[i];
  double ans=0;
  for(int i=1;i<(1<<N);i++){
    double rate=1.0,flg=-1.0;
    for(int j=0;j<N;j++){
      if(i>>j&1){
        rate*=(double)p[j] / 100.0;
        flg*=-1.0;
      }else{
        //        rate*=(double)(100-p[j]) / 100.0;
      }
    }
    //    cout<<rate<<' '<<flg<<' '<<calc(i)<<endl;
    
    ans+= rate*flg*calc(i);
  }
  printf("%.12f\n",ans);
  return 0;
}

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

typedef long long LL;

#define FOR(i, a, b) for (int i = (a), i##_END_ = (b); i <= i##_END_; i++)
#define DNF(i, a, b) for (int i = (a), i##_END_ = (b); i >= i##_END_; i--)

template <typename Tp> void in(Tp &x) {
	char ch = getchar(), f = 1; x = 0;
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') ch = getchar(), f = -1;
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
	x *= f;
}

template <typename Tp> void out(Tp x) {
	if (x > 9) out(x / 10);
	putchar(x % 10 + '0');
	return;
}

template <typename Tp> Tp Max(const Tp &x, const Tp &y) {return x > y ? x : y;}
template <typename Tp> Tp Min(const Tp &x, const Tp &y) {return x < y ? x : y;}
template <typename Tp> bool chkmax(Tp &x, Tp y) {return x >= y ? 0 : (x=y, 1);}
template <typename Tp> bool chkmin(Tp &x, Tp y) {return x <= y ? 0 : (x=y, 1);}

const int MAXN = 16;
const int MOD = 1000000007;

int n, m;
bool edge[MAXN][MAXN];

int In[MAXN][32768], Out[MAXN][32768];
int f[32768];

int power(int x, int y)
{
	int ret = 1;
	while (y) {
		if (y & 1) ret = 1ll * ret * x % MOD;
		x = 1ll * x * x % MOD;
		y >>= 1;
	}
	return ret;
}

int main()
{
	in(n); in(m);
	FOR(i, 1, m) {int x, y; in(x); in(y); edge[x][y] = true;}

	FOR(i, 1, n) FOR(j, 0, (1 << n) - 1) {
		FOR(k, 1, n) if (j >> (k - 1) & 1) In[i][j] += edge[k][i];
		FOR(k, 1, n) if (j >> (k - 1) & 1) Out[i][j] += edge[i][k];
	}

	f[0] = 1;
	
	FOR(i, 1, (1 << n) - 1) {
		f[i] = 0;
		for (int j = i; j; j = (j - 1) & i) {
			int ret = 1;
			if ((j & 1) ^ (j >> 1 & 1)) continue;
			FOR(k, 1, n) if (j >> (k - 1) & 1) ret = ret * 1ll * power(2, Out[k][i - j]) % MOD;
			FOR(k, 1, n) if ((i - j) >> (k - 1) & 1) ret = ret * 1ll * (power(2, Out[k][j]) - 1) % MOD;
			f[i] = (f[i] + ret * 1ll * f[i - j]) % MOD;
		}
	}

	printf("%d\n", (power(2, m) - f[(1 << n) - 1] + MOD) % MOD);

	return 0;
}


Measured memory_bytes: 4352