akhauriyash/Code-Regression huggingface dataset:
n , m = map(int,input().split())
x = []
for i in range(m):
    y = list(map(int,input().split()))
    x.append(y)
p = list(map(int,input().split()))
ans = 0

for i in range(2**n):
    u = 1
    e = str(format(i,'010b'))
    for j in range(m):
        if u == 0:
            break
        kar = 0
        for k in range(x[j][0]):
            if e[10-x[j][k+1]] == "1":
                kar += 1
        if kar % 2 != p[j]:
            u = 0
            break
    if u == 1:
        ans += 1
        
print(ans)

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

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

    int a[30] = {0};
    for (int i = 0; i < s.size(); i++) {
        a[ s[i] - 'a' ]++;
    }

    for (int i = 0; i < 26; i++) {
        if (a[i] >= 2) {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;

}

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

using namespace std;

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  int x;
  std::cin >> x;
  if (x == 3 || x == 5 || x == 7) {
    std::cout << "YES";
  } else {
    std::cout << "NO";
  }
  return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

	int n;
	cin>>n;

	double a,b,c;
	a=n/3.0;
	b=n/3.0;
	c=n-a-b;

	double ans=a*b*c;

	cout<<setprecision(32)<<ans<<endl;

	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    vector<int> alpha(30);
    char ch;
    bool isNo = false;

    cin >> s;

    int i, len = s.size();

    for (i = 0; i < len; i++) {
        ch = s[i];

        alpha[ch - 'a']++;

        if (1 < alpha[ch - 'a']) {
            isNo = true;

            break;
        }
    }

    if (isNo) cout << "no" << endl;
    else cout << "yes" << endl;

    return 0;
}


Measured memory_bytes: 256
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#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 int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  int n;
  cin >> n;
  int div[n+10]={0};
  for(int i=1;i<=n;i++){
    for(int j=i;j<=n;j+=i){
      div[j]++;
    }
  }
  // div[1]--;
  // cerr << div[2] << endl;
  int ans = 0;
  for(int i=1;i<n;i++){
    ans+=div[n-i];
  }
  cout << ans << endl;


return 0;
}
///....


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

#define ull unsigned long long

const int Maxv = 1000010; 
const ull Prime1 = 259; 
const ull Prime2 = 213668850274628011; 
                            
int idx[Maxv], n; 
long long ans; 
ull Hash[Maxv], val[Maxv]; 
char s[Maxv]; 

std::map<ull, int> Map; 

inline void PreHandle() {
    val[n] = 1; 
    for (int i = n + 1; i <= (n << 1); i++)
        val[i] = val[i - 1] * Prime1; 
    for (int i = n - 1; i >= 0; i--)
        val[i] = val[i + 1] * Prime2; 
}

int main() {
    scanf("%d", &n); 
    scanf("%s", s); 

    PreHandle(); 

    for (int i = 0; i < n; i++) {
        Hash[i + 1] = Hash[i]; 
        idx[i + 1] = idx[i]; 

        if (s[i] == '>')
            idx[i + 1]++; 
        if (s[i] == '<')
            idx[i + 1]--;
        if (s[i] == '+')
            Hash[i + 1] += val[n + idx[i + 1]]; 
        if (s[i] == '-')
            Hash[i + 1] -= val[n + idx[i + 1]]; 
    }
    
    for (int i = n; i >= 0; i--) {
        ull tmp = Hash[i] + Hash[n] * val[n + idx[i]];
        ans += Map[tmp]; 
        Map[ Hash[i] ]++;
    }

    printf("%lld\n", ans);

    return 0; 
}

Measured memory_bytes: 43008
import java.util.*;
import java.io.*; 

public class Main {
	
	public static void main(String... string) {
		Scanner sc = new Scanner(System.in); 
		String s = sc.nextLine(); 
		if(s.equals("BBB") || s.equals("AAA"))
			System.out.println("No"); 
		else System.out.println("Yes"); 
	}
}

Measured memory_bytes: 21844
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()
A=[[] for _ in range(K)]
for i in range(N):
    A[i%K].append(T[i])

count=0
for i in range(K):
  cnt=0
  for j in range(len(A[i])):
    if j==0:
      if A[i][j]=='p':
        count+=S
      if A[i][j]=='s':
        count+=R
      if A[i][j]=='r':
        count+=P
    else:
      if A[i][j]==A[i][j-1]:
        cnt+=1
      if A[i][j]!=A[i][j-1]:
        cnt=0
      if cnt%2==0 and A[i][j]=='p':
          count+=S
      if cnt%2==0 and A[i][j]=='r': 
          count+=P
      if cnt%2==0 and A[i][j]=='s':
          count+=R
