akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define print(A,n) for(ll i=0;i<n;++i)cout<<A[i]<<' ';cout<<endl;
#define take(A,n) for(ll i=0;i<n;++i)cin>>A[i];
//    for(auto& it : m)
void fastio(){ios_base::sync_with_stdio(false);cin.tie(NULL);}
//  priority_queue<ll int> pq;
//  priority_queue <ll int, vector<ll int>, greater<ll int> > pq;
//  vector<ll int> v;
//  vector< pair<ll int,ll int> > v;
//  set<ll int>::iterator it=s.begin();
//  unordered_map<  pair<ll int,ll int>, ll int> mp;

bool checkStackPermutation(int ip[], int op[], int n) 
{ 
    // Input queue 
    queue<int> input; 
    for (int i=0;i<n;i++) 
        input.push(ip[i]); 
  
    // output queue 
    queue<int> output; 
    for (int i=0;i<n;i++) 
        output.push(op[i]); 
  
    // stack to be used for permutation 
    stack <int> tempStack; 
    while (!input.empty()) 
    { 
        int ele = input.front(); 
        input.pop(); 
        if (ele == output.front()) 
        { 
            output.pop(); 
            while (!tempStack.empty()) 
            { 
                if (tempStack.top() == output.front()) 
                { 
                    tempStack.pop(); 
                    output.pop(); 
                } 
                else
                    break; 
            } 
        } 
        else
            tempStack.push(ele); 
    } 
  
    // If after processing, both input queue and 
    // stack are empty then the input queue is 
    // permutable otherwise not. 
    return (input.empty()&&tempStack.empty()); 
} 

int main()
{
  fastio();

 
 int T;
T=1;
//cin>>T;
while(T--)
{
ll int n;
cin>>n;
set<string> s;
string s1;
while(n--)
{
  cin>>s1;
  s.insert(s1);
}
ll int ans = s.size();
cout<<ans<<endl;
}

    return 0;
}

Measured memory_bytes: 19248
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let n = scan!(i64);
    for i in 1.. {
        if i * i <= n && n < (i + 1) * (i + 1) {
            println!("{}", i * i);
            break;
        }
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
typedef pair<ll,ll> ipair;
#define F first
#define S second
 
/*
//functions from gfg
 
long long int power(long long int x,long long int y,long long  int p)
{
    long long int res = 1;     // Initialize result
 
    x = x % p;  // Update x if it is more than or 
                // equal to p
 
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            {//d=(long double)x/p;
            res = (res*x) % p;
            }
 
        // y must be even now
        y = y>>1; // y = y/2
        x=(x*x)%p;
        
    }
    return res%p;
}
 
long long int gcd(long long int a,long long int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
 
long long int binomialCoeff(long long int n, ll k) 
{ 
    ll res = 1; 
  
    // Since C(n, k) = C(n, n-k) 
    if (k > n - k) 
        k = n - k; 
  
    // Calculate value of [n*(n-1)*---*(n-k+1)] / [k*(k-1)*---*1] 
    for (ll i = 0; i < k; ++i) 
    { 
        res *= (n - i); 
        res /= (i + 1); 
    } 
  
    return res; 
} 
 

void sieve(int n, vector<ll> &primes) 
{ 
    vector<int> prime(n,1);
    ll p;
    for ( p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == 1) 
        { 
            
            for (int i=p*p; i<=n; i += p) 
                prime[i] = 0; 
        } 
    } 
  
    for(p=2;p<=n;p++)
    {
        if(prime[p])
        primes.pb(p);
    }
   
} 


void dfs(vector<ll> adj[] ,ll src,vector<ll> &vis)
{
    vis[src]=1;
    for(ll i=0;i<adj[src].size();i++)
    {
        if(vis[adj[src][i]]==0)
        dfs(adj,adj[src][i],vis)
    }
}
 
*/

int main() {
	ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);
    
    
	ll n,i,j,p,k,m,ans=0,x,y;
    cin>>n>>x>>y;
    vector<ll> a(n,0);
    // x--;y--;
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            m=min(j-i, abs(x-i)+1+abs(y-j));
            a[m]++;
            // cout<<i<<" "<<j<<" "<<m<<endl;
        }
    }
    for(i=1;i<n;i++)
    {
        cout<<a[i]<<endl;
    }
    
    
    
    
    
    // for(i=0;i<n;i++)
    // {
    //     cout<<a[i]<<" ";
    // }
    // cout<<endl;
    
	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define  pb push_back
