akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ref(i,n) for(int i = 0;i<n;i++)

int main()
{
	string s;
	cin>>s;
	char ch[10] = {0};
	ref(i,4){
		s[i] = tolower(s[i]);
		ch[i] = s[i];
	}
	sort(ch,ch+4);
	if(ch[0] == ch[1] && ch[2] == ch[3] && ch[2] != ch[0])
		cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

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

namespace Program {
    class Program {
        static void Main(string[] args) {
            var cr = new CR();
            var n = cr.i;

            var v1 = new Dictionary<int, int>();
            var v2 = new Dictionary<int, int>();
            for (var i = 0; i < n / 2; i++) {
                var v = cr.i;
                if (v1.ContainsKey(v))
                    v1[v]++;
                else
                    v1[v] = 1;

                v = cr.i;
                if (v2.ContainsKey(v))
                    v2[v]++;
                else
                    v2[v] = 1;
            }

            var v1o = v1.OrderByDescending(x => x.Value).Take(2).ToArray();
            var v2o = v2.OrderByDescending(x => x.Value).Take(2).ToArray();

            var ans = n;
            if (v1o[0].Key == v2o[0].Key) {
                if (v1o.Length == 1) {
                    ans -= v1o[0].Value;
                } else {
                    var m1 = v1o[0].Value + v2o[1].Value;
                    var m2 = v1o[1].Value + v2o[0].Value;
                    ans -= Math.Max(m1, m2);
                }
            } else {
                ans -= v1o[0].Value + v2o[0].Value;
            }

            Console.WriteLine(ans);
        }

        private class CR {
            System.IO.TextReader _r;
            Queue<string> _d;
            public CR() { _r = Console.In; _d = new Queue<string>(); }
            string Read() {
                while (_d.Count == 0)
                    foreach (var v in _r.ReadLine().Split(' '))
                        if (v != "")_d.Enqueue(v);
                return _d.Dequeue();
            }
            public int i { get { return int.Parse(Read()); } }
            public string s { get { return Read(); } }
        }
    }
}

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

// 小数点以下桁数
// fixed << setprecision(i)

int gcd(int a,int b){return (a%b==0?b:gcd(b, a%b));}
int lcm(int a,int b){return a*b/gcd(a, b);}

int main()
{
  int64_t n, ans = 0, q, a, b, c;
  vector<int64_t> map_a(100001, 0);
  vector<int64_t> vec_ans;

  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> a;
    map_a[a]++;
    ans += a;
  }
  cin >> q;
  for (int i = 0; i < q; i++)
  {
    cin >> b >> c;
    map_a[c] += map_a[b];
    ans += (c - b) * map_a[b];
    map_a[b] = 0;
    vec_ans.push_back(ans);
  }
  for (int i = 0; i < q; i++)
    cout << vec_ans[i] << endl;
}

Measured memory_bytes: 5096
N, M = map(int, input().split())
S_LIST = []
for i in range(M):
    S_LIST.append(list(map(int, input().split()))[1:])
P_LIST = list(map(int, input().split()))

cnt = 0
for i in range(2 ** N):  # bit全探索
    for idx, s in enumerate(S_LIST):  # ライト
        n_on = 0
        for k in s:  # スイッチonの個数数える
            if ((i >> (N - k)) & 1):
                n_on += 1
        if (n_on % 2 != P_LIST[idx]):  # 点灯しているかどうか
            break
        if (idx == M - 1):
            cnt += 1  # 全点灯
print(cnt)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


static const long long INF=1LL<<60;

int main(){
    int n,m;
    cin>>n>>m;
    vector<long long> c(m,0);
    vector<long long> a(m);
    for(int i=0;i<m;++i){
        int t;
        cin>>a[i]>>t;
        for(int j=0;j<t;++j){
            int bit;
            cin>>bit;
            --bit;
            c[i]+=(1<<bit);
        }
    }

    vector<vector<long long>> dp(m+1,vector<long long>(1<<15,INF));
    dp[0][0]=0;

    for(int i=0;i<m;++i){
        for(int j=0;j<(1<<n);++j){
            chmin(dp[i+1][j],dp[i][j]);
            int nj=j|c[i];
            chmin(dp[i+1][nj],dp[i][j]+a[i]);
        }
    }

    cout<<(dp[m][(1<<n)-1]<INF?dp[m][(1<<n)-1]:-1)<<endl;
}

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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define sint int32_t
#define int long long int
#define all(v) v.begin() , v.end()
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;



int32_t main()
{   fastio;

    int n;
    cin>>n;
    string s;
    cin>>s;
    vector<int>v;
    for(int i=0; s[i]; i++) {
        if(v.empty()) v.pb(s[i]);
        else {
            if(s[i] != v.back()) v.pb(s[i]);
        }
    }
    cout<<v.size()<<endl;

}


Measured memory_bytes: 4460
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using ll = long long;
#define rep(inc, bgn, end) for (int inc = bgn; inc < end; ++inc)
#define repe(inc, bgn, end) for (int inc = bgn; inc <= end; ++inc)

