akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<map>

using namespace std;

int main(){
    int n;
    cin >> n;
    map<int,int> m;
    m.clear();
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        if(s[0]=='M') m[0]++;
        else if(s[0]=='A') m[1]++;
        else if(s[0]=='R') m[2]++;
        else if(s[0]=='C') m[3]++;
        else if(s[0]=='H') m[4]++;
    }

    long long res;
    long long ans=0;
    int tmp;
    for(int bit=0;bit<(1<<5);bit++){
        tmp=0;
        res=1;
        for(int i=0;i<5;i++){
            if(bit&(1<<i)){
                tmp++;
                res*=m[i];
            }
        }
        if(tmp==3){
            ans+=res;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int a[N];

void PrintMatrix(int n){
	int i;
	for(i=0;i<n-1;i++) printf("%d ",a[i]);
	printf("%d\n",a[n-1]);
}

void Insertion(int n){
	int i, j, k, temp;
	for(i=1;i<n;i++){
		for(j=0;j<i;j++){
			if(a[i]<a[j]){
				temp=a[i];
				for(k=i;k>j;k--) a[k]=a[k-1];
				a[j]=temp;
			}
		}
		PrintMatrix(n);
	}
}

int main(void){
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
        PrintMatrix(n);
	Insertion(n);
	return 0;
}

Measured memory_bytes: 1772
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define FI(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, b, a) for (int i = (b); i >= (a); --i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;

const char s3[10][10] = {
  "a..",
  "a..",
  ".bb"
};
const char s4[10][10] = {
  "aacd",
  "bbcd",
  "efgg",
  "efhh"
};
const char s5[10][10] = {
  "aabbc",
  "dde.c",
  "ffegg",
  "..hij",
  "..hij"
};
const char s6[10][10] = {
  "aabbcc",
  "dd.eef",
  "..g.hf",
  "iig.h.",
  "..jk.l",
  "..jk.l"
};
const char s7[10][10] = {
  "aabb.cc",
  "ddeef..",
  "gghhf..",
  "....ijk",
  "....ijk",
  "....lmn",
  "....lmn"
};

char s[1005][1005];

int main() {
  int n;
  cin >> n;
  if (n < 3) return !printf("-1\n");
  if (n == 3) {
    for (int i = 0; i < 3; ++i) printf("%s\n", s3[i]);
  } else {
    for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) s[i][j] = '.';
    for (int x = 4; x <= 7; ++x) {
      if ((n - x) % 4) continue;
      int n4 = (n - x) / 4;
      auto p = x == 4 ? s4 : x == 5 ? s5 : x == 6 ? s6 : s7;
      for (int i = 0; i < x; ++i) {
        for (int j = 0; j < x; ++j) {
          s[i][j] = p[i][j]; 
        }
      } 
      for (int ct = 0; ct < n4; ++ct) {
        int i0 = x + ct * 4, j0 = i0;
        for (int i = 0; i < 4; ++i) {
          for (int j = 0; j < 4; ++j) {
            s[i0 + i][j0 + j] = s4[i][j];
          }
        }
      }
      for (int i = 0; i < n; ++i) printf("%s\n", s[i]);
      break;
    }
  }
  return 0;
}


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

struct UnionFind {
	vector<int> d;
	UnionFind(int n = 0) : d(n, -1) {}
	int find(int x) {
		if (d[x] < 0) return x;
		return d[x] = find(d[x]);
	}
	bool unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return false;
		if (d[x] > d[y]) swap(x, y);
		d[x] += d[y];
		d[y] = x;
		return true;
	}
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -d[find(x)]; }
};

int main()
{
	int N, M;
	cin >> N >> M;

	int a, b;

	UnionFind ud(N);
	rep(i, M) {
		cin >> a >> b;
		a -= 1;
		b -= 1;
		ud.unite(a, b);
	}
	
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		int se = ud.size(i);
		ans = max(ans, se);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3964
#include <stdio.h>
typedef long long ll;
int main(){
  ll N,M;
  scanf("%lld %lld",&N,&M);
  for(ll i = 0;i<M/2;i++) printf("%lld %lld\n",i+1,M-i);
  if (M & 1) for(ll i = N;i>N-M/2-1;i--) printf("%lld %lld\n",i,N-M-i+N);
  else for(ll i = N;i>N-M/2;i--) printf("%lld %lld\n",i,N-M-i+N);
  return 0;
}

Measured memory_bytes: 1704
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 05/06/2017 16:33:24
	flamers will **** you
*/
#include<bits/stdc++.h>
//#include<flamers.h>
#define ull unsigned long long
using namespace std;
	int tab1[]={1,3,5,7,8,10,12};
	int tab2[]={4, 6, 9, 11};
	int tab3[]={2};
	
string search(int x){
	for(int i = 0; i < 7; i++){
		if(x == tab1[i]) return "tab1";
	}
	
	for(int i = 0; i < 4; i++){
		if(x == tab2[i]) return "tab2";
	}
	for(int i = 0; i < 1; i++){
		if(x == tab3[i]) return "tab3";
	}
}


int main(){

	int x, y;
	cin>>x>>y;
	if(search(x) == search(y)) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
# coding: utf-8

while True:
	try:
		data = map(int, raw_input().split())
		a = data[0]
		b = data[1]
		c = data[2]
		d = data[3]
		e = data[4]
		f = data[5]

		x = (c*e-b*f)*1.0 / (a*e-b*d)
		if x == -0.000:
			x = 0.000
		if b != 0:
			y = (c-a*x)/b
		else:
			y = (f-d*x)/e
		if y == -0.000:
			y = 0.000

		print("{:.3f} {:.3f}".format(x,y))
	except EOFError:
		break

Measured memory_bytes: 4700
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	int N,M,R;
	cin>>N>>M>>R;
	vector<int> vr;
	rep(i,R){
		int r;
		cin>>r;
		r--;
		vr.push_back(r);
	}


	// Floyd-Warshall の初期化: dist[i][i] = 0 に注意
	int dist[N][N];
	rep(i,N){
		rep(j,N){
			if(i!=j) dist[i][j]=INF;
			else dist[i][j]=0;
		}
	}
	
	// 入力と Floyd-Warshall
	rep(i,M){
		int a,b,c;
		cin>>a>>b>>c;
		a--,b--;
		dist[a][b]=c;
		dist[b][a]=c;
	}
	rep(k,N){
		rep(i,N){
			rep(j,N){
				dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
			}
		}
	}
	
	ll res=INF;
	sort(vr.begin(),vr.end());
	do{
		ll tmp=0;
		for(int i=1;i<vr.size();i++) tmp+=dist[vr[i]][vr[i-1]];
		res=min(res,tmp);
	} while(next_permutation(vr.begin(),vr.end()));

	cout<<res<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define scan2() int n,k; cin>>n>>k ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 200005



int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);

        int n;
        cin >> n;
        int a,b;
        cin >> a >> b;
        int i ,ans=0;
        for(i=a; i<=b; i++){
            if(i%n==0){
                ans++;
                break;
            }        }
        if(ans)cout << "OK";
        else cout << "NG"; 
        

}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){
    ll n;cin>>n;
    ll a[n];
    ll mixi=-1;
    rep(i,0,n-1){
        cin>>a[i];
        mixi=max(mixi,a[i]);
    }
    ll b=0;
    ll mini=inf;
    rep(i,0,n-1){
        if(a[i]==mixi)continue;
        if(mini>abs(mixi-2*a[i])){
            b=a[i];
            mini=abs(mixi-2*a[i]);
        }
    }
    cout<<mixi<<' '<<b<<endl;
    
    return 0;
}


