akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int	H = sc.nextInt(),W=sc.nextInt();
		char[][] arrayM = new char[H][W];
		String[] array=new String[H];

		for(int i=0;i<H;i++) {
			array[i] = sc.next();
			for(int j=0;j<W;j++) {
				arrayM[i][j] = array[i].charAt(j);
			}
		}

		for(int i=0;i<W+2;i++) {
			System.out.print("#");
		}
		System.out.println();
		for(int i=0;i<H;i++) {
			System.out.print("#");
			for(int j=0;j<W;j++) {
				System.out.print(arrayM[i][j]);
			}
			System.out.println("#");
		}
		for(int i=0;i<W+2;i++) {
			System.out.print("#");
		}
		System.out.println();
	}
	public static int sample() {
		return 1;
	}

}


Measured memory_bytes: 22356
#include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }


int solve(int n, int m) {
	vci num(n);
	for_(i, 0, n) num[i] = i+1;
	
	int cur = n - 1;
	for_(i, 1, n) {
		int j = 0;
		while (j<m) {
			cur = (cur + 1) % n;
			if (num[cur]>0) j++;
		}
		
		num[cur] = 0;
	}
	
	int ans = -1;
	for_(i, 0, n) if (num[i]!=0) ans = num[i];
	return ans;
}