using namespace std;

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

    repe(i, 0, n) {
        repe(j, 0, n - i) {
            int k = n - i - j;
            if (i * 10000 + j * 5000 + k * 1000 == y) {
                printf("%d %d %d\n", i, j, k);
                return 0;
            }
        }
    }

    cout << "-1 -1 -1" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string S;
  cin >> S;
  int N = S.size();
  vector<vector<ll>> dp(N+1,vector<ll>(4,0));
  dp[0][0] = 1;
  string str = "ABC";
  for(int i=0; i<N; i++){
    for(int j=0; j<4; j++){
      if(S[i] == '?'){
        dp[i+1][j] += dp[i][j]*3;
        dp[i+1][j] %= mod;
        if(j==3) continue;
        dp[i+1][j+1] += dp[i][j];
        dp[i+1][j+1] %= mod;
        continue;
      }
      dp[i+1][j] += dp[i][j];
      dp[i+1][j] %= mod;
      if(S[i] == str[j]){
        dp[i+1][j+1] += dp[i][j];
        dp[i+1][j+1] %= mod;
      }
    }
  }
  // for(int i=0; i<=N; i++){
  //   for(int j=0; j<4; j++){
  //     cout << dp[i][j] << " \n"[j+1==4];
  //   }
  // }
  cout << dp[N][3] << "\n";
  return 0;
}


Measured memory_bytes: 10316
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>

typedef long long ll;

int max(int a,int b){
    if(a>b) return a;
    else return b;
}

int min(int a,int b){
    if(a<b) return a;
    else return b;
}

/*qsort(array,num_of_index,sizeof(int),compare_int); */
 int compare_int(const void *a,const void *b){
     return *(int*) a - *(int *) b; 
 } 
 
int main(){
    int a;
    scanf("%d",&a);
    if(a) printf("0");
    else printf("1");
}


Measured memory_bytes: 1616
import java.util.Scanner;

public class Main {

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

		// 整数の入力
		int X = sc.nextInt();
		int A = sc.nextInt();

		if(X < A){
			System.out.println(0);
		}else{
			System.out.println(10);
		}

		sc.close();
	}
}


Measured memory_bytes: 21844
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=0
for i in range(n):
    if b[i]>=a[i]:
        cnt+=a[i]
        b[i]-=a[i]
        if b[i]>=a[i+1]:
            cnt+=a[i+1]
            a[i+1]=0
        else:
            a[i+1]-=b[i]
            cnt+=b[i]
    else:
        cnt+=b[i]
print(cnt)

Measured memory_bytes: 24056
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	long long int n,m,x=0,count=0;
	cin>>n>>m;
	long long int arr[n+5];
	for (long long int i = 0; i < n; i++) {
		cin>>arr[i];
		x=x+arr[i];
	}
	for (long long int i = 0; i < n; i++) {
		if (x*(1.0/(4*m))<=arr[i])
	{
		count++;
	}	
	}
	if (count>=m)
	{
		cout<<"Yes"<<endl;
	}
	else
		cout<<"No"<<endl;

	return 0;
}

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

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 110000

pair<int,int> AB[MAX];
int N, M;

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int ans = 0;
	cin>>N>>M;
	
	for(int i = 0; i < N; i++){
		cin>>AB[i].first>>AB[i].second;
	}
	
	sort(AB,AB+N);
	
	for(int i = 0; i < N;){//cout<<i<<" "<<ans<<endl;
		if(AB[i].second >= M){
			ans += AB[i].first*M;
			
			break;
		} else {
			ans  += AB[i].first*AB[i].second;
			M -= AB[i].second;
			i++;
		}
	}
	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(){
  int N, M, C, tmp, sum = 0, ans = 0;
  cin >> N >> M >> C;
  
  int B[M];
  for (int i=0; i<M; i++){
    cin >> tmp;
    B[i] = tmp;
  }
  for (int i=0; i<N; i++){
    sum = 0;
    for (int j=0; j<M; j++){
      cin >> tmp;
      sum += tmp*B[j];
    }
    if (sum + C > 0) ans++;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import * as fs from 'fs'
import {type} from "os";

const input: string = fs.readFileSync('/dev/stdin', 'utf8');
const args: string[][] = input.split('\n').map(l => l.split(' '));

const n = parseInt(args[0][0]);

const sum =
  [...Array(n)]
    .map((_, i) => i + 1)
    .filter(x => !isString(x))
    .reduce((x: number, y: number) => x + y);

console.log(sum);

function isString(n: number): boolean {
  return (n % 3 === 0 || n % 5 === 0)
}

Measured memory_bytes: 72732
import sys
sys.setrecursionlimit(15000)
n,w = map(int,sys.stdin.readline().split())
dp = [0]*(w+1)
for i in range(n):
  vi,wi = map(int,sys.stdin.readline().split())
  for j in range(w+1)[::-1]:
    if 0 <= j-wi and j-wi <= w:
      #print(j-wi,vi)
      dp[j] = max(dp[j],dp[j-wi]+vi)
print(dp[-1])



Measured memory_bytes: 5924
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0; i<n; i++){
            cin>>a[i];
    }
    sort(a.begin(),a.end());
    
    for(int i = 0; i < n; i++)
        if(a[i]==a[i+1]){
                cout<< "NO" <<endl;
                return 0;
        }
        cout<< "YES" <<endl;
    
}

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

using namespace std;