#define  xx first
#define  yy second
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;
int h,n;
int dp[1001];
int v[4000],cost[4000];
int ans = 1e-9;
/*
int go(int i,int sum){

        if(dp[i][sum]!=-1) return dp[i][sum];

       dp[i][sum] =min(val[i]+go(i+1,W-a[i]),go(i+1,W));
       return dp[i][sum];
}
*/
void go(int i,int x, int y ){

     ans = max(ans,x-y);
    if(i>n){
      return ;
    }
    go(i+1,v[i]+x,cost[i]+y);
    go(i+1,x,y);
    return;
}
 int main()
{
   // fast;

    int n,k;
    string s;
     cin >> n >> k >> s;
     int zero[n+10];
     memset(zero,0,sizeof zero);
     for(int i = 0; i<n; i++){
        if(s[i]=='0'){
            zero[i+1] = 1;
            while(s[i]=='0' && i<n) i++;
        }
     }
  for(int i = 1; i<=n; i++){
     zero[i] = zero[i-1]+zero[i];
  }
  int res = 0;
  for(int i = 1; i<=n; i++){

    int lo = i,hi = n;
    int r = -1;
    while(lo<=hi){
        int mid = (lo+hi)/2;
        if(zero[mid]-zero[i-1]<=k){
            r = mid;
            lo = mid+1;
        }
        else hi = mid-1;
    }

    if(r!=-1){
        res = max(res,r-i+1);
    }
    if(s[i-1]=='0'){
      while(s[i-1]=='0' && i<=n) i++;
      if(i==n) break;
     i--;
    }
  }

  cout << res << endl;

   return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#include <cmath>
#include <map>
#include <utility>

#define _USE_MATH_DEFINES
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define INF 999999999
#define atcoder 1000000007
#define MAX_N 100

using namespace std;

int main() {

	int n, num1, num2, V;
	vector< pair <int, int> > treasure(25);
	bool judge ;

	while (cin >> n, n) {
		judge = true;
		V = 0;

		REP(i, n) {
			cin >> num1 >> num2;
			treasure[i] = make_pair(num2, num1);
		}

		sort(treasure.begin(), treasure.begin() + n);

		REP(i, n) {
			V += treasure[i].second;
			if (V > treasure[i].first) {
				judge = false;
				break;
			}
		}

		if (judge == true) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}

		REP(i, n) {
			treasure[i] = make_pair(0, 0);
		}

	}

	return 0;
}

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

int main()
{
    std::string s;
    std::cin>>s;
    bool res = true;
    for(unsigned int i=0;i<=s.size();i++){
        if((i+1)&1){    //奇数
            if(s[i]=='L'){
                res = false;
                break;
            }
        }else{
            if(s[i]=='R'){
                res = false;
                break;
            }
        }
    }
    std::cout<<(res?"Yes":"No")<<std::endl;
}


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

const int MAXN = 1e5 + 5;
int h[MAXN], dp[MAXN];
int n;

void input();
void solve();

int main() {
	ios:: sync_with_stdio(0), cin.tie(0), cout.tie(0);
	input();
	solve();
	return 0;
}

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

void solve() {
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);
	for (int i = 2; i < n; i++)
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	cout << dp[n - 1];
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Boolean flag = false;
        Scanner scan = new Scanner(System.in);
        String N = scan.nextLine();
        char[] Narray = N.toCharArray();
        for(char ln :Narray){
            if(ln == '7'){
                System.out.println("Yes");
                flag = true;
                break;
            }
        }
        if(flag == false)
            System.out.println("No");
    }
}

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

int main(){
    long n, m;
    cin >> n >> m;
    
    vector<pair<long, long>> vec(n);
    for (long i = 0; i < n; i++) {
        long a, b;
        cin >> a >> b;
        vec.at(i) = make_pair(a, b);
    }
    sort(vec.begin(),vec.end());
    long sum = 0;
    for (long i = 0; i < n; i++) {
        long buf = min(vec.at(i).second,m);
        sum += buf * vec.at(i).first;
        m -= buf;
        if (m <= 0) {
            break;
        }
    }
    
    cout << sum << endl;
    
    return 0;
}


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


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


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

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

  int a[3][3], b[3][3];

  for (int i = 0; i < 3; i ++)
    for (int j = 0; j < 3; j ++)
      std::cin >> a[i][j];

  for (int i = 0; i < 3; i ++) {
    int m = *std::min_element(a[i], a[i] + 3);

    for (int j = 0; j < 3; j ++)
      b[i][j] = a[i][j] - m;
  }

  for (int j = 0; j < 3; j ++)
    if (b[0][j] != b[1][j] || b[0][j] != b[2][j]) {
      std::cout << "No" << std::endl;
      
      return 0;
    }
  
  std::cout << "Yes" << std::endl;
  
  return 0;
}


Measured memory_bytes: 888
SA = input()
SB = input()
SC = input()