print(count)    

Measured memory_bytes: 13436
n, m = map(int, input().split())
ps = {}
for _ in range(m):
    _p, _s = map(str, input().split())
    _p = int(_p)
    ps.setdefault(_p, [])
    ps[_p].append(_s)

ac = 0
wa = 0
for v in ps.values():
    for i, _v in enumerate(v):
        if _v == "AC":
            ac += 1
            wa += i
            break

print(ac, wa)


Measured memory_bytes: 29492
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#define ll long long int
using namespace std;

int main() {
	int N, flag = 0, change=0;
	int num_white = 0;

	cin >> N;
	vector<char> c(N), cans(N);
	
	for (int i = 0; i < N; i++){
		cin >> c[i];
	}
	for (int i = 0; i < N; i++){
		if (c[i] == 'W'){
			num_white++;
		}
		if (i > 0){
			if ((c[i] == 'R') && (c[i - 1] == 'W')){
				flag = 1;
			}
		}
	}
	for (int i = 0; i < N; i++){
		if (i < (N-num_white)){
			if (c[i] == 'W'){
				change++;
			}
		}
	}

	if (flag == 0){
		cout << 0 << endl;
	}
	else{
		cout << change << endl;
	}
	
	return 0;
}

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};



int main(){

  int n,m;
  cin >> n >> m;
  int res = 0;
  if(n != 0)res += n*(n-1)/2;
  if(m != 0)res += m*(m-1)/2;
  cout << res << endl;


  return 0;
}


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

int main( void )
{
    char a[ 11 ];
    char b[ 11 ];
    char c[ 11 ];
    cin >> a >> b >> c;

    if ( a[ strlen( a ) - 1 ] == b[ 0 ] && b[ strlen( b ) - 1 ] == c[ 0 ] )
    {
        cout << "YES";
    }
    else
    {
        cout << "NO";
    }

    return 0;
}


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

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;


bool isPrime(int x){
    for(int i = 2; i * i <= x; i++){
        if(x % i == 0){
            return false;
        }
    }
    return true;
}

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

    reps(i,x,200000){
        if(isPrime(i)){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
 
using namespace std;
 
int main(){
    int K,A,B;
    cin>>K>>A>>B;
    for(int i=A;i<=B;i++){
        if(i%K==0){
            printf("OK\n");
            break;
        }else if(i==B)printf("NG\n");
    }
}

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

int main() {
    int N;
    cin >> N;
    vector<int> a(N), b(N);

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

    for (int i = 0; i < N - 2; i++)
    {
        if (a[i] == b[i] && a[i + 1] == b[i + 1] && a[i + 2] == b[i + 2])
        {
            cout << "Yes" << endl;
            return 0;
        }
        
    }
    
    cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;
 
#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()
 
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  ll sum[n + 1];
  sum[0] = 0;
  for (int i = 0; i < n; ++i) {
    sum[i + 1] = sum[i] + a[i];
  }
  map<ll, ll> mp;
  ll ans = 0;
  for (int i = 0; i <= n; ++i) {
    if (0 <= i - k) {
      mp[(sum[i - k] - (i - k)) % k]--;
    }
    ans += mp[(sum[i] - i) % k];
    mp[(sum[i] - i) % k]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 15104
#include <iostream>

int main() {
	long long K; std::cin >> K;
	if (K % 2 == 0 || K % 5 == 0) {
		std::cout << -1 << std::endl;
		return 0;
	}
	long long digit = 1;
	long long N = 7 % K;
	while (N != 0) {
		N = (N * 10 + 7) % K;
		++digit;
	}
	std::cout << digit << std::endl;
}


Measured memory_bytes: 3616
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = Integer.parseInt(scanner.next());
		int AC = 0,WA = 0,TLE = 0,RE = 0;
		for(int i=0;i<N;i++) {
			switch(scanner.next()) {
			case "AC":
				AC++;
				break;
			case "WA":
				WA++;
				break;
			case "TLE":
				TLE++;
				break;
			case "RE":
				RE++;
				break;
			}
		}
		System.out.printf("AC x %d\n",AC);
		System.out.printf("WA x %d\n",WA);
		System.out.printf("TLE x %d\n",TLE);
		System.out.printf("RE x %d\n",RE);
		scanner.close();
	}
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
const int inf=1010001000;
const ll  INF=1001000100010001000;
const int mod=(int)1e9+7;

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

vector<long long> fact, fact_inv, inv;   //fact[i]=i!                       nが10^7より大きいと配列が大きすぎる？
void init_nCk(int SIZE) {                //inv[i]=i^(-1)           
    fact.resize(SIZE + 5);               //fact_inv[i]=inv[i]の累積積
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact[0] = fact[1] = 1;                          
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}
 
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int n, int k) {
    assert(!(n < k));
    assert(!(n < 0 || k < 0));
    if(n<=10000000)return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
    else {
        ll ans=1;
    for(ll i=n; i>n-k; i--){
        ans=ans*i%mod;
    }
    for(ll i=1; i<=k; i++){
        ans=(ans*modpow(i,mod-2))%mod;
    }
    return ans;
    }
}

int main(){
    int  n,a,b;
    cin>>n>>a>>b;
    init_nCk(10000000);
    cout<<(2*mod+modpow(2,n)-1-nCk(n,a)-nCk(n,b))%mod<<endl;
return 0;
}

Measured memory_bytes: 234624
import java.util.Calendar;
import java.util.Scanner;


public class Main {


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

		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.YEAR, 2004);

		while (sc.hasNext()) {
			int m = sc.nextInt(), d = sc.nextInt();
			if (m == 0 && d == 0) break;
			cal.set(Calendar.MONTH, m-1);
			cal.set(Calendar.DAY_OF_MONTH, d);
			int w = cal.get(Calendar.DAY_OF_WEEK);
			switch (w) {
			case Calendar.SUNDAY: System.out.println("Sunday"); break;
			case Calendar.MONDAY: System.out.println("Monday"); break;
			case Calendar.TUESDAY: System.out.println("Tuesday"); break;
			case Calendar.WEDNESDAY: System.out.println("Wednesday"); break;
			case Calendar.THURSDAY: System.out.println("Thursday"); break;
			case Calendar.FRIDAY: System.out.println("Friday"); break;
			case Calendar.SATURDAY: System.out.println("Saturday"); break;
			}
		}
	}
}