const long long MOD = 1000000007;


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

    string answer = "";

    for (int i = 1; i <= K; i++) {
        answer += "ACL";
    }

    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 3588
from bisect import bisect_left

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

lst = [0] * (N + 1)
for a in A:
    lst[a - 1] += 1
lst.sort() #頻度列

s = [0] * (N + 1)
for i in range(N):
    s[i + 1] = s[i] + lst[i + 1]

# print (lst)
# print (s)

def check(x, k):
    i = bisect_left(lst, x) - 1
    total = x * (N - i) + s[i]
    return total >= x * k


for k in range(1, N + 1):
    l = 0 #OK
    r = N // k + 1 #NG
    while l + 1 < r:
        c = (l + r) // 2
        if check(c, k):
            l = c
        else:
            r = c
    print (l)
        

Measured memory_bytes: 37884
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



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

    ll ans = 0,st = 0;
	rep(i,0,sz(s)){
	    if(st > 0){
            if(s[i] == 'p'){
                st--;
            }else{
                st--;
                ans++;
            }
	    }else{
            if(s[i] == 'p'){
                ans --;
                st++;
              //  cout << 'g';
            }else{
                st++;
            }
	    }
	}
    P(ans);
	return  0;
}

Measured memory_bytes: 512
import sys
from collections import Counter

s = input()
n = len(s)
ns = []
no = []

for i in range(n):
    if s[i] != "x":
        ns.append(s[i])
        no.append(i)
        
no = [-1] + no + [n]
        
m = len(no) 
sa = []
for i in range(m-1):
    sa.append(no[i+1] - no[i] - 1)
        
if ns != ns[::-1]:
    print(-1)
    sys.exit()
    
ans = 0
if m%2 == 1:
    mm = m//2
    te = no[mm]
    ans = 0
    for i in range(mm):
        ans += abs(sa[i]-sa[m-2-i])
else:
    mm = m//2
    te = no[mm]
    ans = 0
    for i in range(mm-1):
        ans += abs(sa[i]-sa[m-2-i])
        
print(ans)

Measured memory_bytes: 57200
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#include<iostream>
#include<queue>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef pair<string,int> P;
int n,m;

int main()
{
    cin>>n>>m;
    int k;
    vector<vector<int> > s;
    s.resize(m);
    
    for(int i=0;i<m;i++){
        cin>>k;
        int si;
        for(int j=0;j<k;j++){
            cin>>si;
            si--;
            s[i].push_back(si);
        }
    }
    vector<int> p;
    int pi;
    for(int i=0;i<m;i++){
        cin>>pi;
        p.push_back(pi);
    }
    /*
    cout<<"s"<<endl;
    for(int i=0;i<s.size();i++){
        for(int j=0;j<s[i].size();j++){
            cout<<s[i][j]<<" ";
        }
        cout<<endl;
    }
    cout<<endl;
    */
    int l=(1<<n)-1;
    vector<int> d;
    d.resize(n);
    int ans=0;
    //cout<<l<<endl;
    for(int i=0;i<=l;i++){
        d.resize(n,0);
        int k=i;
        int cur=0;
        while(k>0){
            d[cur]=k%2;
            k=k/2;
            cur++;
        }
        /*
        cout<<"++++++"<<endl;
        for(int j=0;j<d.size();j++){
            cout<<d[j];

        }  
        
        cout<<endl; 
        */     
        int ope=0;
        for(int j=0;j<m;j++){
             int cur_n=0;
            for(int cnt=0;cnt<s[j].size();cnt++){
                //cout<<s[j][cnt]<<endl;
                if(d[s[j][cnt]]==1){
                    cur_n++;
                }
            }
            //cout<<"d"<<cur_n<<endl;
            if(cur_n%2==p[j]){
               ope++;
            }
        }
        if(ope==m){
            ans++;
        }
    }
    cout<<ans<<endl;
   
    return 0;
}

Measured memory_bytes: 256
/*
    Bismillahir Rahmanir Raheem
    Think Twice Code Once
    author : reaziii
*/
#include<bits/stdc++.h>
#define sc(x)        scanf("%lld",&x)
#define pcase(x)     printf("Case %d: ",x++)
#define pn           printf("\n")
#define fri(f)       for(int i=0;i<f;i++)
#define frj(f)       for(int j=0;j<f;j++)
#define reset(x,e)   memset(x,e,sizeof(x))
#define all(x)       x.begin(),x.end()
#define input        freopen("input.txt","r",stdin);
#define output       freopen("output.txt","w",stdout)
#define infi         INT_MAX
#define m_v          3000000
#define pii          pair<int,int>
#define pch          pair<char,char>
#define pll          pair<ll,ll>
#define mgraph       map<int,vector<int> >
#define mp           make_pair
#define pb           push_back
#define clr(x)       memset(x,0,sizeof(x))
#define frx(x,y)     for(int x=0;x<y;x++)
#define deb(x)       cout<<x
#define ideb(i,x)    cout<<i<<" "<<x
#define F            first
#define S            second
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
bool checkbitt(ll num,int pos);
ll setbitt(ll num,ll pos);
ll resetbitt(ll num,int pos);
 //.................___Start from here___.................//
//.................._____________________................//