a, b, c = 0, 0, 0
turnc = "a"
while a <= len(SA) and b <= len(SB) and c <= len(SC):
  if turnc == "a":
    if a == len(SA):
      print("A")
      exit(0)
    turnc = SA[a]
    a += 1
  elif turnc == "b":
    if b == len(SB):
      print("B")
      exit(0)
    turnc = SB[b]
    b += 1
  else:
    if c == len(SC):
      print("C")
      exit(0)
    turnc = SC[c]
    c += 1  

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

int main(void) {
	int N;
	vector<int> num;

	cin >> N;
	int ans = 0;
	num.clear();
	for (int i = 0; i < N; ++i) {
		int s;
		cin >> s;
		ans += s;
		if (s % 10 != 0)
			num.push_back(s);
	}
	sort(num.begin(), num.end());

	if ((ans % 10 == 0) && (num.size() != 0))
		ans -= num[0];
	if (ans % 10 == 0)
		ans = 0;
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
//i64 mod = 998244353;
int int_max = 2147483647;
i64 INF = 1e16;
int max_n = 1e5;

i64 count_same(const string& lhs, const string& rhs, size_t shift) {
    i64 ret{0}, tmp{0};
    for (size_t i=0; i<lhs.size(); ++i) {
        if (lhs[i] == rhs[i]) ++tmp;
        else {
            ret = max(ret, tmp);
            tmp = 0;
        }
        if (tmp >= shift) return shift;
    }
    ret = max(ret, tmp);
    return ret;
}

int main(int argc, char **argv) {
    i64 n;
    cin >> n;

    vector<vector<i64>> input(n, vector<i64>(n-1, 0));
    vector<vector<i64>::const_iterator> active(n);

    for (int i=0; i<n; ++i) {
        for (int j=0; j<n-1; ++j) {
            int k;
            cin >> k;
            input[i][j] = --k;
        }
        active[i] = input[i].begin();
    }
    i64 days{0};
    while (true) {
        bool end_flag{true};
        bool bad_flag{true};
        vector<bool> day_flag(n, false);
        for (int i=0; i<n; ++i) {
            if (day_flag[i]) continue;
            if (active[i] == input[i].end()) {
                continue;
            }
            end_flag = false;
            i64 cp = *(active[i]);
            if (*(active[cp]) == i && !day_flag[cp]) {
                ++(active[i]); ++(active[cp]);
                day_flag[i]=true; day_flag[cp]=true;
                bad_flag = false;
            }
        }
        if (end_flag) break;
        if (bad_flag) {
            cout << -1 << endl;
            return 0;
        }
        ++days;
    }

    cout << days << endl;

    return 0;
}

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

void solve(long long n, long long m){
    cout << (n - 1) * (m - 1) << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long n;
    scanf("%lld",&n);
    long long m;
    scanf("%lld",&m);
    solve(n, m);
    return 0;
}


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

using namespace std;

#define allof(x) (x).begin(), (x).end()

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

const int MAXN = 1e5 + 5;

int N, M;
vector<pii> adj[MAXN];

bool vis[MAXN];
int dist[MAXN];

void dfs(int pos){
    vis[pos] = true;
    for(pii p : adj[pos]){
        if(!vis[p.first]){
            dist[p.first] = dist[pos] + p.second;
            dfs(p.first);
        } else if (dist[p.first] != dist[pos] + p.second) {
            cout << "No";
            exit(0);
        }
    }
}

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

    cin >> N >> M;
    for(int a = 0; a < M; a++){
        int l, r, d;
        cin >> l >> r >> d;
        adj[l].push_back({r, d});
        adj[r].push_back({l, -d});
    }
    for(int a = 1; a <= N; a++){
        if(!vis[a]){
            dfs(a);
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
int main(){
    int H, W, h, w;
    cin>>H>>W>>h>>w;
    if(H%h==0 && W%w==0) {
        cout<<"No";
        return 0;
    }
    cout<<"Yes"<<'\n';
    int pval=(W/w)*(H/h)*2;
    int nval=-pval*(w*h-1)-1;
    for(int i=1; i<=H; i++) {
        for(int j=1; j<=W; j++) {
            if(j%w==0 && i%h==0) {
                cout<<nval;
            } else {
                cout<<pval;
            }
            if(j!=W) {
                cout<<" ";
            }
        }
        cout<<'\n';
    }
    return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100010;

// ──────────────────────────────────────────────────────────────────────────────

template<typename TypeInt>
std::string Itoa(const TypeInt v, int base)
{
	static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string ret;
	static numeric_limits<TypeInt> t;
	TypeInt n = v;
	if (t.is_signed) {
		if (v < 0) n *= -1;
	}

	while (n >= base) {
		ret += table[n % base];
		n /= base;
	}
	ret += table[n];
	if (t.is_signed) {
		if (v < 0 && base == 10) ret += '-';
	}
	// 文字列の順番を逆にする
	std::reverse(ret.begin(), ret.end());

	return ret;
}

int main() {
	int n, k;
	cin >> n >> k;
	cout << Itoa(n, k).size() << endl;
}

Measured memory_bytes: 256
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int arr[101]={0};
  
 int main()
 {
   int N;
   int max=0;
   while(cin>>N) arr[N]++;
   for(int i=1;i<=100;i++) if(arr[i]>max) max=arr[i];
   for(int i=1;i<=100;i++) if(arr[i]==max) cout<<i<<endl;             
   //while(1);     
   return 0;  
 }
 

Measured memory_bytes: 3008
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int n, m;
	while (cin>>n>>m,n) {
		vector<bool> vb(10000000, false);
		FOR(i,n, 10000000) {
			if (vb[i] == false) {
				if (m == 0) {
					cout << i << endl;
					break;
				}
				else {
					m--;
					for (int j = i*2;j < 10000000;j+=i) {
						vb[j] = true;
					}
				}
			}
		}
	}
}

Measured memory_bytes: 4212
#include<bits/stdc++.h>
#define same(a,b) (find(a)==find(b))
#define uni(a,b) fa[find(a)]=find(b)
#define init(n) for(int i=0;i<n;i++) fa[i]=i

int fa[100100];

int find(int x)
{
	if(x==fa[x]) return x;
	return fa[x]=find(fa[x]);
}

int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	init(n);
	for(int i=0;i<m;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		uni(u,v);
	}
	int q;
	scanf("%d",&q);
	for(int i=0;i<q;i++)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		if(same(u,v)) printf("yes\n");
		else printf("no\n");
	}
	return 0;
}

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

using namespace std;

long long int a[142];

int main() {
    long long int i, j, len, ct, tmp, ans, tp, cnt;
    char s[200005];
    scanf(" %s", s);
    len = strlen(s);
    ans = ((len * (len - 1)) / 2) + 1;
    ct = 0;
    for (i = 0; i < len; i++) {
        a[s[i]]++;
    }
    for (i = 97;i < 123; i++) {
        ans -= (a[i] * (a[i] - 1)) / 2;
    }
    /*
    tp = len - 1;
    for (i = 0; i < tp; i++) {
        j = 1;
        cnt = 1;
        while (s[i] == s[i + j]) {
            cnt++;
            j++;
        }
        i += j - 1;
        ct += (cnt * (cnt - 1)) / 2;
    }
    for (i = 1; i < tp; i++) {
        j = 1;
        cnt = 0;
        if ((s[i - j] == s[i + j]) && (s[i] != s[i + j])) {
            j++;
            cnt++;
            while ((s[i - j] == s[i + j]) && (i - j >= 0) && (i + j < len)) {
               cnt++;
               j++;
            }
        }
        ct += cnt;
    }
    */
    printf("%lld", ans - ct);
	return 0;
}


Measured memory_bytes: 384
N, M = list(map(int, input().split()))

sc = []
for i in range(M):
    sc.append(list(map(int, input().split())))

# print(N, M, sc)

y = -1
for i in range(1000):
    flag = True
    i_str = str(i)
    if len(i_str) != N:
        continue
    for m in range(M):
        s, c = sc[m]
        # print(s, c)
        if i_str[s - 1] != str(c):
            flag = False
    if flag == True:
        y = i
        break

print(y)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
int main(){
  int N;cin>>N;
  vector<double>dp(N+1,0);
  dp[0]=1.0;
  for(int i=1;i<=N;i++){
    double p;cin>>p;
    for(int j=i;j>=1;j--)
      dp[j]=dp[j]*p+dp[j-1]*(1.0-p);
    dp[0]=dp[0]*p;
  }
  cout<<setprecision(10)<<accumulate(dp.begin(),dp.begin()+(N+1)/2,0.0)<<endl;
}

Measured memory_bytes: 256
from itertools import accumulate

N = int(input())
A = [int(input()) for _ in range(N)]

L = [0] + list(accumulate(A, max))
R = [0] + list(accumulate(reversed(A), max))
R.reverse()

for l, r in zip(L[:-1], R[1:]):
    print(max(l, r))

Measured memory_bytes: 18980
import scala.io.Source.stdin

object Main extends App {
  val m = new Array[Int](4)
  stdin.getLines.map(_.split(",")).foreach { x =>
    x(1) match {
      case "A" => m(0) += 1
      case "B" => m(1) += 1
      case "AB" => m(2) += 1
      case "O" => m(3) += 1
    }
  }
  for(i<-0 to 3)
    println(m(i))
}

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

int main(){
  int X, N;
  cin >> X >> N;
  vector<int> p(N);
  for(int i = 0; i < N; i++){
    cin >> p.at(i);
  }
  
  for(int i = 0; i <= 100; i++){
    if(find(p.begin(), p.end(), X-i) == p.end()){
      cout << X-i;
      return 0;
    }else if(find(p.begin(), p.end(), X+i) == p.end()){
      cout << X+i;
      return 0;
    } 
  }
  
  cout << X;
  return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
int main(){
    int n,i,j,ans=0,yes;
    cin >> n;
    vector<int> h(n);
    for(i=0;i<n;i++) cin >> h.at(i);
    for(i=0;i<n;i++){
        yes=1;
        for(j=0;j<i;j++){
            if(h.at(j)>h.at(i))yes=0;
        }
        ans += yes;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.Point;

public class Main {
	static final long MOD = 998244353L;
	//static final long INF = -1000000000000000007L;
	//static final long MOD = 1000000007L;
	//static final int INF = 1000000007;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		long N = sc.nl();
		if (N % 2 == 0) {
			N /= 2; //product of numbers from 1 to N.
			long ans = 0;
			while (N > 0) {
				ans += (N/5);
				N /= 5;
			}
			pw.println(ans);
		} else {
			pw.println(0);
		}
		pw.close();
	}
	
	//Find the GCD of two numbers
	public static long gcd(long a, long b) {
		if (b == 0)
			return a;
		else
			return gcd(b,a%b);
	}
	
	//Fast exponentiation (x^y mod m)
	public static long power(long x, long y, long m) { 
		long ans = 1;
		x %= m;
		while (y > 0) { 
			if(y % 2 == 1) 
				ans = (ans * x) % m; 
			y /= 2;  
			x = (x * x) % m;
		} 
		return ans; 
	}
	
    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[0]-arr2[0]; //ascending order
	          }
		});
		return array;
	}
    
    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  return 0;
	          }
		});
		return array;
	}
    
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str;
        }
    }
}