Measured memory_bytes: 17280
import java.io.*;
import java.util.*;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] s = sc.next().toCharArray();
		int n = s.length;

		int from = 0;
		int to = n - 1;
		for (int i = 0; i < n; i++) {
			if (s[i] == 'A') {
				from = i;
				break;
			}
		}
		for (int i = n - 1; i >= 0; i--) {
			if (s[i] == 'Z') {
				to = i;
				break;
			}
		}

		pr.println(to - from + 1);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 14800
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#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)
#ifdef ONLINE_JUDGE
  #define debug(x)
  #define debug2(x,y)
  #define debug3(x,y,z)
  #define assert(e) if(!(e)){stod("");}
#else
  #define debug(x) std::cerr<<#x<<": "<<x<<"\n"
  #define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
  #define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"
#endif

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void solve() {
  int x, y;
  scan(x, y);
  rep (i, x+1) {
    int legs = i * 2 + (x - i) * 4;
    if (legs == y) {
      print("Yes");
      return;
    }
  }
  print("No");
  return;
}

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


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

int main()
{
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for (int i = l; i <= r; i++)
    {
        if (i % d == 0)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define reps(i, s, n) for(int i = (s); i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, s, n) for(int i = (n) - 1; i >= (s); i--)
#define INF ~(1 << 31)
#define INFL ~(1LL << 63)

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n){
        cin >> h[i];
    }
    vector<int> ans(n);
    ans[0] = 0;
    ans[1] = abs(h[1] - h[0]);
    reps(i, 2, n){
        ans[i] = min(ans[i-1] + abs(h[i] - h[i-1]), ans[i-2] + abs(h[i] - h[i-2]));
    }
    cout << ans[n-1] << endl;
}

Measured memory_bytes: 4040
def II(): return int(input())
def MI(): return map(int,input().split())
def LMI(): return list(map(int,input().split()))
def LIIN(n): return list(int(input()) for _ in range(n))
def LMIN(n): return [list(map(int, input().split())) for _ in range(n)]
def IS(): return input()
def MS(): return map(str,input().split())
def LMS(): return list(map(str,input().split()))
def LISN(n): return list(input() for _ in range(n))
def LMSN(n): return [input().split() for _ in range(n)]
MOD = 10**9+7
INF = 10**18