void solve(){
    int n;
    int y = 5;
    for(int i=1;i<=5;i++){
        cin>>n;
        if(!n) cout<<i<<endl;
    }
}


int main(){
    // input;
    // output;

    int cs=1;
    int cn=1;
    // cin>>cs;
    while(cs--){
        solve();
    }
}






bool checkbitt(ll num,int pos){
    return (num>>pos) & 1;
}

ll setbitt(ll num,ll pos){
    return (1<<pos) | num;
}

ll resetbitt(ll num,int pos){
    if(!checkbitt(num,pos)) {
        return num;
    }
    else{
        return (1<<pos)^num;
    }
}





Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll gcd(ll x,ll y){
	if(x>y) swap(x,y);
	if(x==y) return x;
	if(x==1) return 1;
	if(x==0) return y;
	return gcd(y%x,x);
}
inline ll tgcd(ll x,ll y,ll z){
	if(x>y) swap(x,y);
	if(x>z) swap(x,z);
	if(y>z) swap(y,z);
	return gcd(gcd(x,y),z);
}
ll k,ans;
int main()
{
	scanf("%lld",&k);
	for(ll i=1;i<=k;++i){
		for(ll j=1;j<=k;++j){
			if(gcd(i,j)==1){
				ans+=k;
				continue;
			}
			for(ll l=1;l<=k;++l){
				ans+=tgcd(i,j,l);
			}
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 3844
#include <stdio.h>

int main(void) {
	int n,b;
	scanf("%d",&n);
	int a[101];
	for(b=0;b<n;b++){
		scanf("%d",&a[b]);
	}
	while(1){
		if(b==1){break;}
		printf("%d ",a[b-1]);
		b=b-1;
		
	}
	printf("%d\n",a[b-1]);
	return 0;
}

Measured memory_bytes: 596
#include<stdio.h>
#include<string.h>
int main(void){

    char a[4];

    scanf("%s",a);
    if(a[0]=='a'||a[0]=='b'||a[0]=='c'){
        if((a[1]=='a'||a[1]=='b'||a[1]=='c')&&(a[1]!=a[0])){
            if((a[2]=='a'||a[2]=='b'||a[2]=='c')&&(a[2]!=a[0])&&(a[2]!=a[1])){
                printf("Yes\n");
            }
            else{
                printf("No\n");
            }
        }
        else{
            printf("No\n");
        }
    }
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
# ABC 122: B – ATCoder
s = input()
acgt = 'ACGT'

length = 0
max_length = 0

for i in range(len(s)):
    if s[i] in acgt:
        for j in range(len(s) - i):
            if s[i + j] in acgt:
                length += 1
            else:
                break

        max_length = max(max_length, length)
        length = 0

print(max_length)

Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int A[3][3];
int N;
bool B[3][3];
// vector<int> A;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      int a;
      cin >> a;
      A[i][j] = a;
    }
  }
  cin >> N;
  for (int k = 0; k < N; k++) {
    int b;
    cin >> b;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (A[i][j] == b) {
          B[i][j] = true;
        }
      }
    }
  }

  if ((B[0][0] && B[0][1] && B[0][2]) || (B[1][0] && B[1][1] && B[1][2]) ||
      (B[2][0] && B[2][1] && B[2][2]) || (B[0][0] && B[1][0] && B[2][0]) ||
      (B[0][1] && B[1][1] && B[2][1]) || (B[0][2] && B[1][2] && B[2][2]) ||
      (B[0][0] && B[1][1] && B[2][2]) || (B[2][0] && B[1][1] && B[0][2])) {
    cout << "Yes" << endl;
    return 0;
  }

  cout << "No" << endl;
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

using ll = long long;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using P = pair<int, int>;

void Main() {
    int n;
	cin >> n;
    vll t(n), a(n), tot(n);
    ll T = 1, A = 1;
    rep(i, n) {
        cin >> t[i] >> a[i];
        tot[i] = t[i] + a[i];
        if(i == 0) {
            T = t[0]; 
            A = a[0];
        }
        else {
            ll temp = max((T+t[i]-1)/t[i], (A+a[i]-1)/a[i]);
            T = t[i] * temp; 
            A = a[i] * temp;
            //cout << T << " " << A << " " << temp << endl;
        }
    }
    
    cout << T+A << endl;
    return;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s,t;
cin >> s >> t;
bool ok = true;
for (int i=0; i<s.length(); i++)
    {
        if (s[i]!=t[i]) {cout << "No"; return 0;}
    }

cout << "Yes";


}


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

int gcd(int x, int y) {
    if (x < y) swap(x, y);
    int r = x%y;
    if (r == 0) {
        return y;
    }
    return gcd(y, r);
}

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    for (int i=0; i<N; i++) cin >> H[i];
    vector<bool> check(N, true);
    for (int i=0; i<M; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        if (H[a] > H[b]) check[b] = false;
        else if (H[a] < H[b]) check[a] = false;
        else {
            check[a] = false;
            check[b] = false;
        }
    }
    ll sum = 0;
    for (int i=0; i<N; i++) {
        if (check[i]) sum++;
    }
    cout << sum << endl;
}

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

int b[25];