Measured memory_bytes: 22484
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] color = new int[9];
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			if(a >= 3200) color[8]++;
			else color[a / 400]++;
		}
		int min = 0;
		for(int i = 0; i < 8; i++) if(color[i] > 0) min++;
		System.out.println((min == 0 ? 1 : min) + " " + (color[8] + min));
	}
}


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

int main() {

	int n; cin >> n;
	string s; cin >> s;
	int left = 0;
	int pointer = 0;
	for (int i = 0; i < n; i++) {
		if (0 < pointer) {
			if (s[i] == '(') {
				pointer++;
			}
			else { // s[i] == ')'
				pointer--;
			}
		}
		else { // pointer == 0
			if (s[i] == '(') {
				pointer++;
			}
			else { // s[i] == ')'
				left++;
			}
		}		
	}
	string ans = "";
	while (left--) {
		ans += "(";
	}
	ans += s;
	while (pointer--) {
		ans += ")";
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define MAX 100009
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define Mod 1000000007
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"

using namespace std;

typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);
	
	ll n;cin>>n;
	ll a[n];
	For(i,0,n) cin>>a[i];

	if(n==2){
		if(a[n-1]==a[n-2]){
			cout<<1<<endl;
			return 0;
		}else{
			cout<<0<<endl;
			return 0;
		}
	}

	// ll ans=0;
	// if(a[n-1]==a[n-2]){
	// 	ll c1=0,c2=0;
	// 	ll f1[MAX],f2[MAX];
	// 	For(i,0,MAX){
	// 		f1[i]=0;
	// 		f2[i]=0;
	// 	}
	// 	For(i,0,n-2){
	// 		if(a[i]==a[n-1]) continue;
	// 		if(i%2==0) f1[a[i]]++;
	// 		else f2[a[i]]++;			
	// 	}
	// 	ll index1=0,index2=0;
	// 	For(i,0,MAX){
	// 		if(f1[i]>c1) {
	// 			index1=i;
	// 			c1=f1[i];
	// 		}
	// 		if(f2[i]>c2) {
	// 			index2=i;
	// 			c2=f2[i];
	// 		}
	// 	}
	// 	if(c1>c2){
	// 		a[n-2]=index1;
	// 	}else{
	// 		a[n-1]=index2;
	// 	}
	// 	// if(a[n-1]==a[n-2])
	// 	ans++;
	// } 
	ll ans = 0;
	ll f1[MAX],f2[MAX];

	For(i,0,MAX){
		f1[i]=0;
		f2[i]=0;
	}

	For(i,0,n){
		if(i%2==0) f1[a[i]]++;
		else f2[a[i]]++;
	}
	ll c1=0,c2=0;
	ll index1=0,index2=0;
	For(i,0,MAX){
		if(f1[i]>c1) {
			index1=i;
			c1=f1[i];
		}
		if(f2[i]>c2) {
			index2=i;
			c2=f2[i];
		}
	}
	if(index1==index2){
		ll next1=0,next2=0;
		For(i,0,MAX){
			if(i==index1) continue;
			if(f1[i]>next1) {
				next1=f1[i];
			}
			if(f2[i]>next2) {
				next2=f2[i];
			}
		}
		ll minus = max(c1+next2,c2+next1);
		cout<<n-minus<<endl;
		return 0;
	}

	ans = n - c1 - c2;

	cout<<ans<<endl;
}

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