def main():
    x = [0] * 3
    y = [0] * 3
    a = LMIN(3)

    x[0] = 0
    for i in range(3):
        y[i] = a[0][i] - x[0]
    for i in range(3):
        x[i] = a[i][0] - y[0]

    for i in range(3):
        for j in range(3):
            if x[i]+y[j] != a[i][j]:
                print('No')
                return 0
    print('Yes')

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
var debug = false;

//for(var i =0;i<;i++)

var dx = [-1, 1, 0, 0];
var dy = [0, 0, -1, 1];

function Main(input) {
    var ls = input.split("\n");
    var n = ls[0].split(" ")[0];
    var m = ls[0].split(" ")[1];

    var ans = n * (n - 1) / 2 + m * (m - 1) / 2;
    console.log(ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
if (!debug)
    Main(require("fs").readFileSync("/dev/stdin", "utf8"));
else
    Main(require("fs").readFileSync("./input", "utf8"));

Measured memory_bytes: 21952
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		
		int ans = 0;
		for(int i = 0;i < s.length();++i)
			if(s.charAt(i) == '1')
				ans++;
		System.out.println(ans);
	}
}


Measured memory_bytes: 23252
var arg = args();
var a = parseInt(arg[0]) * 3;
var p = parseInt(arg[1]);

outl(Math.floor((a + p) / 2));

function args() {
	return  require("fs").readFileSync("/dev/stdin", "utf8").split(" ");
}
function out(msg) {
    process.stdout.write(msg);
}
function outl(msg) {
    process.stdout.write(msg + "\n");
}

Measured memory_bytes: 7372
#include <iostream>
#include <cstdlib>
#include <cstdio>
using namespace std;
inline int read()
{
	int f = 1, x = 0;
	char ch;

	do{
		ch = getchar();
		if (ch == '-')
			f = -1;
	}while(ch < '0' || ch > '9');
	do{
		x = x * 10 + ch - '0';
		ch = getchar();
	}while(ch >= '0' && ch <= '9');
	return f * x;
}

int n, k, p;
string s;