int main(){
	int n, m, c;
	scanf("%d%d%d", &n, &m, &c);
	for(int i = 0; i < m; i++)
		scanf("%d", b + i);
	int ans = 0;
	for(int i = 0; i < n; i++) {
		int sum = 0;
		for(int j = 0; j < m; j++) {
			int a;
			scanf("%d", &a);
			sum += a * b[j];
		}
		if(sum + c > 0) ans++;
	}
	printf("%d\n", ans);
}


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

using namespace std;

const int MAX_N = 105;

int arr [MAX_N];

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

  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }

  sort(arr, arr + n);

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (x >= arr[i]) {
      ans++;
      x -= arr[i];
    }
  }

  if (ans == n && x != 0) ans--;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n,m,x;
    cin>>n>>m>>x;
    int c[n],a[n][m];
    rep(i,n){
        cin>>c[i];
        rep(j,m) cin>>a[i][j];
    }
    ll ans=123456789;
    rep(bi,(1<<n)){
        vector<int> level(m);
        ll cost=0;
        rep(i,n){
            if((bi>>i)&1){
                cost+=c[i];
                rep(j,m) level[j]+=a[i][j];
            }
        }
        bool flag=true;
        rep(j,m) if(level[j]<x) flag=false;
        if(flag) ans=min(ans,cost);
    }
    if(ans==123456789) cout<<-1;
    else cout<<ans;
}

Measured memory_bytes: 3592
#include<iostream>

using namespace std;

const int INF=0;

const int N_MAX=1<<20;
const int DAT_SIZE=N_MAX*2-1;
int dat[DAT_SIZE],lazy[DAT_SIZE];
int n;

int min(int a,int b){
  return a+b;
}

void init(int size){
  n=1;
  while(n<size){
    n*=2;
  }
}

void lazy_eval(int k){
  dat[k]+=lazy[k];
  if(k<n-1){
    lazy[k*2+1]+=lazy[k];
    lazy[k*2+2]+=lazy[k];
  }
  lazy[k]=0;
}

int rangemin(int a,int b,int k,int l,int r){
  if(r<=a||b<=l)return INF;
  lazy_eval(k);
  if(a<=l&&r<=b){
    return dat[k];
  }else{
    int v1=rangemin(a,b,k*2+1,l,(l+r)/2);
    int v2=rangemin(a,b,k*2+2,(l+r)/2,r);
    return min(v1,v2);
  }
}

int rangeadd(int v,int a,int b,int k,int l,int r){
  if(r<=a||b<=l){
    lazy_eval(k);
    return dat[k];
  }else if(a<=l&&r<=b){
    lazy[k]+=v;
    lazy_eval(k);
    return dat[k];
  }else{
    lazy_eval(k);
    int v1=rangeadd(v,a,b,k*2+1,l,(l+r)/2);
    int v2=rangeadd(v,a,b,k*2+2,(l+r)/2,r);
    return dat[k]=min(v1,v2);
  }
}

void change(int x,int v,int k,int l,int r){
  lazy_eval(k);
  if(k<n-1){
    if(x<(l+r)/2){
      change(x,v,k*2+1,l,(l+r)/2);
    }else{
      change(x,v,k*2+2,(l+r)/2,r);
    }
    lazy_eval(k*2+1);
    lazy_eval(k*2+2);
    dat[k]=min(dat[k*2+1],dat[k*2+2]);
  }else{
    dat[k]=v;
  }
}

int main(){
  int n,q;
  cin>>n>>q;
  init(n);
  while(q--){
    int com,x,y;
    cin>>com>>x>>y;
    if(com){
      cout<<rangemin(x-1,y,0,0,::n)<<endl;
    }else{
      rangeadd(y,x-1,x,0,0,::n);
    }
  }
}

Measured memory_bytes: 4008
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;

int main() {
  int n;
  int c;
  int s;
  int f;
  long long ans[500]={};
  
  cin>>n;
  for(int i=0;i<n-1;i++){
    cin>>c>>s>>f;
    for(int j=0;j<i+1;j++){
      if(ans[j]<s){
        ans[j]=s+c;
      }else{
        ans[j]+=c+f-(((ans[j]%f)==0)?f:ans[j]%f);
      }
    }
  }
  for(int i=0; i<n;i++){
    cout<<ans[i]<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	static int N=100;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
       int i,j,k,l,n,m[][]=new int[N+1][N+1],p[]=new int[N+1];
       Scanner sca =new Scanner(System.in);
       n=sca.nextInt();
       for(i=0;i<n;i++){
    		   p[i]=sca.nextInt();
    		   p[i+1]=sca.nextInt();
    		   m[i+1][i+1]=0;
    	   }
       for(k=2;k<=n;k++){
    	   for(i=1;i<=n-k+1;i++){
    		   j=i+k-1;
    		   m[i][j]=Integer.MAX_VALUE;
    		   for(l=i;l<=j-1;l++){
    			   if(m[i][l]+m[l+1][j]+p[i-1]*p[l]*p[j]<m[i][j]){
    				   m[i][j]=m[i][l]+m[l+1][j]+p[i-1]*p[l]*p[j];
    			   }
    		   }
    	   }
       }
       System.out.println(m[1][n]);
       }
	}



Measured memory_bytes: 26508
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
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<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