class F
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var rs = new int[n - 1].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();
		var map = rs.Concat(rs.Select(r => new[] { r[1], r[0] })).ToLookup(r => r[0], r => r[1]);

		var tour = new int[n + 1].Select(_ => new List<int>()).ToArray();
		var c = 0;
		var q = new Stack<int>();
		var parents = new Stack<int>();
		var u = new bool[n + 1];

		q.Push(1);
		parents.Push(0);
		while (q.Any())
		{
			var p = q.Peek();
			if (!u[p])
			{
				u[p] = true;
				var p0 = parents.Peek();
				if (p != 1) tour[p0].Add(++c);
				foreach (var x in map[p])
				{
					if (x == p0) continue;
					q.Push(x);
				}
				parents.Push(p);
			}
			else
			{
				if (p != 1) tour[p].Add(++c);
				q.Pop();
				parents.Pop();
			}
		}

		Console.WriteLine((tour.Select(l => Hole(l, n - 1)).Aggregate((x, y) => x + y) / 2).V);
	}

	static MInt Hole(List<int> l, int m)
	{
		if (l.Count < 2) return 0;

		MInt bSum = 0;
		for (int i = 0; i < l.Count; i++)
		{
			var c = ((l[(i + 1) % l.Count] - l[i]) / 2 + m) % m;
			bSum += ((MInt)2).Pow(c) - 1;
		}
		return 1 - 1 / ((MInt)2).Pow(m) * (1 + bSum);
	}
}