int main() {
	int n, m;
	
	while (1) {
		cin >> n >> m; if (n==0 && m==0) break;
		
		cout << solve(n, m) << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define SORT(x) sort(x.begin(),x.end())

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<tuple<string,int,int>> score(N);
  rep(i,N){
    string S;
    int P;
    cin >> S >> P;
    score.at(i)=make_tuple(S,-P,i+1);
  }
  
  SORT(score);
  rep(i,N) cout << get<2>(score.at(i)) << endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100000
#define LL long long
int n,h,w;LL ans;
struct edge{
	int u,v,w;
}e[MAXN+1];
int fa[MAXN*2+1],siz[MAXN*2+1],used[MAXN*2+1];
int read(){
	int x=0,F=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*F;
}
bool cmp(edge s1,edge s2){
	return s1.w>s2.w;
}
int xfind(int x){
	if(fa[x]==x)return x;
	return fa[x]=xfind(fa[x]);
}
int main()
{
	n=read(),h=read(),w=read();
	for(int i=1;i<=n;i++)
	e[i]=(edge){read(),read()+MAXN,read()};
	for(int i=1;i<=MAXN*2;i++)fa[i]=i,siz[i]=1;
	sort(e+1,e+n+1,cmp);
	for(int i=1;i<=n;i++){
		int a=xfind(e[i].u),b=xfind(e[i].v);
		if(a==b){
			if(siz[a]>=used[a]+1){
				used[a]++;
				ans+=e[i].w;
			}
		}else{
			if(siz[a]+siz[b]>=used[a]+used[b]+1){
				used[a]+=used[b]+1;
				siz[a]+=siz[b];
				ans+=e[i].w;
				fa[b]=a;
			}
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 4224
function main()
  
  S = split(chomp(readline()),"")
  
  check = true
  
  for i in 1:length(S)
    
    
    if i % 2 == 0
      
      if (S[i] == "L" || S[i] == "U" || S[i] == "D") == false
        check = false
      end
      
    elseif i % 2 == 1
        
      if (S[i] == "R" || S[i] == "U" || S[i] == "D") == false
        check = false
      end
      
    end

    
  end

  println(check ? "Yes" : "No")
  
end

main()

Measured memory_bytes: 110476
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll MAXN=1e6+69;
ll n,p;
ll check[MAXN];
vector<ll>prime;
void mesang(){
    for(ll i=2;i<MAXN;i++){
        if(check[i])continue;
        prime.push_back(i);
        for(ll j=i*i;j<MAXN;j+=i)if(!check[j])check[j]=i;
    }
}
ll luythua(ll x,ll y){
    if(y==0)return 1;
    ll k=luythua(x,y/2);
    return k*k*(y%2?x:1);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    mesang();
    cin>>n>>p;
    ll ans=1;
    for(ll u:prime){
        ll cnt=0;
        while(p%u==0)p/=u,cnt++;
        ans*=luythua(u,cnt/n);
    }
    if(p!=1&&n==1)ans*=p;
    cout<<ans;
}

Measured memory_bytes: 11996
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
  int N,ans=0;
  string S;
  cin >> N >> S;
  rep(i,N){
    int alf1[26]={},alf2[26]={};
    rep(j,N){
      if(j<=i) alf1[S[j]-'a']++;
      else alf2[S[j]-'a']++;
    }
    int count=0;
    rep(j,26) if(alf1[j]>0 && alf2[j]>0) count++;
    ans=max(ans,count);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
//g++  7.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll N; cin>>N;
    ll arr[N];
    ll Amx = 0;
    map<ll,ll> mp;
    
    for(ll i=0;i<N;++i)
    {
        cin>>arr[i];
        mp[arr[i]]++;
        Amx = max(Amx,arr[i]);
    }
    
    ll vis[Amx + 1] = {0};
    
    for(ll i=1;i<=Amx;++i)
    {   
        if(mp[i] == 0)
            continue;
            
        ll j = 2*i;
        if(mp[i] > 1)
            vis[i] = 1;
        
        for(;j<=Amx;j+=i)
        {
            if(mp[j])
                vis[j] = 1;
        }
    }
    
    ll ans = 0;
    for(ll i=0;i<N;++i)
    {
        if(!vis[arr[i]])
            ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 75400
#include<iostream>
using namespace std;
int main() {
  int n;
  while( cin >> n, n ) {
    int num[n], one[n], two[n], sum[n];
    int maxid = 0;
    for(int i=0; i<n; i++) {
      cin >> num[i] >> one[i] >> two[i];
      sum[i] = one[i] + two[i];
      if( sum[maxid] < sum[i] ) maxid = i;
    }

    cout << num[maxid] << ' ' << sum[maxid] << endl;
  }
}

Measured memory_bytes: 1316
#include<iostream>
#include<string>
using namespace std;
int main(){
  while(true){
    int cycle[]={1,5,6,6,6,6,6,8,6,8};
    char mob[][16]={" ","',.!?","abcABC","defDEF","ghiGHI","jklJKL","mnoMNO","pqrsPQRS","tuvTUV","wxyzWXYZ"};
    int cnt=0,pre=0;
    string s;cin>>s;if(cin.eof())break;s+='0';
    for(int i=0;i<s.length();++i){
      int d=s[i]-'0';
      if(d==0&&pre==0){putchar(' ');}
      else if(d==0||(pre!=0&&d!=pre)){putchar(mob[pre][cnt%cycle[pre]]);cnt=0;}
      else if(d==pre){++cnt;}
      pre=d;
    }
    cout<<endl;
  }
  return 0;
}

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

using namespace std;

const int maxn = 100001;
typedef long long ll;
ll dp[maxn], w[maxn];
int v[maxn];
int n, W;

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

    cin >> n >> W;
    int sumv = 0;
    for(int i = 1; i <= n; i++){
        cin >> w[i] >> v[i];
        sumv += v[i];
    }
    fill(dp,dp+sumv+1,W+1);
    dp[0] = 0;
    int ans = 0;
    for(int i = 1; i <= n; i++)
        for(int j = sumv; j >= v[i]; j--){
            dp[j] = min(dp[j], dp[j-v[i]] + w[i]);
            if(dp[j] <= W) ans = max(ans, j);
        }
    cout << ans;
    return 0;
}


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

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

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

X = getN()
ans = 1
while True:
    if ans * (ans + 1) // 2 >= X:
        break
    ans += 1
print(ans)

Measured memory_bytes: 38512
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define nn int n=0
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
int x = 0, y = 0, z = 0,n = 0;
asas;
cncn;
//BEGIN OF CODE.
int main(void) {
	double ans;
	cin >> n;
	vector<double> x(n);
	vstr u(n);
	rep(i,n)cin >> x[i] >> u[i];
	rep(i, n) {
		if (u[i] == "JPY")ans += x[i];
		else {
			ans += x[i] * 380000;
		}
	}
	cout << ans << rt;
	please AC;
}

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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int N;
    cin >> N;

    set<char> st;
    rep(i,0,N){
        char S;
        cin >> S;
        st.insert(S);
    }

    cout << (st.size()==3?"Three":"Four") << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1e18;
#define Pint pair<int, int>
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rnr(i,a,b) for(int i=int(a);i>=int(b);i--)
#define rep(i,b) rng(i,0,b)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    int n, k; cin >> n >> k;
    int p[n];
    rep(i, n) cin >> p[i];
    sort(p, p + n);
    int ans = 0;
    rep(i, k) {
        ans += p[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	final static int MOD = 1000000007;
	public static void main(String[] args) {
		Reader in = new Reader();
		int n = in.nextInt();
		int m = in.nextInt();
		char[][] v = new char[n][m];
		int[][] dp = new int[n][m];
		for(int i  = 0; i<n; i++) {
			char[] a = in.next().toCharArray();
			for(int j = 0; j<m; j++)  v[i][j] = a[j];
		}
		dp[0][0] = 1;
		for(int i = 1; i<n; i++) if(v[i][0]=='#') dp[i][0] = 0; else dp[i][0] = dp[i-1][0];
		for(int j = 1; j<m; j++) if(v[0][j]=='#') dp[0][j] = 0; else dp[0][j] = dp[0][j-1];
			
		for(int i = 1; i<n; i++) {
			for(int j = 1; j<m; j++) {
				dp[i][j] += dp[i-1][j];
				dp[i][j]%=MOD;
				dp[i][j] += dp[i][j-1];
				dp[i][j]%=MOD;
				if(v[i][j]=='#') dp[i][j] = 0;
			}
		}
		System.out.println(dp[n-1][m-1]);
	}
	
	static class Reader {
		static BufferedReader br;
		static StringTokenizer st;
		private int charIdx = 0;
		private String s;

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

		public int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public char nextChar() {
			if (s == null || charIdx >= s.length()) {
				if (st == null || !st.hasMoreTokens())
					try {
						readLine();
					} catch (Exception e) {
					}
				s = st.nextToken();
				charIdx = 0;
			}
			return s.charAt(charIdx++);
		}

		public long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[] nca() {
			return next().toCharArray();
		}

		public String[] nS(int n) {
			String[] a = new String[n];
			for (int i = 0; i < n; i++)
				a[i] = next();
			return a;
		}

		public int nextInt() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return Integer.parseInt(st.nextToken());
		}

		public double nextDouble() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return Double.parseDouble(st.nextToken());
		}

		public Long nextLong() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return Long.parseLong(st.nextToken());
		}

		public String next() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return st.nextToken();
		}

		public static void readLine() {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
			}
		}
	}
}

Measured memory_bytes: 35780
#include <iostream>
using namespace std;
int n, k, tot;

int main(int argc, const char * argv[]) {
    
    cin >> n >> k;
    int i, now;
    for (i = 0; i < n; i++) {
        cin >> now;
        if (now >= k) {
            tot++;
        }
    }
    cout << tot << endl;
    
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]
from collections import defaultdict
a = defaultdict(int)

for i in S:
    a[i] += 1
for i in T:
    a[i] -= 1
    
ans = 0
for i in a:
    if a[i] > ans:
        ans = a[i]
        
print(ans)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define endl "\n"
#define ll long long 
#define F first
#define end 1000000000
#define S second
#define pb push_back
#define mp make_pair
using namespace std;

int main()
{
  char x;
  cin >> x;
  int n=int(x);
  
  if(n>=65 && n<=90)
  {
      cout << "A" << endl;
  }
  else
  cout << "a" << endl;
  
  return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
int main(){
  int x,y;
  while(1){  scanf("%d %d",&x,&y);
 if(x==0 && y==0)break;
   if(x<y){printf("%d %d\n",x,y);} 
    else{printf("%d %d\n",y,x);}

  }
  return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x,y,z;
  cin>>x>>y>>z;
  cout<<(x-z)/(y+z)<<endl;

  return 0;

}


Measured memory_bytes: 256
def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
def lcm(x, y):
  return (x * y) // gcd(x, y)
A, B, C, D = map(int, input().split(' '))
can_dived_c = B // C - (A - 1) // C
can_dived_d = B // D - (A - 1) // D
can_dived_both = B // lcm(C, D) - (A - 1) // lcm(C, D)
res = B - (A - 1) - can_dived_c - can_dived_d + can_dived_both
print(res)

Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))
a = list(map(lambda x: x*n, a))
b = []         
av = sum(a)//n
for i in range(n):
    b.append(abs(av-a[i]))
m = min(b)
for i in range(n):
    if m==b[i]:
        print(i)
        break


Measured memory_bytes: 3060
function main(input) {
    const H = input.split(' ');
    const A = parseInt(H[0],10);
    const B = parseInt(H[1],10);

    const pls = A + B;
    const min = A - B;
    const kake = A * B;

    if(pls > min && pls > kake) {
      console.log(pls);
    }else if (min > pls && min > kake) {
      console.log(min);
    } else if ( min === pls){
       console.log(min); 
  }else if (pls === kake){ console.log( pls)
   }else { console.log(kake)}

}

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

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

int n;
vector<pair<int,int>> G[110];
vector<int> seen(110, false);

int prim(){
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> qu;
    int sum = 0, size = 0;

    int u=0;
    seen[u]=true;
    size=1;
    while(size<n){
        for(auto e:G[u]) if(!seen[e.second]) qu.push(e); 
        while(1){
            pair<int, int> p=qu.top(); qu.pop();
            if(!seen[p.second]){
                u = p.second;
                sum += p.first;
                seen[u] = true;
                ++size;
                break;
            }
        }
    }
    return sum;
}

int main(){
    cin >> n;
    for(int i=0; i<n; ++i){
        for(int j=0; j<n; ++j){
            int w; cin >> w;
            if(w!=-1) G[i].push_back(make_pair(w, j));
        }
    }

    cout << prim() << '\n';

    return 0;
}


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

sort(a,a+n,[](int x,int y){
return x<y;
});


*/





void solve(){


int n;
cin>>n;

int a[n];

int count =0;
for(int i=0;i<n;i++) cin>>a[i];


for(int i=0;i<n;i++){
    
    if((i+1)%2==1&&a[i]%2==1){
        
        count++;
    }
    
    
    
}




cout<<count<<endl;





}


int main() {

int t;
t=1;


while(t-->0){



solve();
}



return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
 int H,N;
 scanf("%d%d",&H,&N);
 for(int i=0;i<N;i++){
 int A;
 scanf("%d",&A);
 H-=A;
 }
 if(H<=0)puts("Yes");
 else puts("No");
 }

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;
using p = pair<int, int>;

int main() {
  ll a, b, c, k;
  cin >> a >> b >> c >> k;

  ll s = 0;
  if (a >= k) {
    s = k;
  } else if (a+b >= k) {
    s = a;
  } else {
    s = a - (k-a-b);
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 3624
import numpy as np
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = np.array(A)
B = np.array(B)
if np.sum(A) < np.sum(B):
    print(-1) 
else:
    sub_a_b = A-B
    p_sub = sorted(list(sub_a_b[sub_a_b>0]),reverse = True)
    # print(p_sub)  
    m_sub = list(sub_a_b[sub_a_b<0])
    max_counter = p_sub[0]
    m_sub_sum = abs(sum(m_sub))
    count = len(m_sub) 
    # print(p_sub[0:1])
    # print(type(list(np.where(sub_a_b<0)[0])))
    # print(np.array([]))
    if list(np.where(sub_a_b<0)[0]) == [] :
        print(0)
        exit()
    else:
        count+=1

        for i in range(len(p_sub)):
            if max_counter >= m_sub_sum:
                print(count)
                exit()
            else:
                max_counter += p_sub[i+1]
                count += 1


Measured memory_bytes: 27104
p = [True for i in range(50000)]
p[0] = 0
for i in range(2,int(50000**(1/2)+1)):
    if p[i-1]:
        for j in range(i**2,50000,i):
            p[j-1] = False

prime = [i+1 for i in range(50000) if p[i]]

while(1):
    n = int(input())
    if not n:
        break
    count = 0
    half = n//2
    for i in prime:
        if i > half:
            break
        if p[n - i - 1]:
            count += 1
    print(count)


Measured memory_bytes: 6064
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){

	int N;
	cin>>N;
	
	ll ans = 0;

	for(int i = 1; i <= N; i++){
		ll tmp = N / i;
		ans += tmp * (tmp + 1) * i / 2;
	}
			
	cout<<ans<<endl;
	return 0;
}



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

int main() {
  int N,ac=0,wa=0,tle=0,re=0;
  cin >> N;
  rep(i,N) {
    string s;
    cin >> s;
    if (s=="AC") ac++;
    if (s=="WA") wa++;
    if (s=="TLE") tle++;
    if (s=="RE") re++;
  }
  cout << "AC x " << ac << endl;
  cout << "WA x " << wa << endl;
  cout << "TLE x " << tle << endl;
  cout << "RE x " << re << endl;
}


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

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using vll = vector<ll>;
using vi = vector<int>;
using vchar = vector<char>;
using vstr = vector<string>;
using pii = pair<int,int>;
using pll =  pair<ll,ll>;

const ll mod = 1000000007;

#define pi acos(-1)
#define pb push_back
#define mp make_pair
#define test int TEST;cin>>TEST;while(TEST--)
#define all(x) x.begin(),x.end()
#define vrevsort(x) sort(x.rbegin(),x.rend())
#define opy cout<<"Yes\n"
#define opn cout<<"No\n"
#define flush fflush(stdout)
#define NL cout<<'\n'
#define SP cout<<' '

void solve(){
	int n;
	cin>>n;
	(n>=30)?opy:opn;
	
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    //test{solve();cout<<'\n';}
	solve();
    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>
#include<map>
#include<deque>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=1000000007;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}


int main(void){
    ll X,K,D;
    cin>>X>>K>>D;
    X=ABS(X);
    if(X/D>=K) cout<<X-K*D<<endl;
    else{
        K-=X/D;
        X-=(X/D)*D;
        if(K%2==0) cout<<X<<endl;
        else cout<<ABS(X-D)<<endl;
    }
    return 0;
}

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

using namespace std;

void CountTriangles(vector <int> A){  
  
    int n=A.size(); 
  
    sort(A.begin(), A.end());  
  
    int count = 0; 
      
    for( int i = n-1; i >= 1; i--){ 
        int l = 0, r = i-1; 
        while( l < r){ 
            if( A[l] + A[r] > A[i]){ 
  
                // If it is possible with a[l], a[r] 
                // and a[i] then it is also possible 
                // with a[l+1]..a[r-1],a[r] and a[i] 
                count += r - l ;  
  
                //checking for more possible solutions 
                r--;   
            } 
            else 
  
                // if not possible check for  
                // higher values of arr[l] 
                l++;   
        } 
    } 
    cout<<"No of possible solutions: "<<count; 
} 

int main()
{
	
	int n;

	cin >> n;

	int l[n];

	for(int i = 0; i < n ; i++)
	{

	   cin >> l[i];

	}
    
    int ans = 0;

	sort (l, l + n);
    
   for ( int i = n-1; i >= 1; i--)
   { 
        
        int k = 0, m = i-1;

        while( k < m)
        { 
            if( l[k] + l[m] > l[i])
            { 
            
                ans += m - k ;   
            
                m--;   
            
            } 
            else 
            
                k++;   
        } 
    } 
    cout << ans;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int R = sc.nextInt();
        int G = sc.nextInt();
        int B = sc.nextInt();
        int N = sc.nextInt();

        int count = 0;
        int maxR = N/R;
        for (int i=0;i<=maxR;i++){
            int restN = N-i*R;
            int maxG = restN/G;
            for(int j=0;j<=maxG;j++){
                int tmp = restN - j*G;
                if(tmp%B==0){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}

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

#define int long long

#define ll long long
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define P pair<ll,ll>
#define ld long double
ll INF = (1LL << 60);
int mod = 1000000007;

class UnionFind {
public:
	vector <ll> par; // 各元の親を表す配列
	vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1) {
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.resize(sz_, 1);
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}

	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}
};
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x%mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m; cin >> n >> m;
	UnionFind uf(n);
	rep(i, m) {
		int a, b; cin >> a >> b; a--; b--;
		uf.merge(a, b);
	}
	ll ans = 0;
	rep(i, n) {
		ans = max(ans, uf.size(i));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6364
#include <map>
#include <cstdio>
typedef long long ll;

inline int Min(const int a,const int b){return a<b?a:b;}
inline int Max(const int a,const int b){return a>b?a:b;}

int n,a,ps;
int v[100005],p[100005],c[100005];
ll Ans[100005];
std::map<int,int> m1,m2;

int main()
{
    //freopen("in.txt","r",stdin);
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
    {
        scanf("%d",&a);
        if(!m1[a])m1[a]=i;
        ++m2[a];
    }
    for(auto i:m1)v[++ps]=i.first,p[ps]=i.second,c[ps]=m2[i.first];
    //for(int i=1;i<=ps;++i)printf("%d %d %d\n",v[i],p[i],c[i]);
    for(int i=ps;i>=1;--i)
    {
        Ans[p[i]]+=ll(v[i]-v[i-1])*c[i];
        c[i-1]+=c[i],p[i-1]=Min(p[i-1],p[i]);
    }
    for(int i=1;i<=n;++i)printf("%lld\n",Ans[i]);
    return 0;
}

Measured memory_bytes: 12416
S = input()
if S == "SAT":
  print(1)
elif S == "SUN":
  print(7)
elif S == "MON":
  print(6)
elif S == "TUE":
  print(5)
elif S == "WED":
  print(4)
elif S == "THU":
  print(3)
elif S == "FRI":
  print(2)

Measured memory_bytes: 38384
nl = input().split()
n = int(nl[0])
l = int(nl[1])

a = [l+i for i in range(n)]
b = [abs(a[i]) for i in range(n)]
b.sort()
c = b[0]
cnt = 0
t = 0
for i in range(n):
  if abs(a[i]) != c :
    t += a[i]
  elif abs(a[i]) == c and cnt == 0:
    cnt += 1
print(t)
  

Measured memory_bytes: 3064
import sys
import copy
import heapq
from collections import deque

# sys.setrecursionlimit(100001)
INF = sys.maxsize


# ===CODE===
def main():
    n = int(input())
    dist_mat = []
    for i in range(n):
        l = list(map(int, input().split()))
        dist_mat.append(l)

    dist_mat_calc = [[INF for i in range(n)] for j in range(n)]

    ans = 0
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if i == j:
                    continue
                dist_mat_calc[i][j] = min(dist_mat_calc[i][j], dist_mat[i][k] + dist_mat[k][j])

    tmp = [[dist_mat_calc[j][i] if dist_mat_calc[j][i] != INF else 0 for i in range(n)] for j in range(n)]
    if tmp != dist_mat:
        print(-1)
        exit(0)

    ans = 0

    for i in range(n):
        for j in range(i, n):
            if i == j:
                continue
            tmp = min([x+y for (x,y) in zip(dist_mat_calc[i], dist_mat_calc[j])])
            if dist_mat_calc[i][j] < tmp:
                ans+=dist_mat_calc[i][j]

    print(ans)





if __name__ == '__main__':
    main()


Measured memory_bytes: 47964
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<queue>
#include <cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<ctime>
#define rep(i,n) for (int i=0;i<n;i++)
//#include <bits/stdc++.h>
using namespace std;

const long int INF=1000000007;

int main(){
    int S;
    cin>>S;
    long long a[S+1],sum[S+1];
    if (S<=2){
        cout<<0<<endl;
        return 0;
    }
    if (S<=5){
        cout<<1<<endl;
        return 0;
    }
    a[0]=0;
    a[1]=0;
    a[2]=0;
    a[3]=1;
    a[4]=1;
    a[5]=1;
    sum[0]=0;
    sum[1]=0;
    sum[2]=0;
    for (int i=3;i<=S-3;i++){
        sum[i]=sum[i-1]+a[i];
        sum[i]=sum[i]%INF;
        a[i+3]=1+sum[i];
        a[i+3]=a[i+3]%INF;
    }
    cout<<a[S]<<endl;
    return 0;
}

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

int main()
{
int t;
cin>>t;
 int AC=0,WA =0,TLE=0 ,RE=0;
while(t--)
{
    string s ;
    cin>>s;


    if(s=="AC")
        AC++;
    else if(s=="WA")WA++;
    else if(s=="TLE")TLE++;
    else RE++;

}
cout<<"AC x "<<AC<<endl;
cout<<"WA x "<<WA<<endl;
cout<<"TLE x "<<TLE<<endl;
cout<<"RE x "<<RE<<endl;

    return 0;
}


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

double solve() {
    ll N;
    cin >> N;
    vector<double> P(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> P[i];
    }
    vector<double> q(N+1);
    q[0] = 1;
    for ( int i = 0; i < N; i++ ) {
        for ( int j = i+1; j >= 0; j-- ) {
            q[j] = (1-P[i]) * q[j];
            if ( j-1 >= 0 ) q[j] += P[i] * q[j-1];
        }
    }
    double ans = 0;
    for ( int i = (N+1)/2; i <= N; i++ ) {
        ans += q[i];
    }
    return ans;
}

int main() {
    cout.setf(ios::fixed);
    cout.precision(16);
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    x = int(input())

    def prime_decomp(n):
        i = 2
        res = []
        while i ** 2 <= n:
            while n % i==0:
                n //= i
                res.append(i)
            i += 1
        if n > 1:
            res.append(n)
        return res

    while 1:
        if len(prime_decomp(x))==1:
            print(x)
            exit()
        else:
            x += 1

if __name__ == '__main__':
    main()

Measured memory_bytes: 38896
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MAX 2000005
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define vi vector<ll>
#define vp vector<pii>
#define all(v) v.begin(),v.end()
#define lb(v,x) lower_bound(all(v),x)
#define ub(v,x) upper_bound(all(v),x)
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;
//#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

ll mexp(ll a, ll b){
    ll ans=1;
    a%=MOD;
    while(b){
        if(b&1) ans=ans*a%MOD;
        b>>=1;
        a=a*a%MOD;
    }
    return ans;
}

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

const int N = 3005;

ll dp[N][N];

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

    ll a[n+1];
    FOR(i,1,n+1){
        cin>>a[i];
    }
    FOR(i,1,n+1){
        FOR(j,i,n+1){
            int l=j-i+1, r=j;
            dp[l][r]=max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
        }
    }
    cout<<dp[1][n];
    cerr<<1.0/CLOCKS_PER_SEC<<endl;
    return 0;
}

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

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

    int s[n];
    for( int i = 0; i < n; i++ )
        cin >> s[i];

    for( int i = 1; i <= m; i++ )
    {
        for( int j = 0; j < n - 1; j++ )
        {
            if( s[j] % i > s[j+1] % i )
            {
                int temp = s[j];
                s[j] = s[j+1];
                s[j+1] = temp;
            }
        }
    }

    for( int i = 0; i < n; i++ )
        cout << s[i] << endl;

    return 0;
}


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

int main() {
   
  int N,M,all =  0;
  double line = 0;
  int count = 0;
  int A[110] = {0};
  
  cin >> N >> M;
  
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  for(int i = 0; i < N; i++){
    all += A[i]; 
  }
  line = all / (4.0*M);
  
  for(int i = 0; i < N; i++){
    if(A[i]>=line){
      count++;
    }
  }
  
  if(count>=M){
    cout << "Yes" <<endl;
  }
  
  else
    cout << "No" <<endl;
  
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string S;
  cin >> S;
  int N = S.size();
  vector<int> c(N, 0);
  for(int i=0; i<N; ){
    vector<int> t(2, 0);
    for(; i<N && S[i]=='R'; i++) t[i%2]++;
    int r=i-1;
    int l=i;
    c[r] += t[r%2];
    c[l] += t[l%2];
    for(; i<N && S[i]=='L'; i++) c[r+((i-r)%2)]++;
  }
  cout << c[0];
  for(int i=1; i<N; i++) cout << " " << c[i];
  cout << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll 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)1E18;
#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 endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    ll a[2][2];
    rep(i,0,1){
        rep(j,0,1){
            cin>>a[i][j];
        }
    }
    ll maxi=-inf;
    rep(i,0,1){
        rep(j,0,1){
            maxi=max(maxi,a[0][i]*a[1][j]);
        }
    }
    cout<<maxi<<endl;
    

    return 0;
}





Measured memory_bytes: 3612
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner scanner = new Scanner(System.in);
		
		String inputN = scanner.nextLine();
		String inputV = scanner.nextLine();
		String inputC = scanner.nextLine();

		scanner.close();
		
		Integer inN = Integer.parseInt(inputN);
		List<Integer> inV = Arrays.asList( inputV.split(" ") ).stream().map(x -> Integer.parseInt(x) ).collect(Collectors.toList());
		List<Integer> inC = Arrays.asList( inputC.split(" ") ).stream().map(x -> Integer.parseInt(x) ).collect(Collectors.toList());

		
		int max = 0;
		for(int i = 0; i < inN; i++) {
			int v = inV.get(i);
			int c = inC.get(i);
			
			if(v - c > 0) {
				max += v - c;
			}
		}
		
		System.out.println(max);
	}
}

Measured memory_bytes: 27728
#include <bits/stdc++.h>
//#include <stdio.h>
#define ll long long
#define S second
#define F first
using namespace std;
const ll N = 1e5 + 100, P = 1e9 + 7;

int n;
string s;

int main(){
    ios_base::sync_with_stdio(false);
   // freopen("crypt.in", "r", stdin);
   // freopen("crypt.out", "w", stdout);
    cin >> s;
    cin >> n;
    for(auto &x : s){
        int cnt = ('z' - x + 1);
        if(x == 'a') continue;
        if(cnt <= n){
            x = 'a';
            n -= cnt;
        }
    }
    if(n != 0){
        int c = s.back();
        c -= 'a';
        c += n;
        c %= 26;
        s[s.size() - 1] = c + 'a';
    }

    cout << s;
}


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

using namespace std;


int main(){
	map<long long int, long long int>D;
	long long int N;
	cin >> N;
	for( size_t i = 0; i < N; i++ ){
		long long int x;
		cin >> x;
		D[x]++;
	}
	long long int M;
	cin >> M;
	for( size_t i = 0; i < M; i++ ){
		long long int y;
		cin >> y;
		D[y]--;
		if( D[y]<0 ){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}


Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 /*int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }*/
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int a){
	par= vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int gcm(int a,int b){
    if(b==0)
        return a;
    return gcm(b,a%b);
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
/*struct dfs(){

}*/
signed main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<c-(d-b)<<' '<<d+(c-a)<<' '<<a-(d-b)<<' '<<b+(c-a)<<endl;
}

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

int main(void){
  char x,y;
  cin >> x >> y;
  int number1,number2;
  if(x == 'A')      number1 = 10;
  else if(x == 'B') number1 = 11;
  else if(x == 'C') number1 = 12;
  else if(x == 'D') number1 = 13;
  else if(x == 'E') number1 = 14;
  else if(x == 'F') number1 = 15;

  if(y == 'A')      number2 = 10;
  else if(y == 'B') number2 = 11;
  else if(y == 'C') number2 = 12;
  else if(y == 'D') number2 = 13;
  else if(y == 'E') number2 = 14;
  else if(y == 'F') number2 = 15;

  if(number1 > number2) cout << ">" << '\n';
  else if(number1 < number2) cout << "<" << '\n';
  else cout << "=" << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a + b >= c) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


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

int main() {
    int n, R[200010];
    cin >> n;
    for (int i = 0; i < n; i++) cin >> R[i];

    int max_p = R[1] - R[0];
    int minv = min(R[0], R[1]);
    for (int i = 2; i < n; i++) {
        max_p = max(max_p, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << max_p << endl;
    return 0;
}


Measured memory_bytes: 3900
#include <iostream>
#include <cstdint>

using namespace std;

int main(int argc, char const* argv[]) {
	int32_t a, b, c, d;
	cin >> a >> b >> c >> d;

	while (1) {
		c -= b;
		if (c <= 0) {
			cout << "Yes" << endl;
			return 0;
		}
		a = a - d;
		if (a <= 0) {
			cout << "No" << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 3632
fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val n = sc.nextInt()
    val k = sc.nextInt()
    val s = sc.next()

    val c = s.toCharArray()
    c[k - 1] = c[k - 1].toLowerCase()
    println(c.joinToString(""))
}

Measured memory_bytes: 33908
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
#include<cassert>
#include<functional>




using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<double, double> pdd;

#define show(x) cerr << x
#define debug(x) show(#x << ": " << (x) << endl)

const long double PI = 3.14159265358979323846;
const long double eps = 1e-5;
const int INF = numeric_limits<int>::max();
const ll LINF = numeric_limits<ll>::max();
const ll mod = 1000 * 1000 * 1000 + 7;

const int N = 100000 + 200;

void solve() {
    vector<int> a(N, 0);
    for (int k = 2; k * (k - 1) / 2 < N; ++k) {
        a[k * (k - 1) / 2] = k;
    }
    int n;
    cin >> n;
    if (a[n] == 0) {
        cout << "No\n";
        return;
    }
    cout << "Yes\n";
    int k = a[n];
    vector<vector<int> > s(k);
    int id = 0;
    for (int i = 0; i < k; ++i) {
        for (int j = i + 1; j < k; ++j) {
            ++id;
            s[i].push_back(id);
            s[j].push_back(id);
        }
    }
    cout << k << endl;
    for (int i = 0; i < k; ++i) {
        cout << s[i].size();
        for (int j = 0; j < s[i].size(); ++j) {
            cout << " " << s[i][j];
        }
        cout << "\n";
    }


}

//#define LOCAL

int main() {
    ios_base::sync_with_stdio(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    solve();


#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif	
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> s(n);
  int i, j;
  for (i = 0; i < n; i++) {
    cin >> s[i];
  }
  int q;
  cin >> q;
  vector<int> t(q);
  for (i = 0; i < q; i++) {
    cin >> t[i];
  }
  int result = 0;

  int l, r;
  bool breaked;
  for (i = 0; i < q; i++) {
    l = 0;
    r = n - 1;
    while (l != r - 1) {
      if (s[l + (r - l) / 2] == t[i] || s[l] == t[i] || s[r] == t[i]) {
        result++;
        break;
      } else if (s[l + (r - l) / 2] < t[i]) {
        l = l + (r - l) / 2;
      } else {
        r = l + (r - l) / 2;
      }
    }
  }
  cout << result << endl;


  return 0;
}



Measured memory_bytes: 3276
#include<iostream>
using namespace std;
 
int main(){
  int K,S,ans=0;
  cin >> K >> S;
  for(int i=0;i<=K;i++){
    for(int j=0;j<=K;j++){
      
        if(S-i-j>=0 && S-i-j<=K){++ans;}
     
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256