lint N, _prev;
string ans, _ans;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N;
	cout << 0 << endl << flush;
	cin >> _ans;
	lint lb = 0, ub = N + 1;
	lint cnt = 0;
	while (ans != "Vacant") {
		lint mid = (lb + ub) / 2;
		cout << mid << endl << flush;
		cin >> ans;
		if((mid%2 == 1) ^ (ans == _ans)) lb = mid;
		else ub = mid;
		cnt++;
		if (cnt == 22) break;
	}
	return 0;
}


Measured memory_bytes: 852
#include <bits/stdc++.h>
using namespace std;
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
typedef long long ll;
typedef long double ld;
ll A[505][505], pref[505], suf[505], ndp[505][505], dp[505][505];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j) {
			if (i == j) continue;
			scanf("%lld", &A[i][j]);
		}
	const ll INF = 1LL << 60;
	for (int a = 0; a <= n; ++a)
		for (int b = 0; b <= n; ++b)
			dp[a][b] = INF;
	dp[0][0] = 0;
	for (int i = 1; i < n; ++i) {
		suf[i] = 0;
		for (int j = i - 1; j >= 0; --j) {
			suf[j] = suf[j + 1] + A[j][i];
		}
		pref[0] = A[i][0];
		for (int j = 1; j < i; ++j) {
			pref[j] = pref[j - 1] + A[i][j];
		}
		for (int a = 0; a <= n; ++a)
			for (int b = 0; b <= n; ++b)
				ndp[a][b] = INF;
		for (int a = 0; a < i; ++a)
			for (int b = 0; b <= a; ++b) {
				ndp[a][b] = min(ndp[a][b], dp[a][b] + (b == 0 ? 0 : pref[b - 1]) + suf[a]);
				ndp[i][a] = min(ndp[i][a], dp[a][b] + (a == 0 ? 0 : pref[a - 1]));
			}
		swap(dp, ndp);
	}
	ll ans = INF;
	for (int a = 0; a < n; ++a)
		for (int b = 0; b <= a; ++b)
			ans = min(ans, dp[a][b]);
	printf("%lld\n", ans);
}


Measured memory_bytes: 6272
#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
using namespace std;
 

int main(){
    int a,b;
    cin>>a>>b;
    if((a==1 && b==2) || (a==2 && b==1)) cout<<3;
    else if((a==1 && b==3) || (a==3 && b==1)) cout<<2;
    else if((a==2 && b==3) || (a==3 && b==2)) cout<<1;
}

Measured memory_bytes: 256
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect

mod = 10**9 + 7

if __name__ == "__main__":
    n = int(input())
    a = list(map(int,input().split()))
    a.sort()
    prefix = [a[0]]
    for i in range(1,n):
        prefix.append(prefix[i-1] + a[i])
    ans = 0
    for i in range(n-1):
        d = (a[i]*(prefix[-1] - prefix[i]))%mod
        ans = ans + d
        ans = ans%mod
    print(ans)

Measured memory_bytes: 112940
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n, k, a[100005], ans;   
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n >> k;
    rep(i, 0, n) cin >> a[i];
    int cnt = k;
    ans = 1;
    while (1) {
        if (cnt == n) break;
        cnt += (k-1);
        if (0 < cnt - n && cnt - n < k)
        {
            ans++;
            break;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<climits>
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp> 
#include<ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define endl '\n'
#define SIZE 1000002
#define w(t) int t;cin>>t;while(t--)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define value_at_idx find_by_order
#define idx order_of_key
#define MOD 1000000007
#define mem(name,value) memset(name,value,sizeof(name))
#define pi 3.14159265358979323846
#define IOS ios::sync_with_stdio(0);cin.tie(0);
typedef long long int ll;
using namespace std;
using namespace __gnu_pbds;
const int p1 = 31;

int main() { IOS

	//Use long long
    char c;
    cin>>c;
    if(c>='a' && c<='z')
        cout<<'a';
    else 
        cout<<'A';
        
 	return 0;
            
}

Measured memory_bytes: 3620
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a>b){
			System.out.println("a > b");
		}else if(a<b){
			System.out.println("a < b");
		}else{
            System.out.println("a == b");
        }
	}

}



Measured memory_bytes: 26120
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};