int main()
{
	n = read();
	k = read();
	cin >> s;
	if (k > n << 1)
		k = (n << 1) + ((k - (n << 1)) & 1);

	char ch = 'A';
	for (int i = 1; i <= k; i++) {
		if (s[p] == ch) {
			s[p] = 'A' + 'B' - ch;
		} else {
			ch = 'A' + 'B' - ch;
			p = (p + 1) % n;
		}
	}

	for (int i = p; i < n; i++) {
		if (s[i] == ch)
			printf("A");
		else
			printf("B");
	}
	for (int i = 0; i < p; i++) {
		if (s[i] == ch)
			printf("A");
		else
			printf("B");
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 3740
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;

int a[]={0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main(void)
{
	int k;
	scanf("%d",&k);
	printf("%d",a[k]);
	return 0;
}

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

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

    vector<int> H;
    for (int i = 0; i < N; i++) {
        int h;
        cin >> h;
        H.push_back(h);
    }

    sort(H.begin(), H.end(), greater<int>());

    ll ans = 0;
    for (int i = K; i < N; i++) {
        ans += H[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 1400
from collections import deque
K = int(input())
que = deque(list(range(1, 10)))
for i in range(K):
    x = que.popleft()
    last = x % 10
    if last != 0:
        que.append(x*10 + last-1)
    que.append(x*10 + last)
    if last != 9:
        que.append(x*10 + last+1)
print(x)


Measured memory_bytes: 11956
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<cstring>
#include<sstream>
using namespace std;

typedef long long ll;

int main() {
  int N,K; cin >> N >> K;
  string s; cin >> s;
  for ( int i = 0; i < N; i++ ) {
    if ( i + 1 == K ) s[i] = s[i]+32;
  }
  cout << s << endl;
  return 0;
}


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

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

int main() {
    vector<int> prime;
    vector<bool> is_prime(1e5, true);
    is_prime[0] = is_prime[1] = false;
    for(int i=2; i<1e5; ++i) {
        if(is_prime[i]) {
            prime.push_back(i);
            for(int j=i+i; j<100000; j+=i) {
                is_prime[j] = false;
            }
        }
    }
    int p, q;
    cin >> p >> q;
    int g = gcd(p, q);
    p /= g, q /= g;
    int ans = 1;
    for(int i=0; i<prime.size(); ++i) {
        if(q % prime[i] == 0) {
            ans *= prime[i];
            while(q % prime[i] == 0) {
                q /= prime[i];
            }
        }
    }
    if(q / ans > 1) {
        cout << q * ans << endl;
    } else {
        cout << ans << endl;
    }
}


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

using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n],s1=0,s2=0;
    for(int i=0; i<n; i++)
       cin >> a[i];
    sort(a,a+n,greater<int>());
    for(int i=0; i<n; i++){
       if(i%2==0)
         s1+=a[i];
       else 
         s2+=a[i];
    }
    cout << s1-s2 << endl;
    return 0;
}

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
 
template<typename T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<typename T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T> bool Min(T a, T b) { return a > b ? b : a; }
template<typename T> bool Max(T a, T b) { return a < b ? b : a; }
template<typename T> void de(T a){ 
#ifdef LOCAL_DEFINE
	cout<< a << endl;
#endif
}
	
const int INF = 2e5+1;

int n,m;
vi graph[INF];
vector<bool>vis(INF,false);
vi dp(INF,0);
int complexx=0;
vi edges(INF,0);

void dfs(int v,int dis){
	assert(!vis[v]);
	vis[v]=true;
 	complexx++;
	for(int i:graph[v]){       
	 	uax(dp[i],dp[v]+1);
	 	edges[i]--;
	 	if(edges[i]==0)
	 		dfs(i,dis+1);      
	}

}

int main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    	cout.precision(10);
    	cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif
                
	cin>>n>>m;
	int a,b;
	forn(i,m){
	 	cin>>a>>b;
	 	graph[a-1].pb(b-1);
	 	edges[b-1]++;
	}
        // imagine a fake vertex which is connected to every other vertex 
        forn(i,n){
        	graph[n].pb(i);
        	edges[i]++;
        }
#ifdef LOCAL_DEFINE
        forn(i,n+1){
         	for(auto j:graph[i]) cout<<j<<" ";
         	cout<<endl;
        }
#endif
        dfs(n,1);
        de(complexx);
        cout<<(*max_element(dp.begin(),dp.begin()+n+2))-1<<endl;
               
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
#endif

	return 0;
}	



Measured memory_bytes: 11640
#include <iostream>
#include <vector>
#include <string>

int main(){
  std::string S;
  std::cin >> S;
  long int N = S.size();
  int count = 0;
  for(int i=0; i < N; ++i){
    if(S[i] == '1') count++;
  }
  std::cout << count << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
ll m=1e9+7,c[26]={0},ans=1;

string s;
cin>>s;
rep(i,0,n-1)
c[s[i]-'a']++;

rep(i,0,25)
{
	ans=(ans*1ll*(c[i]+1))%m;
}
ans--;
ans=(ans+m)%m;
ol(ans);

return 0;
}



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

using i64 = int64_t;

constexpr i64 MOD = 1e9 + 7;

int main(){
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    vector<vector<i64>> dp(n, vector<i64>(26, 0));
    dp[0][s[0]-'a'] = 1;
    for(int i=1;i<n;++i){
        for(char c='a';c<='z';++c){
            dp[i][c-'a'] = dp[i-1][c-'a'];
        }
        if(i == n-1)break;
        dp[i][s[i]-'a'] += dp[i-1][t[i]-'a'];
        dp[i][s[i]-'a'] %= MOD;

        /*for(int i=0;i<n;++i){
            for(int j=0;j<26;++j){
                cerr << dp[i][j] << " ";
            }
            cerr << endl;
        }
        cerr << endl;
        */
    }

    cout << dp[n-1][t[n-1]-'a'] << endl;

    return 0;
}


Measured memory_bytes: 27416
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

//動的計画法で役に立つ関数
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_base::sync_with_stdio(0);
    cin.tie(0);
    
    int N, K; cin>>N>>K;

    cout << N-K+1<<endl;
  
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String C = sc.next();
		
		String alphabet = "abcdefghijklmnopqrstuvwxyz";
		int a = alphabet.indexOf(C);
		
		System.out.println(alphabet.substring(a+1,a+2));

	}

}

Measured memory_bytes: 22612
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		String s = sc.next();
		if(s.length()<=k) {
			System.out.println(s);
		}
		else {
			s=s.substring(0, k);
			s+="...";
			System.out.println(s);
		}
	 }
}