struct MInt
{
	const int M = 1000000007;
	public long V;
	public MInt(long v) { V = (v %= M) < 0 ? v + M : v; }

	public static implicit operator MInt(long v) => new MInt(v);
	public static MInt operator +(MInt x) => x;
	public static MInt operator -(MInt x) => -x.V;
	public static MInt operator +(MInt x, MInt y) => x.V + y.V;
	public static MInt operator -(MInt x, MInt y) => x.V - y.V;
	public static MInt operator *(MInt x, MInt y) => x.V * y.V;
	public static MInt operator /(MInt x, MInt y) => x * y.Inv();

	public MInt Pow(int i) => MPow(V, i);
	public MInt Inv() => MPow(V, M - 2);

	static long MPow(long b, int i)
	{
		for (var r = 1L; ; b = b * b % M)
		{
			if (i % 2 > 0) r = r * b % M;
			if ((i /= 2) < 1) return r;
		}
	}
}


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

using namespace std;
using ll=long long;

#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
const int MOD=1e9+7;

template<typename T>
void fail(T v){cout << v << endl;exit(0);}

void solve(){
  int num;
  cin >> num;
  for(int i=1;i<10;i++)
    for(int j=1;j<10;j++)
      if(i*j==num)
        fail("Yes");
  cout << "No" << endl;
}

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


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

int main(){
	string s;
    cin >> s;
  
        if(s == "SUN"){
  cout << 7;
  }else if(s == "MON"){
  cout << 6;
  }else if(s == "TUE"){
  cout << 5;
  }else if(s == "WED"){
  cout << 4;
  }else if(s == "THU"){
  cout << 3;
  }else if(s == "FRI"){
  cout << 2;
  }else if(s == "SAT"){
  cout << 1;}
}

Measured memory_bytes: 256
// need
#include <iostream>
#include <algorithm>
// data structure
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <queue>
//#include <deque>
#include <valarray>
#include <unordered_map>
#include <unordered_set>
#include <array>
// etc
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
// utility
#define all(i) (i).begin(), (i).end()
#define rep(i, n) for(int i=0;i<int(n);++i)
#define rrep(i, n) for(int i=int(n)-1;i>=0;--i)
#define in(a, x, b) (a<=x && x<b)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

template<typename S, typename T>
std::ostream& operator<<(std::ostream& os, std::pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")"; return os;
}

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using PAIR = std::pair<int, int>;
using PAIRLL = std::pair<ll, ll>;
constexpr int MOD = 1000000007;