fn main() {
    let n: i64 = read();
    let s: String = read();
    let s_char: Vec<u32> = s.chars().map(|x| x.to_digit(10).unwrap()).collect();
    let mut ans = 0;

    for i in 0..1000 {
       let first_digit = if i < 100 { 0 } else { i / 100 };
       let second_digit = if i < 10 { 0 } else { i % 100 / 10 };
       let third_digit = i % 10;

       let f_index: usize = match s_char.iter().position(|x| x == &first_digit) {
           Some(s) => s,
           None => continue
       };
       let s_index: usize = match s_char[f_index+1..].iter().position(|x| x == &second_digit) {
           Some(s) => s,
           None => continue
       };
       match s_char[f_index+1..][s_index+1..].iter().position(|x| x == &third_digit) {
           Some(s) => ans += 1,
           None => continue
       }
    }


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


Measured memory_bytes: 4352
// Package main provides
//
// File:  main.go
// Author: ymiyamoto
//
// Created on Mon Jan 28 18:36:27 2019
//
package main

import (
	"fmt"
)

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func main() {
	var N int
	fmt.Scan(&N)

	arr := []int{0}
	for i := 0; i < N; i++ {
		var a int
		fmt.Scan(&a)
		arr = append(arr, a)
	}
	arr = append(arr, 0)

	total := 0
	for i := 1; i < len(arr); i++ {
		total += abs(arr[i] - arr[i-1])
	}

	for i := 1; i < len(arr)-1; i++ {
		fmt.Println(total - (abs(arr[i]-arr[i-1]) + abs(arr[i+1]-arr[i])) + abs(arr[i+1]-arr[i-1]))
	}
}


Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
string alphabet = "abcdefghijklmnopqrstuvwxyz";
string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
  int x , a , b;
  cin >> x >> a >> b;
  int k = a - x;
  int l = b - x;
  if(k < 0)k = x - a;
  if(l < 0)l = x - b;
  if(k < l)cout << 'A' << endl;
  else cout << 'B' << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi p(n);
  vi inv(n);
  rep (i, n) {
    scanf("%d", &p[i]);
    p[i] -= 1;
    inv[p[i]] = i;
  }
  if (n == 1) {
    printf("0\n");
    return 0;
  }
  int maxlen = 0;
  for (int i = 0; i < n-1; ) {
    int curind = inv[i];
    for (int j = i+1; j < n; ++j) {
      if (j == n-1) {
        if (inv[j] > curind) {
          j += 1;
        }
        maxlen = max(maxlen, j - i);
        i = j;
        break;
      }
      if (inv[j] > curind) {
        curind = inv[j];
      } else {
        maxlen = max(maxlen, j - i);
        i = j;
        break;
      }
    }
  }
  printf("%d\n", n - maxlen);

  return 0;
}


Measured memory_bytes: 2424
using System;

class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        int[] r = new int[s.Length];

        for (int i = 0; i < s.Length; i++)
            r[i] = int.Parse(s[i]);
        
        Array.Sort(r);

        string ret = "";

        foreach (int n in r) ret = ret + n.ToString() + " ";

        Console.WriteLine(ret.TrimEnd());
    }
}


Measured memory_bytes: 9324
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    ll N; cin >> N;
    ll m = sqrt(8*N + 1);
    if(m*m != 8*N + 1){
        prt("No");
    }else{
        if(m%2 == 0){prt("No");}
        else{
            prtl("Yes");
            prtl((m+1)/2);
            ll k = (m+1)/2;
            vvll S(k, vll(0));
            vector<P> v(0);
            rep(i, 0, k){
                rep(j, i+1, k){
                    v.emplace_back(P(i, j));
                }
            }
            rep(i, 1, N+1){
                P a = v[i-1];
                ll s = a.first, t = a.second;
                S[s].emplace_back(i);
                S[t].emplace_back(i);
            }
            rep(i, 0, k){
                prt(2*N/k); prt(" ");
                for(auto x: S[i]){
                    prt(x); prt(" ");
                }
                prt(endl);
            }
        }
    }
}

Measured memory_bytes: 4724
X,Y,A,B,C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p = p[0:X]
q = q[0:Y]

p.extend(q)
p.extend(r)

p.sort(reverse=True)
s=0
for i in range(X+Y):
    s+=p[i]
print(s)

Measured memory_bytes: 22560
h,w = map(int, input().split())

s=[]

for i in range(h):
    s.append(input())


def check(i, j):
    if i != 0 and s[i-1][j] == '#':
        return True
    if j != 0 and s[i][j -1] == '#':
        return True
    if i != h - 1 and s[i+1][j] == '#':
        return True
    if j != w -1 and s[i][j+1] == '#':
        return True
    return False

ret = True
for i in range(h):
    for j in range(w):
        if s[i][j] == '#' and not check(i, j):
            ret = False
print('Yes' if ret else 'No')

Measured memory_bytes: 3064
#include <stdio.h>

using namespace std;

int main(){
	int n,taro_point = 0,hanako_point = 0,j;
	char taro_card[101],hanako_card[101];
	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		scanf("%s %s",taro_card,hanako_card);
		for(j = 0; taro_card[j] != '\0' && hanako_card[j] != '\0' && taro_card[j] == hanako_card[j];j++);
		if(taro_card[j] == '\0'){
			if(hanako_card[j] == '\0'){
				taro_point += 1;
				hanako_point += 1;
			}else{
				hanako_point += 3;
			}
		}else if(hanako_card[j] == '\0'){
			taro_point += 3;
		}else if(hanako_card[j] > taro_card[j]){
			hanako_point += 3;
		}else{
			taro_point += 3;
		}
	}
	printf("%d %d\n",taro_point,hanako_point);
}