Measured memory_bytes: 38620
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,ans = 0,cnt=1;
  cin >> n;
  string tmp;
  string list[n];
  for(int i=0;i<n;i++){
    cin >> tmp;
    sort(tmp.begin(),tmp.end());
    list[i]=tmp;
  }
  sort(list,list+n);
  for(int i=1;i<n;i++){
    if(list[i]!=list[i-1]){
      ans += (cnt*(cnt-1))/2;
      cnt = 1;
    }else{
      cnt ++;
    }
  }
  ans += (cnt*(cnt-1))/2;
  cout << ans << endl;
}


Measured memory_bytes: 5760
N = int(input())
A = [int(i) for i in input().split(" ") ]
odd = [2 if i%2==0 else 1 for i in A]

# 条件1|x_i-y_i|<=1を満たすパターン数を出す
PI1 = 3**N
# 条件2の対偶(総積が奇数ならカウントしない)のパターンを条件1のパターンから引く
PI2 = 1
for i in odd:
    PI2*=i
    
print(PI1-PI2)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int a,b,c; cin>>a>>b>>c;
	set<ll> s;
	for(ll i=a;i<1e17;i+=a){
		if(i%b==c){
			cout<<"YES";
			return 0;
		}
		if(s.count(i%b)){
			cout<<"NO";
			return 0;
		}
		s.insert(i%b);
	}
	
	return 0;
}

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver2 {
 public:
  int h, w, k;
  vector<vector<int>> a, sum, memo, ans;
  Solver2(LL h, LL w) : h(h), w(w), a(h + 1, vector<int>(w + 1)), ans(h, vector<int>(w)){};

  void solve() {
    cin >> k;
    for (int i = 0; i < h; ++i) {
      string s;
      cin >> s;
      for (int j = 0; j < w; ++j) {
        if (s[j] == '#') {
          a[i + 1][j + 1] = 1;
        }
      }
    }
    sum = a;
    for (int i = 0; i < h + 1; ++i) {
      for (int j = 1; j < w + 1; ++j) {
        sum[i][j] += sum[i][j - 1];
      }
    }
    for (int i = 1; i < h + 1; ++i) {
      for (int j = 0; j < w + 1; ++j) {
        sum[i][j] += sum[i - 1][j];
      }
    }
    DBG(a)
    DBG(sum)
    calc(0, 0, h, w, k);
    writeans();
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        cout << ans[i][j] << ' ';
      }
      cout << endl;
    }
  }
  int count(int a, int b, int c, int d) {
    return sum[c][d] - sum[c][b] - sum[a][d] + sum[a][b];
  }
  void calc(int x, int y, int X, int Y, int cnt) {
    DBG(x, y, X, Y, cnt)
    if (cnt == 1) {
      memo.push_back({x, y, X, Y});
      return;
    }
    int lb = x;
    int ub = X;
    while (ub - lb > 1) {
      int mid = (lb + ub) / 2;
      if (count(x, y, mid, Y) > 0)
        ub = mid;
      else
        lb = mid;
    }
    DBG(ub)
    if (count(x, y, ub, Y) < cnt) {
      int tmp = count(x, y, ub, Y);
      calc(x, y, ub, Y, tmp);
      calc(ub, y, X, Y, cnt - tmp);
    } else {
      lb = y;
      ub = Y;
      while (ub - lb > 1) {
        int mid = (lb + ub) / 2;
        if (count(x, y, X, mid) > 0)
          ub = mid;
        else
          lb = mid;
      }
      int tmp = count(x, y, X, ub);
      calc(x, y, X, ub, tmp);
      calc(x, ub, X, Y, cnt - tmp);
    }
  }

  void writeans() {
    DBG(memo.size())
    for (int i = 0; i < memo.size(); ++i) {
      DBG(i, memo[i])
      for (int j = memo[i][0]; j < memo[i][2]; ++j) {
        for (int k = memo[i][1]; k < memo[i][3]; ++k) {
          DBG(j, k)
          ans[j][k] = i + 1;
        }
      }
    }
  }
};
}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  long long n = 0, m;
  std::cin >> n >> m;

  Problem::Solver2 sol(n, m);
  sol.solve();
  return 0;
}


Measured memory_bytes: 7476
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
float PHI = 1.6180339;
const float  PI_F=3.14159265358979f;
#define MAX 1000 m
#define endl "\n"    
#define manhunt 32 
//typedef long long float;
#define int long long
typedef pair<int, int> pii;
//#define float unsigned long long
typedef pair<int, int> pii;
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define CHAR_SIZE 26 
#define pi pair<int,int> 