signed main() {
  int N, M;
  std::cin >> N;

  std::vector<std::string> s(N);
  rep(i, N) std::cin >> s[i];

  std::cin >> M;
  std::vector<std::string> t(M);
  rep(i, M) std::cin >> t[i];

  std::map<std::string, int> point{};
  rep(i, N) point[s[i]]++;
  rep(i, M) point[t[i]]--;

  int ans = 0;
  for(std::pair<std::string, int>p:point) ans = std::max(ans, p.second);

  std::cout << ans;
  std::cout << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>


int main(int argc, char const *argv[]) {

  int n;
  scanf("%d", &n);

  int a[n];
  int b[n];
  int c[n-1];
  for(int i=0; i < n; i++){
      scanf("%d", &a[i]);
  }
  for(int i=0; i < n; i++){
      scanf("%d", &b[i]);
  }
  for(int i=0; i < n-1; i++){
      scanf("%d", &c[i]);
  }

  int sat = 0;
  for (int i=0; i < n; i++){
      sat += b[i];
  }
  for (int i=0; i < n-1; i++){
      if (a[i] +1 == a[i+1]){
          sat += c[ a[i] - 1 ];
      }
  }

  printf("%d\n", sat);

  return 0;
}

Measured memory_bytes: 128
semester, K = map(int, input().split())

score = input().split()

for i in range(semester - K + 1) :
    if i == 0 :
        continue    

    if int(score[K - K + i - 1]) < int(score[K - 1 + i]) :
        print("Yes")
    else :
        print("No")


Measured memory_bytes: 25016
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
/*
int score(int D, int c[], int s[][26], int t[]){
    int pen[365]={0};
    int score=0;
    
    for(int i=0; i<365; i++){
        int num=t[i];
        //満足度増加
        score+=s[i][num];
        //満足度低下

    }

}
*/
int main(void){
    int D, c[26], s[365][26], t[365];

    //入力
    scanf("%d", &D);
    for(int i=0; i<26; i++){
        scanf("%d", &c[i]);
    }
    for(int i=0; i<D; i++){
        for(int j=0; j<26; j++){
            scanf("%d", &s[i][j]);
        }
    }
    for(int i=0; i<365; i++){
        scanf("%d", &t[i]);
    }

    //出力
    /*
    printf("%d\n", D);
    for(int i=0; i<26; i++){
        printf("%d ", c[i]);
    }
    printf("\n");
    for(int i=0; i<D; i++){
        for(int j=0; j<26; j++){
            printf("%d ", s[i][j]);
        }
    }
    */

   /*ここから処理*/
    int num=1;
    for(int i=0; i<D; i++){
        printf("%d\n", num);
        num++;
        if(num>26) num=1;
    }


    return 0;
}

Measured memory_bytes: 1772
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
//const long mod=(long)1e9+7;
inline void solve(void){
  set<int>s;
  rep(i,3){
    int a;
    in(a);
    s.insert(a);
  }
  out(s.size()==2?"Yes":"No");
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    h, w, k = map(int, input().split())
    c = [input() for _ in range(h)]

    sol = 0

    for i in range(2 ** h):
        for j in range(2 ** w):

            count = 0

            for x in range(h):
                for y in range(w):
                    if c[x][y] == '#' and i & (1 << x) == 0 and j & (1 << y) == 0:
                        count += 1

            if count == k:
                sol += 1

    print(sol)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 73448
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    int n;
    cin >> n;
    double x[100], y[100];
    rep(i, 2) {
        rep(j, n) {
            if (i) cin >> y[j];
            else cin >> x[j];
        }
    }
    double ans1=0, ans2=0, ans3=0, ans4=0,tmp;
    rep(i, n) {
        ans1 += abs(x[i] - y[i]);
    }
    rep(i, n) {
        tmp = abs(x[i] - y[i]);
        ans2 += tmp*tmp;
    }
    ans2 = sqrt(ans2);
    rep(i, n) {
        tmp = abs(x[i] - y[i]);
        ans3 += tmp*tmp*tmp;
    }
    ans3 = pow(ans3, 1.0/3.0);
    rep(i, n){
        ans4 = max(ans4, abs(x[i] - y[i]));
    }

    cout << fixed << setprecision(10) << ans1 << endl;
    cout << fixed << setprecision(10) << ans2 << endl;
    cout << fixed << setprecision(10) << ans3 << endl;
    cout << fixed << setprecision(10) << ans4 << endl;

    return 0;
}


Measured memory_bytes: 3480
import sys
N = int(input())
N2 = list(map(int,str(N)))
if not (1000 <= N <= 9999):
    sys.exit()

if N2[0] == N2[1] == N2[2] or N2[1] == N2[2] == N2[3]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9032
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int max;
	int x,y,z;
	int k;
	cin>>x>>y>>z;
	cin>>k;
	int ans;
	ans=x+y+z;
	for (int i=0;i<k;i++)
	{
		if (x>y)
		{
			if (x>z)
			{
				max=x;
				x=2*x;
			}
			else
			{
				max=z;
				z=2*z;
			}
		}
		else 
		{
			if (y>z)
			{
				max=y;
				y=2*y;
			}
			else
			{
				max=z;
				z=2*z;
			} 
		}
		ans=ans+max;
		max=0;
	}
	cout<<ans<<endl;
	return 0;	
} 

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