Measured memory_bytes: 2712
/*input
4 10
1 2
2 1
1 2
2 1
1 2
1 3
1 4
2 3
2 4
3 4
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
//#define int long long
int n,m;
const int N = 200005;
int par[N], rnk[N];
int get(int x){
	if(x==par[x]) return x;
	else return par[x] = get(par[x]);
}
void union_set(int c, int d){
	c=get(c);
	d=get(d);
	if(c!=d){
		if(rnk[c]>rnk[d])swap(c, d);
		par[c]=d;
		rnk[d] += rnk[c];
	}
}
signed main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin>>n>>m;
	for(int i=1; i<=n; ++i) par[i]=i, rnk[i]=1;
	for(int i=0; i<m; ++i){
		int c,d;
		cin>>c>>d;
		union_set(c,d);
	}
	int ans=0;
	for(int i=1; i<=n; ++i){
		if(i==par[i]){
			ans = max(ans, rnk[i]);
		}
	}
	cout<<ans;
	return 0;	
}

Measured memory_bytes: 5216
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

int main()
{
	int ans = 0;
	int N;

	cin >> N;

	vector<int> A(N);
	vector<int> bucket(N + 1, 0);

	for (int i = 0; i < N; i++)
	{
		cin >> A[i];

		if (A[i] > N)
		{
			ans++;
		}
		else
		{
			bucket[A[i]]++;
		}
	}

	for (int i = 0; i <= N; i++)
	{
		if (bucket[i] < i)
		{
			ans += bucket[i];
		}
		else
		{
			ans += bucket[i] - i;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
<?php
$N = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
//list($N,$D) = array_map('intval',explode(" ",trim(fgets(STDIN))));
$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

for($i=0;$i<$N;$i++) {
  for($j=$i;$j<$N;$j++) {
    if ($A[$i]==$A[$j]) continue;
    for($k=$j;$k<$N;$k++) {
      if ($A[$j]==$A[$k]) continue;
      if ($A[$i]!=$A[$j] && $A[$j]!=$A[$k] && $A[$k]!=$A[$i]) {
        //printf("%d %d %d(%d %d %d)\n",$A[$i],$A[$j],$A[$k],$i+1,$j+1,$k+1);
        if ($A[$i]+$A[$j]>$A[$k] && $A[$j]+$A[$k]>$A[$i] && $A[$k]+$A[$i]>$A[$j]) {
        $ans++;
        }
      }
    }
  }
}
printf("%d\n",$ans);


Measured memory_bytes: 16240
#include <stdio.h>
#include <string.h>

int main(void)
{
	int z,o,l,i;
	char s[100000];

	z=0;
	o=0;

	scanf("%s",s);

	l=strlen(s);

	for(i=0; i<l; i++)
	{
		if(s[i]=='0') z=z+1;
		else o=o+1;
	}

	if(z==0||o==0) printf("0\n");
	else if(z<o) printf("%d\n",z*2);
	else  printf("%d\n",o*2);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using P = pair<ll, ll>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }


int main() {
    int a; cin >> a;
    int sum = a + pow(a, 2) + pow(a, 3);
    cout << sum << endl;
}

Measured memory_bytes: 4092
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long x;cin >> x;
    int nn=1;
    long long n = 100;
    while(1){
        n = n *1.01;
        if(n>=x){
            cout << nn <<endl;
            return 0;
        }
        nn++;
    }
}

Measured memory_bytes: 3620
import numpy as np
N=int(input())
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
A=np.zeros(11,dtype=int)
for i in range(11):
  A[i]=(26**(i+1))
B=np.cumsum(A)
for i in range(11):
  if N<=B[i]:
    name=[" "]*(i+1)
    if i==0:
      N=N-1
    else:
      N-=B[i-1]+1
    for j in reversed(range(i+1)):
      if j>=1:
        name[i-j]=a[N//A[j-1]]
        N-=N//A[j-1]*A[j-1]
      else:
        name[i-j]=a[N]
    break

print(''.join(name))

Measured memory_bytes: 26892
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INF 10000000000
#define mod 1000000007
typedef long long int ll;
ll u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
ll d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll gcd(ll a,ll b){
  if(!b)return a;
  return gcd(b,a%b);
}
int kt(ll a){
  int sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
int ks(ll a){
  int sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
int main(void){
  int n,k;
  scanf("%d %d",&n,&k);
  int a[n];
  FOR(n)scanf("%d",&a[i]);
  qsort(a,n,sizeof(int),d);
  FOR(n){
    if(a[i]<k){
      PRN(i);
      return 0;
    }
  }
  PRN(n);
  return 0;
}


Measured memory_bytes: 892
N = int(input())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
a, c, cnt = 0, 0, 0
for b in B:
  while a < N and A[a] < b:
    a += 1
  while c < N and C[c] <= b:
    c += 1
  cnt += a * (N-c)
print(cnt)

Measured memory_bytes: 24096
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/05/20.
//  Copyright © 2019 yuya. All rights reserved.
//

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


int rec(string s, ll N);


int main(){
    int i;
    ll N;
    cin >> N;
    
    
    cout << rec("3",N) + rec("5",N) + rec("7",N) << endl;
    
    return 0;
}

int rec(string s,ll N)
{
    int i;
    int count=0;
    int a=0,b=0,c=0;
    
    
    if(log10(N) < s.length()-1) return 0;
    
    ll v = stoi(s);
    
    if(v > N) return 0;
    
    
    for(i=0;i<s.length();i++){
        if(s[i]=='3') a=1;
        if(s[i]=='5') b=1;
        if(s[i]=='7') c=1;
    }
    if(a&&b&&c) count++;
    
    
    count += rec(s+"3",N) + rec(s+"5",N) + rec(s+"7",N);
    return count;
}


Measured memory_bytes: 896