Measured memory_bytes: 1024
import bisect, math
N = 10**5
Q = int(input())

lst1 = [2]
for L in range(3, N, 2):
  f = 0
  for d in range(3, math.floor(math.sqrt(L))+1, 2):
    if L % d == 0:
      f = 1
      break
  if f == 0:
    lst1.append(L)

lst1 = set(lst1) 
lst2 = [i for i in lst1 if (i+1)//2 in lst1]

lst2.sort()

for _ in range(Q):
  l, r = map(int, input().split())
  a = bisect.bisect_left(lst2, l)
  b = bisect.bisect_right(lst2, r)
  print(b-a)

Measured memory_bytes: 56796
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int N;
vector<int> a;
int main(){
	cin>>N;
	a.resize(N);
	rep(i,N) cin>>a[i];
	sort(all(a));
	int x = a.back();
	int y = a[N-2];
	rep(i,N){
		int t = a[i];
		if(min(t,x-t)>min(y,x-y)) y = t;
	}
	cout<<x<<" "<<y<<endl;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>

using namespace std;

#define LL long long

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

LL mod(LL x, LL md) {
	return ((x % md) + md) % md;
}

class Mint {
public:
	static LL md;
	LL x;
	Mint(LL _x) {
		x = mod(_x, md);
	}
	Mint(const Mint &y) {
		x = mod(y.x, md);
	}
};

void MintMyExgcd(LL a, LL b, LL &x, LL &y) {
	// solve equation ax + by = 1 (mod m)
	LL md = Mint::md;
	if (b == 0) {
		y = 0;
		x = 1;
		return ;
	}
	MintMyExgcd(b, a % b, x, y);
	LL t = y;
	y = mod(x - (a / b) * y, md);
	x = t;
}

LL MintNY(LL x) {
	if (x == 0) {
		return 1;
	}
	LL md = Mint::md;
	LL a, b;
	MintMyExgcd(x, md, a, b);
	while (a < 0) {
		a += md;
	}
	return a;
}

/* LL gcd(LL a, LL b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
} */

Mint operator+(Mint a, Mint b) {
	return Mint(mod(a.x + b.x, Mint::md));
}
Mint operator-(Mint a, Mint b) {
	return Mint(mod(a.x - b.x, Mint::md));
}
Mint operator*(Mint a, Mint b) {
	return Mint(mod(a.x * b.x, Mint::md));
}
Mint operator/(Mint a, Mint b) {
	Mint c = Mint(MintNY(b.x));
	return Mint(mod(a.x * c.x, Mint::md));
}

Mint operator-(Mint a) {
	return Mint(-a.x);
}
bool operator==(Mint a, Mint b) {
	return a.x == b.x;
}
bool operator!=(Mint a, Mint b) {
	return a.x != b.x;
}
bool operator>(Mint a, Mint b) {
	return a.x > b.x;
}
bool operator<(Mint a, Mint b) {
	return a.x < b.x;
}
bool operator>=(Mint a, Mint b) {
	return a.x >= b.x;
}
bool operator<=(Mint a, Mint b) {
	return a.x <= b.x;
}

void operator+=(Mint &a, Mint b) {
	a = a + b;
}
void operator-=(Mint &a, Mint b) {
	a = a - b;
}
void operator*=(Mint &a, Mint b) {
	a = a * b;
}
void operator/=(Mint &a, Mint b) {
	a = a / b;
}

ostream& operator<<(ostream &out, Mint a) {
	out << a.x;
	return out;
}

istream& operator>>(istream &in, Mint &a) {
	in >> a.x;
	return in;
}

Mint factorial(LL n) {
	if (n == 0) {
		return Mint(1);
	}
	Mint res = 1;
	for (LL i = 1; i <= n; ++i) {
		res *= i;
	}
	return res;
}
Mint multiRange(LL s, LL t) {
	Mint res = 1;
	for (LL i = s; i <= t; ++i) {
		res *= i;
	}
	return res;
}

Mint getC(LL n, LL k) {
	if (n - k < k) {
		return getC(n, n - k);
	}
	return multiRange(n - k + 1, n) / factorial(k);
}

Mint getA(LL n, LL k) {
	return multiRange(n - k + 1, n);
}

Mint countNonNegativeDivision(LL n, LL k) {
	return getC(n + k - 1, k - 1);
}
Mint countPositiveDivision(LL n, LL k) {
	if (n < k) {
		return 0;
	}
	if (k <= 0) {
		return 0;
	}
	return getC(n - 1, k - 1);
}
Mint quickMod(Mint a, LL b) {
	Mint res = 1;
	while (b > 0) {
		if (b % 2) {
			res *= a;
		}
		a *= a;
		b /= 2;
	}
	return res;
}

LL Mint::md = 1000000007;

bool ispal(string s, int a, int b) {
	while (a < b) {
		if (s[a] != s[b]) {
			return false;
		}
		++a; --b;
	}
	return true;
}
string s;
int main() {
	cin >> s;
	int n = s.length();
	int l1 = 0, r1 = (n - 3) / 2;
	int l2 = (n + 1) / 2, r2 = n - 1;
	if (ispal(s, l1, r2) && ispal(s, l1, r1) && ispal(s, l2, r2)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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


def lcm(a, b):
    return a * b // gcd(a, b)


A, B, C, D = map(int, input().split())
A -= 1

l = lcm(C, D)
num_B = B // C + B // D - B // l
num_A = A // C + A // D - A // l
print(B - num_B - A + num_A)


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

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

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String str = reader.readLine();
			String[] points = str.split(" ");
			double x1 = Double.parseDouble(points[0]);
			double y1 = Double.parseDouble(points[1]);
			double x2 = Double.parseDouble(points[2]);
			double y2 = Double.parseDouble(points[3]);
			
			double d = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2)); 
			System.out.println(d);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 24556
import java.util.*;

public class Main {

    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;
        boolean has1 = false;
        int nex = 1;
        for (int i = 0; i < n; i++) {
            if(a[i] == nex){
                nex++;
                if(a[i] == 1) has1 = true;
            }else{
                ans++;
            }
        }
        if(has1) System.out.println(ans);
        else System.out.println(-1);
        sc.close();

    }

}


Measured memory_bytes: 80028
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin>>a;
    string b=a;
    reverse(a.begin(),a.end());
    for(int i=0;i<a.size();++i)
    {
        if(a[i]=='b') a[i]='d';
        else if(a[i]=='d') a[i]='b';
        else if(a[i]=='p') a[i]='q';
        else if(a[i]=='q') a[i]='p';
    }
    if(a==b) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

char ba[100][100];
int h,w;

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

void go(int x, int y, char c) {
  ba[x][y] = '.';
  REP(k,4) {
    int xx = x+dx[k];
    int yy = y+dy[k];
    if (xx<0||xx>=w||yy<0||yy>=h) continue;
    if (ba[xx][yy]==c) {
      go(xx,yy,c);
    }
  }
}

int main() {
  while(cin>>h>>w,h+w) {
    REP(y,h)
      REP(x,w)
      cin>>ba[x][y];

    int ans = 0;
    REP(y,h) {
      REP(x,w) {
        if (ba[x][y] != '.') {
          go(x,y,ba[x][y]);
          ans++;
        }
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main () {
  int count=0;
  string S;
  cin>>S;
  for(int i=0;i<S.size();i++){
    if(S[i]=='x'){
      count++;
    }
  }
  if(count>=8){
    cout<<"NO"<<endl;
  }
  else{
    cout<<"YES"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  /* 10^18 くらいまでいける */

int main(){
  int s, w;
  cin >> s >> w;
  if (w >= s)
    cout << "unsafe" << endl;
  else
    cout << "safe" << endl;

  return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
using namespace std;

typedef long long ll;
inline ll read(){
	ll x;char c;
	while((c=getchar())<'0'||c>'9');
	x=c-48;
	while((c=getchar())>='0'&&c<='9')x=x*10+c-48;
	return x;
}

const ll maxn=1e5+10;
ll n,m,c[maxn],x[3],deg[maxn],tot,type,ans;
vector<ll> g[maxn];

void dfs(ll pos){
	for(ll i=0;i<g[pos].size();++i)
		if(!c[g[pos][i]]){
			c[g[pos][i]]=c[pos]^1;
			++x[c[g[pos][i]]];
			tot+=deg[g[pos][i]];
			dfs(g[pos][i]);
		}
		else if(c[g[pos][i]]==c[pos])
			type=true;
}

int main(){
	n=read();
	m=read();
	for(ll i=1,u,v;i<=m;++i){
		u=read();v=read();
		++deg[u];++deg[v];
		g[u].push_back(v);
		g[v].push_back(u);
	}
	for(ll i=1;i<=n;++i)
		if(!c[i]){
			x[2]=1;x[3]=0;
			c[i]=2;
			type=0;
			tot=deg[i];
			dfs(i);
			if(type){
				ans+=(x[2]+x[3])*(x[2]+x[3]-1)/2-tot/2;
			}
			else{
				ans+=x[2]*x[3]-tot/2;
			}
		}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 8704
a, b = map(int, input().split())

a -= 1
b -= 1

ans = [[ '#' for _ in range(100)]]

for i in range(1, 49):
    temp = [ '#' for _ in range(100)]
    if a > 0:
        if i % 2 != 0:
            for j in range(min(a, 49)):
                temp[2 * j + 1] = '.'
                a -= 1
        else:
            ans.append(temp)
            continue
    else:
        break
    ans.append(temp)

ans.append([ '#' for _ in range(100)])

ans.append([ '.' for _ in range(100)])

for i in range(1, 49):
    temp = [ '.' for _ in range(100)]
    if b > 0:
        if i % 2 != 0:
            for j in range(min(b, 49)):
                temp[2 * j + 1] = '#'
                b -= 1
        else:
            ans.append(temp)
            continue
    else:
        break
    ans.append(temp)

ans.append([ '.' for _ in range(100)])

print(len(ans), '100')

for x in ans:
    print(''.join(x))

Measured memory_bytes: 3064
s=list(input())



for i in range(len(s)):
    if s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C":
        s[i]=1
    else:
        s[i]=0
list_s=[]
for i in range(len(s)):
    flag=1
    for j in range(len(s)-i):
        if s[i+j]==0:
            list_s.append(j)
            flag=0
            break
    if flag:
        list_s.append(len(s)-i)

print(max(list_s))


Measured memory_bytes: 38384
IDENTIFICATION DIVISION.
PROGRAM-ID. A-BEGINNER.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP     PIC X(100).
01 IN-DATA.
   03 DT-X1 PIC X(10).
   03 DT-X2 PIC X(10).
01 IN-LEN.
   03 DT-L1 PIC 9(2).
   03 DT-L2 PIC 9(2).
01 IN-N     PIC 9(3).
01 IN-R     PIC 9(4).
01 OUT-R    PIC ZZZ9.

PROCEDURE DIVISION.
MAIN-001.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO DT-X1 COUNT IN DT-L1
           DT-X2 COUNT IN DT-L2.
  MOVE DT-X1(1:DT-L1) TO IN-N.
  MOVE DT-X2(1:DT-L2) TO IN-R.

  IF (IN-N >= 10)
     MOVE IN-R TO OUT-R 
  ELSE
     COMPUTE OUT-R = IN-R + 100 * (10 - IN-N)
  END-IF.
  DISPLAY OUT-R.

MAIN-EXIT.
  STOP RUN.


Measured memory_bytes: 384
X,Y,i;
xx[12],yy[12];
q[9999],t,h,p,ok,c,k;
char *d="22210/.../01";
main(x,y,n)
{
  for(;scanf("%d%d",&X,&Y),X;puts(ok?"OK":"NA")){
    for(ok=t=h=i=!scanf("%d",&n);i++<n;)scanf("%d%d",xx+i,yy+i);
    for(p=q[t++]=X*10+Y;t!=h&!ok;p=q[h++]){
      c=p/100;
      if(c&&abs(xx[c]-p/10%10)>1|abs(yy[c]-p%10)>1)continue;
      ok=c==n;
      for(i=0;i<12;X>=0&X<10&Y>=0&Y<10?q[t++]=(c+1)*100+X*10+Y:0)
        X=p/10%10+d[i]-48,Y=p%10+d[11-i++]-48;
    }
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
      cin>>n;

        int arr[n],freq[1000001]={0};
          set<int>p;
        for(int i=0;i<n;i++)
          {

             cin>>arr[i];
               p.insert(arr[i]);
              freq[arr[i]]++;
          }
         long long int total=0;

           for(auto itr=p.begin();itr!=p.end();itr++)
           {
              int g=(*itr);
              long long int l=freq[g];

                  if(l > 1)
                total+=(l*(l-1))/2;
           }

           for(int i=0;i<n;i++)
           {
              long long int g=freq[arr[i]];
               long long int r=g-1;
               long long int f;

                if(r > 1)
                f = total - ((g*(g-1))/2 - (r*(r-1))/2);

                else
                f=total - (g*(g-1))/2;

                cout<<f<<endl;
           }

}


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

int n;
int main (){
 std::cin >> n;
 int num;
 for (double i = 0.0; i < 8; ++i) {
  int max = static_cast<int>(std::pow(2.0, i));
  if (max > n){
   num = max/2;
   break;
  }
 }
 std::cout << num << std::endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
long long n,a[100010],sum,ans;
inline int read()
{
	int num=0,flag=1;
	char c=getchar();
	for (;c<'0'||c>'9';c=getchar())
	if (c=='-') flag=-1;
	for (;c>='0'&&c<='9';c=getchar())
	num=(num<<3)+(num<<1)+c-48;
	return num*flag;
}
int main()
{
	n=read();
	for (int i=1;i<=n;++i)
	{
		a[i]=read();
		sum+=abs(a[i]-a[i-1]);
	}
	sum+=abs(a[n]);
	for (int i=1;i<=n;++i)
	{
		ans=sum-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]);
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 2048
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 1000000002486618624LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


std::vector<std::vector<std::pair<int, long long>>> G;

std::vector<long long> cost;

int N, Q, K;

void dfs(int i, long long C) {
  int k;

  long long c;
  
  for (const auto& pair : G[i]) {
    std::tie(k, c) = pair;
    
    if (cost[k] < INF)
      continue;

    dfs(k, cost[k] = C + c);
  }
}


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  int a, b, c, x, y;

  std::cin >> N;

  G.resize(N + 1);

  for (int i = 0; i < N - 1; i ++) {
    std::cin >> a >> b >> c;

    G[a].emplace_back(b, c);
    G[b].emplace_back(a, c);
  }

  std::cin >> Q >> K;

  cost.resize(N + 1);

  std::fill(ALL(cost), INF);

  cost[K] = 0;

  dfs(K, 0);

  for (int i = 0; i < Q; i ++) {
    std::cin >> x >> y;

    std::cout << cost[x] + cost[y] << std::endl;
  }

  return 0;
}


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


int main() {
  int a,b,c,d,sum,ans;
  string s;
  cin>>a;
  ans=0;
  b=0;c=0;
  vector<int> vecV(a);
  vector<int> vecC(a);
  
  for(int i=0;i<a;i++){
  	cin>>vecV.at(i);
  }
  for(int i=0;i<a;i++){
  	cin>>vecC.at(i);
  }
 
  for(int i=0;i<a;i++){
  	if(vecV.at(i)>vecC.at(i)) sum += vecV.at(i)-vecC.at(i);
  }
  
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };


int main()
{
    int n, m, a[55], b[55], c[55], d[55], i, j, ans, k;

    cin >> n >> m;

    for(i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    for(i = 0; i < m; i++){
        cin >> c[i] >> d[i];
    }

    for(i = 0; i < n; i++){
        k = INF;
        for(j = 0; j < m; j++){
            if(abs(c[j] - a[i]) + abs(d[j] - b[i]) < k){
                k = abs(c[j] - a[i]) + abs(d[j] - b[i]);
                ans = j + 1;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    if(a>b){
    printf("a > b\n");
    }
    else if(a<b){
    printf("a < b\n");
    }
    else {
    printf("a == b\n");
    }
    return 0;
}

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

#define X first
#define Y second
#define ll long long
#define MP make_pair
#define PB push_back

using namespace std;

const int MAXN=1e5;

ll n,m;
pair <ll, ll> niz[105];
ll dp[105][100005];

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

	cin>>n>>m;
	for(int i=0; i<n; i++){
		cin>>niz[i].X>>niz[i].Y;
	}
	for(int i=niz[0].X; i<=m; i++){
		dp[0][i]=niz[0].Y;
	}
	for(int i=1; i<n; i++){
		for(int j=0; j<=m; j++){
			dp[i][j]=dp[i-1][j];
			if(j>=niz[i].X){
				dp[i][j]=max(dp[i][j],dp[i-1][j-niz[i].X]+niz[i].Y);
			}
		}
	}
	cout<<dp[n-1][m];
	
	return 0;
}

Measured memory_bytes: 81736
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000


int main(){
	
	int N,H,W;
	cin>>N>>H>>W;
	
	int ans = 0;
	
	for(int i=0;i<N;i++){
		int A,B;
		cin>>A>>B;
		
		if(A>=H&&B>=W)ans++;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

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

struct UnionFind{
    vector<int> d;
    UnionFind(int n=0):d(n,-1){}
    int root(int x){
        if(d[x] < 0) return x;
        return d[x] = root(d[x]);
    }
    void unite(int x,int y){
        int root_x = root(x);
        int root_y = root(y);
        if(root_x == root_y) return;
        if(d[root_x] > d[root_y]) swap(root_x,root_y);
        d[root_x] += d[root_y];
        d[root_y] = root_x;
    }
    bool same(int x,int y){return root(x) == root(y);}
    int size(int x){return -d[root(x)];}
};

int main(){
    int n,m;
    cin >> n >> m;
    UnionFind uf(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--;b--;
        uf.unite(a,b);
    }
    int ans = 0;
    rep(i,n) ans = max(ans,uf.size(i));
    cout << ans << endl;
}

Measured memory_bytes: 4064
#include <iostream>
#include <string>
using namespace std;
int main() {
  string s;
  cin>>s;
  string t;
  for(const auto c :s){
    if(c == 'B'){
      if(!t.empty()){
        t.pop_back();
      }
    }
    else t.push_back(c);
  }
  cout<<t<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] h = new int[n];
        boolean[] a = new boolean[n];
      
        for(int i = 0; i < n; i++){
          h[i] = sc.nextInt();
          a[i] = true;
        }
      
        int ans = 0;
        for(int i = 0; i < m; i++){
          int road1 = sc.nextInt()-1;
          int road2 = sc.nextInt()-1;
          if(h[road1] >= h[road2]){
            a[road2] = false;
          }
          if(h[road1] <= h[road2]){
            a[road1] = false;
          }
        }
      
       for(int i = 0; i < n; i++){
         if(a[i] == true){
           ans++;
         }
       }
        
       System.out.println(ans);
	}
}

Measured memory_bytes: 59752
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<algorithm>
#include<functional>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<iostream>
#include<string>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define REP(i,x) for (int i=0;i<x;i++)
#define REPP(i,x,y) for (int i=x;i<=y;i++)
#define SI(x) scanf("%d",&x)
#define SL(x) scanf("%lld",&x)
#define MX3(x,y,z) max(x,max(y,z))
#define MX4(x,y,z,p) max(x,max(y,max(z,p)))
#define MX5(x,y,z,p,q) max(x,max(y,max(z,max(p,q))))
#define MN3(x,y,z) min(x,min(y,z))
#define MN4(x,y,z,p) min(x,min(y,min(z,p)))
#define MN5(x,y,z,p,q) min(x,min(y,min(z,min(p,q))))
#define amax(x,y) x=max(x,y)
#define amin(x,y) x=min(x,y)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef tuple<int,int,int> ti;
typedef tuple<ll,ll,ll> tl;
// #####################################################################

void solve() {

    unordered_map<int,int> mp;
    int n, m;
    SI(n);
    SI(m);
    REP(i, n) {
        int x;
        SI(x);
        REP(j, x) {
            int t;
            SI(t);
            mp[t]++;
        }
    }
    int cnt = 0;
    for(auto e: mp) {
        if(e.second == n) {
            cnt++;
        }
    }
    printf("%d\n", cnt);
}

void init() {
    


}

int main () {
    init();
    solve();
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	string S;
  cin >> S;
  int N=S.size();
  vector<int> M(N+1);
  M.at(0)=0;
  for (int i=0;i<N;i++){
    if (S.at(i)=='A' || S.at(i)=='G' || S.at(i)=='C' || S.at(i)=='T' ) M.at(i+1)=M.at(i)+1;
    else M.at(i+1)=0;
  }
  sort(M.begin(), M.end());
  cout << M.at(N) << endl;
}

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

namespace program {
  class Program {
    static void Main()
    {
      var n = Input.ScanInt();
      var a = Input.ScanIntArray();
      double[] b = Enumerable.Range(0,n).Select(i => 1/(double)a[i]).ToArray();
      
      Out(1/b.Sum());
    }
    static public void Out(object s) { Console.Write($"{s} "); }
  }
  
  static class Input {
    static public int ScanInt() { return int.Parse(Console.ReadLine()); }
    static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
    static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
    static public long ScanLong() { return long.Parse(Console.ReadLine()); }
    static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
    static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); }
    static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); }
    static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); }
    static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); }
    static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); }

    static public string ScanStr() { return Console.ReadLine(); }
    static public string[] ScanStrArray() { return ScanStr().Split(); }
  }
  
  static class MyMath {
    public static int GCD(int a, int b) {
        Func<int, int, int> gcd = null;
        gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
        return a > b ? gcd(a, b) : gcd(b, a);
    }
    public static long GCD(long a, long b) {
        Func<long, long, long> gcd = null;
        gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
        return a > b ? gcd(a, b) : gcd(b, a);
    }
    public static long extGCD(long a, long b, ref long x, ref long y) {
      if(b==0) {
        x=1; 
        y=0;
        return a;
      }
      var d = extGCD(b, a%b, ref y, ref x);
      y -= a/b *x;
      return d;
    }
    public static int LCM(int a, int b) { return a * b / GCD(a, b); }
    public static long LCM(long a, long b) { return a * b / GCD(a, b); }
  }
}


Measured memory_bytes: 13396
#include "bits/stdc++.h"
using namespace std;

int main(){
	string s;
	cin>>s;
	
	for(int i=0;i<s.size()-2;i++){
		if(s[i]==s[i+1]){
			cout<<i+1<<" "<<i+2<<endl;
			return 0;
		}
		if(s[i]==s[i+2]){
			cout<<i+1<<" "<<i+3<<endl;
			return 0;
		}
	}
	
	if(s[s.size()-2]==s[s.size()-1]){
		cout<<s.size()-1<<" "<<s.size()<<endl;
		return 0;
	}
	
	cout<<-1<<" "<<-1<<endl;
	
	return 0;
}

Measured memory_bytes: 512
N = int(input())

AB = []
for _ in range(N):
    ab = tuple(map(int, input().split()))
    AB.append((ab[1], ab[0]))
AB = sorted(AB)

t = 0
result = "Yes"
for ab in AB:
    t = t + ab[1]
    if t > ab[0]:
        result = 'No'
        break

print(result)


Measured memory_bytes: 31052
using System;
class Program
{
    static void Main(string[] args)
    {
        string str = Console.ReadLine();
        string[] data = str.Split(' ');
        int a = int.Parse(data[0]);
        int b = int.Parse(data[1]);
        Console.WriteLine("{0} {1}", a*b, 2 * (a + b));
        
    }
}


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

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

using namespace std;

const int INF = 1e9 + 3;
const int N = 1e6 + 3;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

const double PI = acos(-1);

int cnt[N];

void solve() {
    int n;
    cin >> n;
    int a[n];
    for (int &x : a)
        cin >> x;
    int gcd = a[0];
    bool ok = 1;
    for (int i = 0; i < n; i++)
        gcd = __gcd(gcd, a[i]);
    for (int i = 0; i < n; i++) {
        int x = a[i];
        for (int d = 2; d * d <= x; d++) {
            if (x % d == 0) {
                if (cnt[d] > 0) {
                    ok = 0;
                    break;
                }
                cnt[d]++;
                while (x % d == 0)
                    x /= d;
            }
        }
        if (x > 1) {
            if (cnt[x] > 0)
                ok = 0;
            cnt[x]++;
        }
        if (!ok)
            break;
    }
    if (ok)
        cout << "pairwise coprime";
    else if (gcd == 1)
        cout << "setwise coprime";
    else
        cout << "not coprime";
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t;
    t = 1;
    while (t--) {
        solve();
    }
}

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

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


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

#define rep(i, N) for (ll i = 0; i < N; i++)

#define MOD 1000000007

using ll = long long;
using namespace std;

typedef vector<int> vi;


int main() {
    int N, M;
    cin >> N >> M;
    priority_queue<int, vi> pque;
    rep(i, N) {
        int A;
        cin >> A;
        pque.push(A);
    }

    rep(i, M) {
        int tmp = pque.top(); pque.pop();
        tmp /= 2;
        pque.push(tmp);
    }
    
    ll ans = 0;
    while(!pque.empty()) {
        ans += pque.top(); pque.pop();
    }
    
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 892
s = input()[::-1]

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d %= 2019
    counts[num] += 1
    
ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans)

Measured memory_bytes: 9380
#include <iostream>
#include <string>
using namespace std;
int main() {
    int N;
    string A;
    string B;
    string C;

    cin >> N;
    cin >> A;
    cin >> B;
    cin >> C;
    int count=0;

    for (int i = 0; i < N; ++i) {
        if (A[i] == B[i] && A[i] == C[i]) {
        } else if (A[i] == B[i] || B[i] == C[i] || C[i] == A[i]) {
            count = count + 1;
        } else {
            count = count + 2;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	string S1,S2;
	cin >> S1 >> S2;
	vector<int> v;
	for(int i=0;i<N;i++){
		if(S1[i]==S2[i]){
			v.push_back(0);
		}else{
			v.push_back(1);
			i++;
		}
	}
	ll ans = 1;
	if(v[0]==0)ans = 3;
	else ans = 6;
	for(int i=1;i<v.size();i++){
		if(v[i]==1){
			if(v[i-1]==1){
				ans *= 3;
			}else{
				ans *= 2;
			}
		}else{
			if(v[i-1]==1){
				ans *= 1;
			}else{
				ans *= 2;
			}
		}
		ans %= 1000000007;
	}
	cout << ans%1000000007 << endl;
}


Measured memory_bytes: 256
#include <sys/time.h>

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using P = pair<int, int>;
using VP = pair<int, pair<int, int> > ;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
ll mod = 1000000007LL;

const int maxE = 300010;
int parent[maxE];
int parent_rank[maxE];


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

	if ((D - 1) / S + 1 <= T) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;		
	}



	return 0;
}


Measured memory_bytes: 3052
#include <iostream>
#include <stdlib.h>

// int 型要素を昇順ソートするときの比較関数
int IntCompareA(const void* pElem1, const void* pElem2)
{
    return *(const int*)pElem1 - *(const int*)pElem2;
}

int main()
{
	int n;
	int l[10];
	std::cin>>n;
	for(int i=0;i<n;i++)
	    std::cin>>l[i];
    qsort(l, n, sizeof *l, IntCompareA);
    int stk=l[n-1];
    int sum=0;
    for(int i=0;i<n-1;i++){
    sum+=l[i];
    }
    if(sum>stk)
    std::cout<<"Yes";
    else
    std::cout<<"No";
    
    return 0;
}

Measured memory_bytes: 256
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_12_A
// Graph II - Single Source Shortest Path I
// TODO: REVIEW

#define SUBMIT
//#define DEBUG

#include <utility>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <limits>
#include <numeric>
#include <functional>
#include <set>
#include <cmath>
#include <cstring>
#include <climits>
#include <memory>

using namespace std;
using ui64 = unsigned long long;
using i64 = long long;

enum class color_type {
    white,
    gray,
    black
};

const int INF = INT_MAX >> 1;
const ui64 MAX_N = 100;
int weight[MAX_N][MAX_N];
int n;

int dijkstra() {
    int d[MAX_N];
    color_type color[MAX_N];

    for (int i = 0; i < n; ++i) {
        d[i] = INF;
        color[i] = color_type::white;
    }

    d[0] = 0;
    color[0] = color_type::gray;
    while (true) {
        int u = -1, min_v = INF;
        for (int i = 0; i < n; ++i) {
            if(d[i] < min_v && color[i] != color_type::black) {
                u = i;
                min_v = d[i];
            }
        }

        if (u == -1) break;

        color[u] = color_type::black;
        for (int v = 0; v < n; ++v) {
            if (color[v] != color_type::black && weight[u][v] != INF) {
                if (d[u] + weight[u][v] < d[v]) {
                    d[v] = d[u] + weight[u][v];
                    color[v] = color_type::gray;
                }
            }
        }
    }

    for (int i = 0; i < n; ++i) cout << i << " " << (d[i] == INF ? -1 : d[i]) << endl;
}

int main() {
#ifdef SUBMIT
    auto& stream = cin;
#else
    string program_input_str = R"(5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3
)";
    stringstream stream(program_input_str);
#endif

    stream >> n;
    for (int y = 0; y < n; ++y) {
        for (int x = 0; x < n; ++x) {
            weight[y][x] = INF;
        }
    }

    int u, v, c, degree;
    for (int i = 0; i < n; ++i) {
        stream >> u >> degree;
        for (int d = 0; d < degree; ++d) {
            stream >> v >> c;
            weight[u][v] = c;
        }
    }

#ifdef DEBUG
    for (int y = 0; y < n; ++y) {
        for (int x = 0; x < n; ++x) {
            cout << weight[y][x] << " ";
        }
        cout << endl;
    }
#endif

    dijkstra();
    return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define all(v) (v).begin(),(v).end()
#define trav(x,v) for(auto &x : v)
#define sz(v) int(v.size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;

struct SuffixArray {
	vi sa, lcp;
	SuffixArray(string& s, int lim=256) { // or basic_string<int>
		int n = sz(s) + 1, k = 0, a, b;
		vi x(all(s)+1), y(n), ws(max(n, lim)), rank(n);
		sa = lcp = y, iota(all(sa), 0);
		for (int j = 0, p = 0; p < n; j = max(1, j * 2), lim = p) {
			p = j, iota(all(y), n - j);
			rep(i,0,n) if (sa[i] >= j) y[p++] = sa[i] - j;
			fill(all(ws), 0);
			rep(i,0,n) ws[x[i]]++;
			rep(i,1,lim) ws[i] += ws[i - 1];
			for (int i = n; i--;) sa[--ws[x[y[i]]]] = y[i];
			swap(x, y), p = 1, x[sa[0]] = 0;
			rep(i,1,n) a = sa[i - 1], b = sa[i], x[b] =
				(y[a] == y[b] && y[a + j] == y[b + j]) ? p - 1 : p++;
		}
		rep(i,1,n) rank[sa[i]] = i;
		for (int i = 0, j; i < n - 1; lcp[rank[i++]] = k)
			for (k && k--, j = sa[rank[i] - 1];
					s[i + k] == s[j + k]; k++);
	}
};

string minsub(string t, int len){
	SuffixArray sufarr(t);
	trav(st, sufarr.sa) if(st+len <= sz(t) && st*2 <= sz(t)){
		return t.substr(st, len);
	}
	return "?";
}

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

	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	if(k == 1){
		string t = s;
		reverse(all(t));
		cout << minsub(s+t, n) << endl;
		return 0;
	}
	char lo = 'z';
	trav(c, s) lo = min(lo, c);
	if(k >= 20){
		cout << string(n, lo) << endl;
		return 0;
	}
	int rek = 0;
	int tail = 0;
	for(int i = 0; i < sz(s);){
		if(s[i] != lo) ++i;
		else {
			int j = i+1;
			while(j < sz(s) && s[j] == lo) ++j;
			rek = max(rek, j-i);
			if(j==sz(s)) tail = j-i;
			i = j;
		}
	}

	string ans(n, 'z');

	if( tail ){
		string ctail;
		ll len = ll(tail)<<k;
		if(len >= n) ctail = string(n, lo);
		else {
			ctail = string(len, lo);
			rrep(i, len-tail, n-tail) ctail.push_back(s[i]);
		}
		ans = min(ans, ctail);
	}

	if( rek ){
		string cmin;
		ll len = ll(rek)<<(k-1);
		if(len >= n) cmin = string(n, lo);
		else {
			cmin = string(len-rek, lo);
			string t = s;
			reverse(all(t));
			cmin += minsub(s+t, n-sz(cmin));
		}
		ans = min(ans, cmin);
	}

	cout << ans << endl;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF (long long) 1e18//1234567890987654321
#define INF 1234567890
#define pb push_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN 300006
#define MAXK 26
#define MAXX 15000006
#define ll long long int
#define ld long double
#define rep0(kk, l1, l2)for(ll kk = l1; kk < l2; kk++)
#define rep1(kk, l1, l2)for(ll kk = l1; kk <= l2; kk++)
#define foritr(itr, A) for(set<ll>::iterator itr = A.begin(); itr != A.end(); itr++)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ii++)
#define cr(x) cerr << #x << " = " << x << "\n";
#define crA(x, A) cerr << #x << " = " << A[x] << "\n";
#define spacing if(db)cout << " ";
#define mmst(x, v) memset((x), v, sizeof ((x)));
#define bg(ms) (*ms.begin())
#define ed(ms) (*prev(ms.end(), 1))
#define addedge(a, b, c, v) v[(a)].pb(pi((b), (c))); v[(b)].pb(pi((a), (c)))
#define ph push
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n, A[MAXN], B[MAXN], a, b, co;
void no() { cout << "-1\n"; exit(0); }
priority_queue <ll> pq;
deque <ll> v;
int main()
{
	cin >> n;
	FOR(i,0,n) { cin >> A[i]; a += A[i]; }
	FOR(i,0,n) { cin >> B[i]; b += B[i]; }
	if( a < b) { no(); }
	FOR(i,0,n)
	{
		if(A[i] < B[i]) v.pb(B[i]-A[i]);
		else pq.ph(A[i]-B[i]);
	}
	while(v.size())
	{
		ll x = v.front(); v.pop_front();
		while(co < x)
		{
			assert(pq.size()); co += pq.top(); pq.pop();
		}
		co -= x;
	}
	cout << n-pq.size() << '\n';
}


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

const int MOD(1000000007);
int n, k;
int fac[4000000], inv_fac[4000000], dp[2001][2001];


int Power(long long a, int b)
{
	long long ret(1ll);
	
	while (b) {
		b & 1 && (ret *= a);
		ret >= MOD && (ret %= MOD);
		a *= a;
		a >= MOD && (a %= MOD);
		b >>= 1;
	}
	return ret;
}


int main()
{
	long long lt;
	int t;
	
	scanf("%d%d", &n, &k);
	if (k == 1) {
		printf("1\n");
		return 0;
	}
	fac[0] = 1;
	t = n * k;
	for (int i = 1; i < t; ++i) {
		lt = (long long)i * fac[i - 1];
		fac[i] = lt < MOD ? lt : lt % MOD; 
	}
	inv_fac[t - 1] = Power((long long)fac[t - 1], MOD - 2);
	for (int i = t - 2; i; --i) {
		lt = (long long)(i + 1) * inv_fac[i + 1];
		inv_fac[i] = lt < MOD ? lt : lt % MOD;
	}
	inv_fac[0] = 1;
	dp[0][0] = 1;
	t = -2;
	for (int i = 1; i <= n; ++i) {
		t += k - 1;
		for (int j = 0; j <= i; ++j) {
			++t;
			lt = (long long)fac[t] * inv_fac[t - k + 2];
			lt >= MOD && (lt %= MOD);
			lt *= (long long)inv_fac[k - 2];
			lt >= MOD && (lt %= MOD);
			lt *= (long long)dp[i - 1][j];
			j && (lt += dp[i][j - 1]);
			dp[i][j] = lt < MOD ? lt : lt % MOD;
		}
		t -= i + 1;
	}
	lt = (long long)dp[n][n] * fac[n] % MOD;
	printf("%lld\n", lt);
	return 0;
}



Measured memory_bytes: 46208
def agree(s1, t1):
    for i in range(len(t1)):
        if not(s1[i] == t1[i] or s1[i] =='?'):
            return False
    return True

s = input()
t = input()  
ls, lt  = len(s), len(t)

ss =[]
for i in range(ls - lt +1):
    #print(s[i:i+lt], t)
    if agree(s[i:i+lt], t):
        ss.append( (s[:i] + t + s[i+lt:]).replace('?', 'a') )
#print(ss)

if ss:
    print(min(ss))
else:
    print('UNRESTORABLE')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
const double PI = acos(-1);
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n;
    cin >> n;
    vector<int> c(n - 1), s(n - 1), f(n - 1);
    rep(i, n) cin >> c[i] >> s[i] >> f[i];
    rep(i, n) {
        int now = 0;
        for (int j = i; j < n - 1; j++) {
            while (!(now >= s[j] && now % f[j] == 0)) now++;
            now += c[j];
        }
        cout << now << endl;
    }
}


Measured memory_bytes: 256