int modpow(int x, int n, int m) { if (n == 0) return 1%m; long long u = modpow(x,n/2,m); u = (u*u)%m; if (n%2 == 1) u = (u*x)%m; return u; } 


int add(int x, int y) 
{
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
int sub(int x, int y) 
{
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
int inv(int a, int m = MOD)
{
	return modpow(a, m - 2, m);
}
int mul(int a, int b) 
{
	return (long long) a * b % MOD2;
}


int nCrModp(int n, int r, int p) 
{ 
    int C[r+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1; 
    for (int i = 1; i <= n; i++) 
    { 
        for (int j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
} 

int isPalindrome(string a)
{
    string rev=a;
    reverse(a.begin(),a.end());
    if(a==rev)
    return 1;
    else
    return 0;
}


int32_t main()
{
    FAST
    cout << fixed << setprecision(12);
 
    double solve = 0; 
    double s;
    cin>>s;

    double length = s / 3; 
  
    s -= length; 
  
    double breadth = s / 2; 
  
    double height = s - breadth; 
  
    double val =  length * breadth * height;
    cout<<val<<endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;
int main()
{
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5])
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();

		char[] ch = s.toCharArray();
		int ans = 0;
		for (int i = 1; i < s.length(); i++) {
			if (ch[i - 1] != ch[i]) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 25744
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <stdio.h>
#include <string>
#include <ctype.h>

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 1000000000;

using namespace std;
int main() {
	int h, w; cin >> h >> w;

	vector<string>a(h);
	rep(i, h)cin >> a[i];

	vector<bool> row(h, false);
	vector<bool> col(w, false);

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}
	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0;j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
}


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

int main() {
  vector<int> vec(3);
  cin >> vec.at(0) >> vec.at(1) >> vec.at(2);
  
  sort(vec.begin(),vec.end());
  cout << vec.at(0)+vec.at(1) << endl;
  
  
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//def   puts(a) printf("%s\n", a) 文字はこっち
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
//your code here!


int main(void){
    char A[55][55], B[55][55];
    ll N, M;
    in2(N,M);
    rep(i,N) ins(A[i]);
    rep(i,M) ins(B[i]);
    ll i,j,issame;
    for(i=0; i<=N-M; i++){
        for(j=0; j<=N-M; j++){//始点を定める
            issame = 1;
            rep(k,M){
                rep(l,M){
                    if(B[k][l]!=A[i+k][j+l]){
                        issame = 0;
                        break;
                    }
                }
            }
            if(issame){
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
ll sieve[1000001]={0},i,j;
ll power(ll p, ll k)
{
ll a=1;
while(k)
{
if(k&1)
a=(a*p);
p=(p*p);
k>>=1;
}
return a;
}
using namespace std;
  ll countDivisors(ll n) 
{ 
    ll cnt = 0; 
    for (ll i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            if (n / i == i) 
                cnt++; 
  
            else 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
} 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int tc=1;
//cin>>tc;
ll cas=1;
 while(tc--)
 {
	ll n;
	cin>>n;
	ll x=n%10;
	n/=10;
	ll y=n%10;
	n/=10;
	if(x==7 || y==7 || n==7)
	cout<<"Yes";
	else
	cout<<"No";
cout<<"\n"; 
 } 
}


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

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define ll long long
#define pii pair<int, int>
#define is insert
#define er erase

using namespace std;

int solve();

#define TASK ""

int main()
{
    #ifdef DEBUG
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
        //freopen(TASK".in", "r", stdin);
        //freopen(TASK".out", "w", stdout);
    #endif // DEBUG
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

ll n;
ll k;

int solve()
{
    cin >> n >> k;
    ll c;
    if (n % 2 == 0)
    {
        c = n / 2;
    }
    else
    {
        c = n / 2 + 1;
    }
    if (c >= k)
    {
        cout << "YES\n";
    }
    else
    {
        cout << "NO\n";
    }
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    string s,t;
    cin>>s>>t;
    t=t.substr(0,t.size()-1);
    if(s==t) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  string S;
  cin >> S;
  if (S == "ABC")
  {
    cout << "ARC" << endl;
  }
  else
  {
    cout << "ABC" << endl;
  }
  return 0;
}

Measured memory_bytes: 3624
unittest
{
	assert( [ "2", "ip cc" ].parse.expand.solve == "icpc" );
	assert( [ "8", "hmhmnknk uuuuuuuu" ].parse.expand.solve == "humuhumunukunuku" );
	assert( [ "5", "aaaaa aaaaa" ].parse.expand.solve == "aaaaaaaaaa" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto st = input.front.split.to!( dchar[][] );
	return tuple( st[ 0 ], st[ 1 ] );
}

auto solve( dchar[] s, dchar[] t )
{
	auto ans = new dchar[ s.length + t.length ];
	foreach( i, sc, tc; lockstep( s, t ) )
	{
		ans[ i * 2     ] = sc;
		ans[ i * 2 + 1 ] = tc;
	}
	return ans;
}


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

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

using namespace std;

int main(){
  while(int n = getInt() / 4){
    int ans = 0;
    while(n --> 0) ans += getInt();
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
int n, q;
stack<int>s[1010];
int main() {
	cin >> n >> q;
	while (q--) {
		int z, t, x;
		cin >> z >> t;
		if (z == 0) {
			cin >> x;
			s[t].push(x);
		}
		if (z == 1 && !s[t].empty())cout << s[t].top() << endl;
		if (z == 2 && !s[t].empty())s[t].pop();
	}
	getchar();getchar();
	return 0;
}


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

int main(){
  string s;
  cin >> s;
  if((s.at(0) == s.at(1)) && (s.at(1) == s.at(2)))cout <<"No";
  else cout << "Yes";

}


Measured memory_bytes: 256
// 最大公約数
package main
import (
	"fmt"
	"strconv"
	"bufio"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main(){
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	x, y := nextInt(), nextInt()
	ans := gcd(x, y)
	fmt.Fprintln(out, ans)
}

func gcd(x, y int) int{
	if x<y{
		return gcd(y, x)
	}
	for y>0{
		r:=x%y
		x, y = y, r
	}
	return x
}

func next()string{
	sc.Scan()
	return sc.Text()
}

func nextInt()int{
	a, _ := strconv.Atoi(next())
	return a
}



Measured memory_bytes: 1104
#!/usr/bin/env python

from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N, D = map(int, raw_input().split())
X = []
for i in range(N):
    p = map(int, raw_input().split())
    X += [p]

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        S = sum((X[i][k] - X[j][k]) * (X[i][k] - X[j][k]) for k in range(D))
        for q in range(1000):
            if q * q >= S:
                ans += (q * q == S)
                break
print ans

Measured memory_bytes: 2812
import sys
from functools import lru_cache
from collections import defaultdict


g = None


@lru_cache(100000)
def f(x):
    ret = 0
    for y in g[x]:
        ret = max(ret, f(y) + 1)
    return ret


def resolve(in_):
    global g
    n, m = map(int, next(in_).split())
    _g = defaultdict(list)
    for line in in_:
        x, y = map(int, line.split())
        _g[x - 1].append(y - 1)
    g = _g
    f.cache_clear()
    return max(f(i) for i in range(n))


def main():
    sys.setrecursionlimit(1000000)
    ans = resolve(sys.stdin.buffer)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 95584
from collections import Counter
N=int(input())
A=[int(input()) for _ in range(N)]
l=[]
c=Counter(A)
values=list(c.values())
key=list(c.keys())
cnt=0
for i in range(len(key)):
    l.append([key[i],values[i]])

for i in range(len(key)):
    if l[i][1]%2==1:
        cnt=cnt+1
print(cnt)

Measured memory_bytes: 74196
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>
#include <iomanip>
#include<queue>
#include<set>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF 1844674407370955161
typedef long long int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007


vector<vector<int> > e;
vector<ll> p;
vector<ll> ans;
int N;

void dfs(ll d,int parent,int now){
    ans[now] = d + p[now];
    REP(i,0,e[now].size()){
        if(e[now][i]!=parent){
            dfs(ans[now], now, e[now][i]);
        }
    }
}

int main()
{
    ll N,M;
    cin>>N>>M;
    ll A[N];
    priority_queue<ll> p;
    REP(i,0,N){
        cin>>A[i];
        p.push(A[i]);
    }
    REP(i,0,M){
        ll t=p.top();
        //cout<<t<<endl;
        t/=2;
        p.pop();
        p.push(t);
    }
    ll ans=0;
    REP(i,0,N){
        ll t=p.top();
        p.pop();
        ans+=t;
    }
    cout<<ans<<endl;



    return 0;
}

Measured memory_bytes: 1912