#define ll long long

bool pairCompare(const pair<int, ll>& firstElof, const pair<int, ll>& secondElof)
{
    return firstElof.second > secondElof.second;
}

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

    vector<ll> A;
    ll a,c;
    int b;
    vector<pair<int, ll>> p(M);
    for(int i = 0; i < N; i++) {
        cin >> a;
        A.push_back(a);
    }
    for(int i = 0; i < M; i++) {
        cin >> b >> c;
        pair<int, ll> tmp = {b, c};
        p[i] = tmp;
    }

    //Aを降順にソート
    sort(A.begin(), A.end(), greater<int>());
  
    //cが降順にソート
    sort(p.begin(), p.end(), pairCompare);

    //後ろに０を代入しておく
    A.push_back(0);

    pair<int, ll> tmp = {0, 0};
    p.push_back(tmp);

    int count = 0;
    ll ans = 0;
    int itrA = 0,itrp = 0;

    while(count < N){
        if(A[itrA] >= p[itrp].second){
            ans += A[itrA];
            itrA++;
        }else{
            ans += p[itrp].second;
            if(p[itrp].first > 1){
                p[itrp].first--;
            }else{
                itrp++;
            }
        }
        count++;
    }
    
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 5620
var n,i,max:longint;
a:array[1..200]of longint;
b:boolean;
begin
readln(n);
for i:=1 to n do read(a[i]);
b:=true;
max:=0;
while b do
begin
b:=true;
for i:=1 to n do if a[i]mod 10 mod 2=1 then b:=false;
if b then max:=max+1;
if b then for i:=1 to n do a[i]:=a[i] div 2;
end;
write(max);
end.

Measured memory_bytes: 128
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	listp := make([]int, m)
	listS := make([]string, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&listp[i], &listS[i])
	}

	ac := 0
	wa := 0
	flagAC := make([]bool, n+1)
	WAcount := make([]int, n+1)

	for i := 0; i < m; i++ {
		if flagAC[listp[i]] == false {
			if listS[i] == "AC" {
				ac++
				wa += WAcount[listp[i]]
				flagAC[listp[i]] = true
			} else if listS[i] == "WA" {
				WAcount[listp[i]]++
			}
		}

	}

	fmt.Println(ac, wa)

}


Measured memory_bytes: 6528
n, a, f, c = int(input()), list(map(int, input().split())), True, 0

while f:
    f = False
    for j in range(n - 1, 0, -1):
        if a[j] < a[j - 1]:
            a[j], a[j - 1], c = a[j - 1], a[j], c + 1
            f = True

print(*a)
print(c)

Measured memory_bytes: 7676
#include<iostream>
using namespace std;
int main()
{
	char a[1000] , b[1000];
	cin>>a>>b;
	if(a[0]==b[2])
		if(a[1]==b[1])
			if(a[2]==b[0])
			{
				cout<<"YES"<<endl;
				return 0;
			}
	cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
int main(){
  int hp,an,*ap,ap_sum=0;
  std::cin>>hp>>an;
  ap=new int[an];
  for(int i=0;i<an;i++){
    std::cin>>ap[i];
    ap_sum+=ap[i];
  }
  if(hp-ap_sum<=0){
    std::cout<<"Yes\n";
  }else{
    std::cout<<"No\n";
  }
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll k, n;
    cin >> k >> n;
    vll a(n + 1);
    ll s = 0;
    REP(i, n) {
        cin >> a[i];
    }
    a[n] = a[0] + k;
    ll res = 1e10, d;
    REP(i, n) {
        d = a[i + 1] - a[i];
        res = min(res, k - d);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define ve(i) vector<i>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define pr(n) cout << fixed << setprecision(n)
#define ci(n) cin >> n
#define ci2(n, o) cin >> n >> o
#define ci3(n, o, p) cin >> n >> o >> p
#define co(n) cout << n << endl

int main() {
  st S;
  ci(S);
  if(S.at(2) == S.at(3) && S.at(4) == S.at(5)) {
    co("Yes");
  }
  else {
    co("No");
  }
}  

Measured memory_bytes: 764