akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define il inline
#define mod 998244353
typedef long long ll;
il int gi(){
	int x=0,f=0;char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
int fact[8010],ifact[8010];
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod,y>>=1;
	}
	return ret;
}
const int G=19260817,iG=pow(G,mod-2);
int dp[16387],New[16387],Dp[16387],rev[16387];
int P[100],iP[100],N,lg;
void setN(int _){
	lg=31-__builtin_clz(_);if(1<<lg!=_)++lg;N=1<<lg;
	for(int i=0;i<N;++i)rev[i]=(rev[i>>1]>>1)|((i&1)<<lg-1);
}
void ntt(int*A,int t){
	for(int i=0;i<N;++i)if(i>rev[i])std::swap(A[i],A[rev[i]]);
	for(int o=1,w,_=1;o<N;o<<=1,++_){
		w=t?P[_]:iP[_];
		for(int*p=A;p!=A+N;p+=o<<1)
			for(int i=0,W=1;i<o;++i,W=1ll*W*w%mod){
				int t=1ll*p[i+o]*W%mod;
				p[i+o]=(p[i]-t+mod)%mod,p[i]=(p[i]+t)%mod;
			}
	}
	if(!t){
		int inv=pow(N,mod-2);
		for(int i=0;i<N;++i)A[i]=1ll*A[i]*inv%mod;
	}
}
int main(){
// 	freopen("in.in","r",stdin);
// 	freopen("out.out","w",stdout);
	fact[0]=1;for(int i=1;i<8010;++i)fact[i]=1ll*fact[i-1]*i%mod;
	ifact[8009]=pow(fact[8009],mod-2);for(int i=8009;i;--i)ifact[i-1]=1ll*ifact[i]*i%mod;
	int ans=0,n=gi(),m=gi();
	for(int i=0;i<=n;++i)dp[i]=1;
	for(int i=1;(1<<i)<=16384;++i)P[i]=pow(G,mod/(1<<i)),iP[i]=pow(iG,mod/(1<<i));
	setN(n+2<<1);
	for(int i=1;i<=n;++i)New[i]=ifact[i+2];
	ntt(New,1);
	for(int s=2;s<=m;++s){
		memcpy(Dp,dp,sizeof Dp);
		for(int i=0;i<=n;++i)dp[i]=1ll*dp[i]*ifact[i]%mod;
		ntt(dp,1);
		for(int i=0;i<N;++i)dp[i]=1ll*dp[i]*New[i]%mod;
		ntt(dp,0);
		for(int i=0;i<=n;++i)dp[i]=(1ll*dp[i]*fact[i+2]%mod+1ll*Dp[i]*(1ll*(i+1)*i/2%mod+1))%mod;
		for(int i=n+1;i<N;++i)dp[i]=0;
	}
	for(int i=0;i<=n;++i)ans=(ans+1ll*fact[n]*ifact[i]%mod*ifact[n-i]%mod*dp[i])%mod;
	printf("%d\n",ans);
	return 0;
}


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

int n;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int t;
		cin>>t;
		if(mp[t]!=0)
		{
			cout<<"NO"<<endl;
			return 0;
		}
		mp[t]++;
	}
	cout<<"YES"<<endl;
	return 0;
	
} 

Measured memory_bytes: 9600
//aea ctmr
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//v.erase(unique(v.begin(),v.end()),v.end());
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define PI 3.14159265358979323846
 
typedef long double ld;
typedef long long ll;
const ll N = 400500;
const ll mod = 1e9 + 7;
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;}
 
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1<<" | ";
  __f(comma+1, args...);}
#else
#define trace(...)
#endif

bool wea(string s){
	int l = s.size();
	for(int i = 0; i < l; i++){
		if(s[i] != s[l - i - 1]) return false;
	}

	return true;
}

int main(){
    fastio;
    cout << fixed << setprecision(10);
	int n;
	cin >> n;
	ld ans = ((n / 3.0) * (n / 3.0) * (n / 3.0));
	cout << ans << endl;
}

Measured memory_bytes: 256
'use strict';
console.log(function(args){
  const tmp = args.trim().split('\n').map( r=>r.split(' ') );
  const N = tmp[0][0]|0;
  const Q = tmp[0][1]|0;
  const S = tmp[1][0] + ' ';
  const s = Array(N+1).fill(0);
  for ( let i = 0; i < N; i++ ) {
    s[i+1] = s[i];
    if ( S[i] !== 'A' ) continue;
    if ( S[i+1] !== 'C' ) continue;
    s[i+1]++;
  }
  const out = [];
  for ( let i = 0; i < Q; i++ ) {
    const l = tmp[2+i][0] - 1;
    const r = tmp[2+i][1] - 1;
    out.push( s[r] - s[l] );
  }
  return out.join('\n');
}(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 58576
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;

long long int powint(long long int a, long long int b) {
	assert(b >= 0);
	if (b == 0)return 1;
	if (b == 1)return a;
	long long int ans = 1;
	long long int aa = powint(a, b / 2);
	ans *= aa*aa;
	if (b % 2)ans *= a;
	return ans;
}

map<char, int>mp;
map<int, char>revmp;
int main() {
	mp['m'] = 1000;
	mp['c'] = 100;
	mp['x'] = 10;
	mp['i'] = 1;
	revmp[1] = 'i';
	revmp[10] = 'x';
	revmp[100] = 'c';
	revmp[1000] = 'm';
	int N; cin >> N;
	while (N--) {
		int sum = 0;
		for (int i = 0; i < 2; ++i) {
			string st; cin >> st;
			
			int num = 1;
			for (int j = 0; j < st.size(); ++j) {
				if (isdigit(st[j])) {
					num = st[j] - '0';
				}
				else {
					sum += num*mp[st[j]];
					num = 1;
				}
			}
			
		}
		vector<int>nums;
		for (int i = 0; i < 4; ++i) {
			nums.push_back(sum % 10);
			sum /= 10;
		}
		reverse(nums.begin(), nums.end());
		for (int i = 0; i < 4; ++i) {
			if (nums[i] >= 2) {
				cout << nums[i] << revmp[powint( 10,3-i)];
			}
			else if (nums[i] == 1) {
				cout << revmp[powint(10,3-i)];
			}
		}
		cout << endl;
	}
	return 0;
}

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

int main(){
	int n,r,p,c;
	while(true){
		vector<int> a,b;
		cin >> n >> r;
		if(n==0 && r == 0)	break;
		a.resize(n);b.resize(n);
		for(int i = 0; i < n; ++i){
			a[i] = i;
		}
		for(int  i = 0; i < r; ++i){
			cin >> p >> c;

			for(int j = n-p-c+1; j < n; ++j){
				b[j] = a[j];
			}
			for(int j = n-p-c+1; j < n-p+1; ++j){
				a[j+p-1] = b[j];
			}
			for(int j = n-p+1; j < n; ++j){
				a[j-c] = b[j];
			}
		}
		cout << a[n-1]+1 << endl;
	}
}



Measured memory_bytes: 2988
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {
        public static void main(String[] args) throws Exception {
    	String[] op = {"+","-","*","/"};
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while(true) {
            BigDecimal n = new BigDecimal(0);
            String line = br.readLine();
            String[] ary = line.split(" ");
            if(ary[1].equals("?"))
                break;
            else {
                BigDecimal in1 = new BigDecimal(ary[0]);
                BigDecimal in2 = new BigDecimal(ary[2]);
                switch(Matching(op,ary[1])) {
                    case 0:
                        n = in1.add(in2);
                        break;
                    case 1:
                        n = in1.subtract(in2);
                        break;
                    case 2:
                        n = in1.multiply(in2);
                        break;
                    case 3:
                        n = in1.divideToIntegralValue(in2);
                        break;
                }
                System.out.println(n.toPlainString());
            }

        }
    }
    private static int Matching(String[] str,String target) {
    	for(int i=0;i<str.length;i++) {
    		if(str[i].equals(target)){
    			return i;
    		}
    	}
		return 0;
    }
}

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

q = []
for _ in range(N):
    val = list(map(int, input().split()))
    # heappush(q, val, lambda x:x[1])
    q.append(val)

q.sort(key=lambda x: x[1])

# solve
cur = 0
for assign, limit in q:
    cur += assign
    if limit < cur:
        print("No")
        exit()

print("Yes")

# while not q.empty():
    # assign, limit = q.heappop()


Measured memory_bytes: 53648
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない
//UnionFind

const int maxn=1000;

int main(){
    
    int n,m;
    ll x[maxn],y[maxn],z[maxn];
    ll ans=0;
    
    cin >> n>>m;
    rep(i,n){
        cin >> x[i]>>y[i]>>z[i];
    }
    
    for(int i=0;i<1<<3;i++){
        bool sign[3];
        int pm[3];
        ll scores[maxn]={0};
        for(int j=0;j<3;j++){
            sign[j]=i>>j&1;
        }
        rep(k,3){
            if(sign[k])pm[k]=1;
            else pm[k]=-1;
        }
        rep(i,n){
            scores[i]=x[i]*pm[0]+y[i]*pm[1]+z[i]*pm[2];
        }
        sort(scores,scores+n);
        ll subans=0;
        for(int i=0;i<m;i++){
            //cout << scores[n-1-i]<<endl;
            subans+=scores[n-1-i];
        }
        //cout << subans<<endl;
        ans=max(ans,subans);
    }
    
    cout << ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double dp[302][302][302];
int N;

double dfs(int a, int b, int c) {
	if(a == 0 && b == 0 && c == 0)
		return 0;
	if(dp[a][b][c] > 0)
		return dp[a][b][c];
	int k = a + b + c;
	double ans = N * 1.0;
	if(a) {
		ans += a * dfs(a - 1, b, c);
	}
	if(b) {
		ans += b * dfs(a + 1, b - 1, c);
	}
	if(c) {
		ans += c * dfs(a, b + 1, c - 1);
	}
	return dp[a][b][c] = ans / k;
}

int main() {
	memset(dp, -1, sizeof(dp));
	cin>>N;
	vector<int> a(N+1);
	for (int i = 0; i < N; ++i) {
		int ai;
		cin>>ai;
		a[ai]++;
	}
	printf("%.10lf\n", dfs(a[1], a[2], a[3]));
	return 0;
}


Measured memory_bytes: 215424
//vec[i]の範囲外エラー表示
#define _GLIBCXX_DEBUG
//includeとusing
#include <bits/stdc++.h>
using namespace std;
//型名省略
using ll = long long;
using st = string;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using pcc = pair<char, char>;
//定数
const ll INF = 1e9;
const ll MOD = 1e9+7;
const vl dx = {1,0,-1,0,1,0,-1,0};
const vl dy = {0,1,0,-1,0,1,0,-1};
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define rrep(i,n) for(ll i = (ll) n - 1; i >= 0;i--)
#define REP(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define RREP(i,x,n) for(ll i = (ll) n - 1; i >= x; i--)
#define each(i,A) for(ll i: (vl) A)
#define all(A) A.begin(), A.end()
#define Size(A) ll(A.size())
//入力
template<typename T> T input() {T x; cin >> x; return x;}
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}
//余り切り上げ
ll ceil(ll a,ll b) {return (a + b - 1) / b;}
//最大値・最小値
template <typename T> bool chmax(T &a, const T& b) {if(a < b) {a = b; return true;} return false;}
template <typename T> bool chmin(T &a, const T& b) {if(a > b) {a = b; return true;} return false;}
//最大公約数
ll gcd(ll a,ll b){if(a<b)swap(a,b); if(a%b==0)return b; return gcd(b,a%b);}
//最小公倍数
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//n乗の余り
ll modPow(ll x,ll n,ll mod){if(n==0)return 1; if(n%2==0)return modPow(x*x,n/2,mod)%mod; return x%mod*modPow(x,n-1,mod)%mod;}


/*--------------------------------------------------------------------------*/

//main関数
int main() {
    ll n; cin >> n;
    ll ans = 0;
    for(ll i = 1; i <= n; i++){
        if(i % 3 != 0 && i % 5 != 0){
            ans += i;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3544
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    H,W,N = LI()
    R,C = LI()
    S = SI()
    T = SI()

    x = C
    for i in range(N):
        x -= S[i] == 'L'
        if x <= 0:
            print('NO')
            return
        if x < W:
            x += T[i] == 'R'

    x = C
    for i in range(N):
        x += S[i] == 'R'
        if x > W:
            print('NO')
            return
        if x > 1:
            x -= T[i] == 'L'

    x = R
    for i in range(N):
        x -= S[i] == 'U'
        if x <= 0:
            print('NO')
            return
        if x < H:
            x += T[i] == 'D'

    x = R
    for i in range(N):
        x += S[i] == 'D'
        if x > H:
            print('NO')
            return
        if x > 0:
            x -= T[i] == 'U'

    print('YES')

if __name__ == '__main__':
    main()

Measured memory_bytes: 43484
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define y1 zzz
#define fi first
#define se second
#define PII pair<int,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
int f[101][101];
char s[101][101];
int n,m;
void solve()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    for(int j=1;j<=m;j++)
    {
        cin>>s[i][j];
        f[i][j]=1e9;
        if(i==1&&j==1)f[i][j]=(s[i][j]=='#');

        if(s[i][j]=='#'&&s[i-1][j]=='.')f[i][j]=min(f[i][j],f[i-1][j]+1);
        else if(i>1)f[i][j]=min(f[i][j],f[i-1][j]);

        if(s[i][j]=='#'&&s[i][j-1]=='.')f[i][j]=min(f[i][j],f[i][j-1]+1);
        else if(j>1)f[i][j]=min(f[i][j],f[i][j-1]);
    }
    cout<<f[n][m];
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("STRWC.inp","r",stdin);
    //freopen("FORMMAU.out","w",stdout);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using i64 = std::int64_t;
using namespace std;

// Make Combination table using "Pascal's Triangle" at Compile-Time
template <size_t N>
struct CombTable {  // {{{
  static_assert(N < 70u,
                "Template parameter <N> is too large. It may be Overflow.");
  i64 mat[N + 1][N + 1];
  constexpr explicit CombTable() {
    for (int n = 0; n <= N; ++n) {
      for (int r = 0; r <= n; ++r) {
        mat[n][r] =
            ((r == 0 || n == r) ? (1) : (mat[n - 1][r - 1] + mat[n - 1][r]));
      }
    }
  }
  i64 operator()(int n, int r) const {
    return (r < 0 || n < r) ? 0 : mat[n][r];
  }
};  // }}}

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout.setf(ios_base::fixed);
  cout.precision(11);

  CombTable<55> comb;

  int N, P;
  cin >> N >> P;

  i64 cnt[2]{};
  for (int i = 0; i < N; ++i) {
    int x;
    cin >> x;
    cnt[x & 1] += 1;
  }

  i64 ans = 0;

  for (int evenNum = 0; evenNum <= cnt[0]; ++evenNum) {
    for (int oddNum = 0; oddNum <= cnt[1]; ++oddNum) {
      if (oddNum % 2 == P) ans += comb(cnt[0], evenNum) * comb(cnt[1], oddNum);
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n, x, y = map(int, input().split())
edge = [[] for _ in range(n+1)]
dist = [[abs(i-j) for i in range(n+1)] for j in range(n+1)]
counter = [0 for i in range(n)]
for i in range(1, n):
    edge[i].append(i+1)
    edge[i+1].append(i)
edge[x].append(y)
edge[y].append(x)
for i in range(y+1):
    for j in range(x, n+1):
        if j > i:
            new_dist = abs(x-i)+abs(y-j)+1
            if new_dist < dist[i][j]:
                dist[i][j] = new_dist

for i in range(1, n+1):
    for num in dist[i][i+1:]:
        counter[num] += 1
# print(dist)

for num in counter[1:]:
    print(num)


Measured memory_bytes: 134616
package main

import "fmt"

func main() {
	var h, w, d int
	fmt.Scan(&h, &w, &d)

	am := make([]Pair, h*w+1)
	var a int
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			fmt.Scan(&a)
			am[a] = Pair{i, j}
		}
	}

	s := make([]int, h*w+1)
	for i := 0; i <= h*w-d; i++ {
		p1 := am[i]
		p2 := am[i+d]
		s[i+d] = s[i] + abs(p1.y-p2.y) + abs(p1.x-p2.x)
	}

	var q, l, r int
	fmt.Scan(&q)
	for i := 0; i < q; i++ {
		fmt.Scan(&l, &r)
		fmt.Println(s[r] - s[l])
	}
}

// Pair .
type Pair struct {
	y, x int
}

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


Measured memory_bytes: 6784
import numpy as np
D = int(input())
C = list(map(int, input().split()))
B = np.array([0] * 26)
S = [list(map(int, input().split())) for _ in range(D)]
satisfaction = 0
for d in range(1, D+1):
    t = int(input())
    B[t-1] = d
    deduction = sum(C * (d - B))
    satisfaction += S[d-1][t-1] - deduction
    print(satisfaction)

Measured memory_bytes: 27696
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
#define N 100010
unordered_map<ll,bool> mas[N];
vector<ll> g[N];
ll n,m;
bool p[N],vis[N];
void dfs(ll x,ll from){
    if(vis[x])return;
    vis[x]=1;
    for(auto y:g[x])if(y!=from){
	dfs(y,x);
    }
    if(p[x]==1){
	if(from==-1)cout<<1/0<<endl;
	mas[x][from]^=1;
	mas[from][x]^=1;
	p[x]^=1,p[from]^=1;
    }
}
int main(){
  cin>>n>>m;
  for(int i=1;i<=n;i++)p[i]=0,vis[i]=0;
  for(int i=0;i<m;i++){
      ll a,b;cin>>a>>b;
      g[a].push_back(b);
      g[b].push_back(a);
      p[a]^=1;
      mas[a][b]=1,mas[b][a]=0;
  }
  if(m%2==1){
      cout<<-1<<endl;
      return 0;
  }
  dfs(1,-1);
  for(int i=1;i<=n;i++){
      for(auto y:g[i]){
	  if(mas[i][y]==1){
	      cout<<i<<" "<<y<<endl;
	  }
      }
  }
  return 0;
}


Measured memory_bytes: 28160
n=int(input())
cards = {}
for i in range(n):
    card=input()
    cards[card]=1
    
   
for c in ['S', 'H', 'C', 'D']:
        for n in range(1, 14):
            key = c+' '+ str(n)
            if not key in cards:
                print(key)



Measured memory_bytes: 5596
import java.util.Scanner;
import javax.sound.midi.SysexMessage;
  
public class Main{      
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = 1;
        for(;i<1000;i++){
            String str = sc.nextLine();
            if(str!=null){
            String[] str2 = str.split(" ");
            int x = Integer.parseInt(str2[0]);           
            int y = Integer.parseInt(str2[1]);

            if(x == 0 || y==0){
                //System.out.print("\n");
                break;
            }
            else
            {
                for(int j=0;j<x;j++)
                {
                    if(j==0||j==x-1)
                    {
                        for(int k=0;k<y;k++)
                        {
                            System.out.print("#");
                        }
                    }
                    else
                    {
                        for(int k=0;k<y;k++)
                            {
                                if(k==0||k==y-1)
                                    System.out.print("#");
                                else
                                    System.out.print(".");
                            } 
                    }
                    System.out.print("\n");
                }
                System.out.print("\n");
            }
            }
        }  
    }
}              

    


Measured memory_bytes: 34916
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

#include <set>

using namespace std;

int main(){
  const int n = getInt();
  const int a = getInt();
  const int b = getInt();

  int ans = n;
  REP(i,n) {
    const int t = getInt();
    if(a <= t && t < b) ans--;
  }

  printf("%d\n", ans);
  return 0;
}


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

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	map<string,int> mp;
	for (int i = 0; i < n; ++i) {
		string st;
		cin >> st;
		if (mp.find(st)!=mp.end()) ++mp[st];
		else mp[st] = 1;
	}
	int maxi = 0;
	for (auto it: mp) maxi = max(maxi,it.second);
	vector<string> ans;
	for (auto it: mp) {
		if (it.second == maxi) ans.emplace_back(it.first);
	}
	sort(ans.begin(),ans.end());
	for (auto it: ans) cout << it << '\n';
    return 0;
}


Measured memory_bytes: 25584
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while( x->left != NIL ) x = x->left;
  return x;
}
Node treeMaximum(Node x){
  while( x->right != NIL ) x = x->right;
  return x;
}

Node treeSearch(Node u, int k){
  while( u != NIL && k != u->key ){
    if ( k < u->key ) u = u->left;
    else u = u->right;
  }
  return u;
}

Node treeSuccessor(Node x){
  if ( x->right != NIL ) return treeMinimum(x->right);
  Node y = x->parent;
  while( y != NIL && x == y->right ){
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if ( z->left == NIL || z->right == NIL ) y = z;
  else y = treeSuccessor(z);
  if ( y->left != NIL ) x = y->left;
  else x = y->right;

  if ( x != NIL ) x->parent = y->parent;

  if ( y->parent == NIL ){
    root = x;
  } else {
    if (y == y->parent->left) y->parent->left = x;
    else y->parent->right = x;
  }

  if ( y != z ){
    z->key = y->key;
  }

  free(y);
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while( x != NIL ){
    y = x;
    if ( z->key < x->key ){
      x = x->left;
    } else {
      x = x->right;
    }
  }

  z->parent = y;
  if ( y == NIL ){
    root = z;
  } else {
    if (z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node u){
  if ( u == NIL ) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}
void preorder(Node u){
  if ( u == NIL ) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( strcmp(com, "find") == 0 ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( strcmp(com, "findMin") == 0 ){
	Node minn = treeMinimum(t);
	printf("%d\n", minn->key);
      } else if ( strcmp(com, "findMax") == 0 ){
	Node maxn = treeMaximum(t);
	printf("%d\n", maxn->key);
      } else {
	if ( t != NIL ) printf("yes\n");
	else printf("no\n");
      }
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( strcmp(com, "print") == 0 ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( strcmp(com, "delete") == 0 ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20572
import math
import collections


def main():
  N = int(input())
  S = [input() for _ in range(N)]
  
  A = collections.Counter(S)
  
  
  print('AC x ' + str(A['AC']))
  print('WA x ' + str(A['WA']))
  print('TLE x ' + str(A['TLE']))
  print('RE x ' + str(A['RE']))
  
  
  
main()

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

int main(){
  string s;
  cin >> s;
  int a=0;
  
  if(s[2]==s[3]) a = a+1;
  if(s[4]==s[5]) a = a+1;
  if(a==2) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
//  cout<<a<<endl;
}

Measured memory_bytes: 256
from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
#A, B, C = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに

a, b, c = tuple(map(int, input().split()))
if a+b+c>=22:
    print("bust")
else:
    print("win")


Measured memory_bytes: 3060
n, m = map(int,input().split())
n1 = set()
ans = "IMPOSSIBLE"
for i in range(m):
    a,b = map(int,input().split())
    if a == 1 or a == n:
        if b in n1:
            ans = "POSSIBLE"
        else:
            n1.add(b)
    elif b == 1 or b == n:
        if a in n1:
            ans = "POSSIBLE"
        else:
            n1.add(a)
print(ans)

Measured memory_bytes: 65240
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<set<int>> num(10);
  rep (i, n) num[s[i] - '0'].insert(i);
  int cnt = 0;
  rep (a, 10) {
    if (num[a].empty()) continue;
    int ai = *num[a].begin();
    rep (b, 10) {
      auto bitr = num[b].upper_bound(ai);
      if (bitr == num[b].end()) continue;
      int bi = *bitr;
      rep (c, 10) {
        auto citr = num[c].upper_bound(bi);
        if (citr != num[c].end()) ++cnt;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A, B;
    cin >> A >> B;
    A--; //A - 1 ~ 0 XOR B ~ 0 を行うため1を引く
    ll zeroToA = 0;
    //0~AまでのXOR
    if (A % 4 == 1 || A % 4 == 2)
    {
        zeroToA += 1;
    }
    if(A % 2 == 0)
    {
        zeroToA += A;
    }
    ll zeroToB = 0;
    //0~BまでのXOR
    if (B % 4 == 1 || B % 4 == 2)
    {
        zeroToB += 1;
    }
    if(B % 2 == 0)
    {
        zeroToB += B;
    }
    ll answer = zeroToA ^ zeroToB;
    cout << answer << endl;
    return 0;
}


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

int main() {
  int n, m, i, j, A[100][100], b[100], c;

  cin >> n >> m;

  for (i = 0; i < n; i++) {
  	for (j = 0; j < m; j++) {
  	  cin >> A[i][j];
  	}
  }

  for (j = 0; j < m; j++) {
  	cin >> b[j];
  }

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

  	for (j = 0; j < m; j++) {
  	  c += A[i][j] * b[j];
  	}

  	cout << c << endl;
  }

  return 0;
}

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

int main(){
	int N,p[101];
	scanf("%d",&N);
	for(int i = 0; i < N; i++){
		scanf("%d",&p[i]);
	}
	sort(p,p+N);
	for(int i = 0; i < N; i++){
		if(p[i] >= N - i){
			printf("%d\n",N-i);
			return 0;
		}
	}
	printf("%d\n",0);
	return 0;
}

Measured memory_bytes: 2744
import java.util.Scanner;

public class Main{
    public static void main(String[] args) throws Exception {
        // 変数宣言
        final String ALL_A = "AAA";
        final String ALL_B = "BBB";
        final String YES_STR = "Yes";
        final String NO_STR = "No";
        String S;
        String judge;

        // スキャナークラスのインスタンスを作成
        Scanner sc = new Scanner(System.in);

        // 入力受付
        S = sc.nextLine();
        sc.close();

        // 比較
        if( S.equals(ALL_A) || S.equals(ALL_B)){
            judge = NO_STR;
        }else{
            judge = YES_STR;
        }

        // 出力
        // バスが運行することになる駅の組み合わせが存在する場合は Yes を、存在しない場合は No 
        System.out.println( judge );
        
    }
}

Measured memory_bytes: 20692
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
const int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
const int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;

int main()
{
    int n;
    cin >> n;
    vector<ll> x(n), y(n), sum(n), dif(n);
    rep(i,n) {
        cin >> x[i] >> y[i];
        sum[i] = x[i] + y[i];
        dif[i] = x[i] - y[i];
    }
    ssort(sum); ssort(dif);
    ll ans1 = sum[n-1] - sum[0];
    ll ans2 = dif[n-1] - dif[0];
    ll ans = max(ans1, ans2);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 9580
# B - A to Z String
def main():
    s = list(input())
    start = 0
    end = 0

    for i in range(len(s)):
        if s[i] == 'A':
            start = i
            break
    for j in range(len(s)-1, 0, -1):
        if s[j] == 'Z':
            end = j
            break
    
    print(end-start+1)


        
        
if __name__ == '__main__':
    main()

Measured memory_bytes: 10524
#include <iostream>
#include <string>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  if (s == "Sunny") {
    cout << "Cloudy" << endl;
  } else if (s == "Cloudy") {
    cout << "Rainy" << endl;
  } else {
    cout << "Sunny" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>




struct Edge {
	int id, to;
};
class UnionFind {
	mutable std::vector<int> parent;
	int find(const int a) const {
		return (parent[a] >= 0) ? parent[a] = find(parent[a]) : a;
	}
public:
	UnionFind(const int size) : parent(size, -1) {};
	bool is_same(const int a, const int b) const {
		return find(a) == find(b);
	}
	void merge(const int a, const int b) {
		auto ar = find(a);
		auto br = find(b);
		if (ar != br) {
			if (parent[ar] < parent[br]) {
				parent[ar] += parent[br];
				parent[br] = ar;
			}
			else {
				parent[br] += parent[ar];
				parent[ar] = br;
			}
		}
	}
};
int main() {
	int n, m; std::cin >> n >> m;
	std::vector<std::vector<Edge>> node(n);
	for (auto i = 0; i < m; ++i) {
		int a, b; std::cin >> a >> b;
		node[a - 1].push_back({ i, b - 1 });
		node[b - 1].push_back({ i, a - 1 });
	}
	std::vector<bool> is_join(n, false);
	std::vector<bool> is_free_edge(m, false);
	std::queue<int> queue; queue.push(0); is_join[0] = true;
	std::vector<int> parent(n, -1);
	std::vector<int> child_count(n, 0);
	std::queue<int> leaf;
	while (!queue.empty()) {
		auto top = queue.front(); queue.pop();
		for (const auto& e : node[top]) if (!is_join[e.to]) {
			is_join[e.to] = true;
			is_free_edge[e.id] = true;
			parent[e.to] = top;
			queue.push(e.to);
			++child_count[top];
		}
		if (child_count[top] == 0) leaf.push(top);
	}
	std::vector<int> out_edge_count(n, 0);
	std::vector<std::pair<int, int>> result;
	for (auto i = 0; i < n; ++i) {
		for (const auto& e : node[i]) if (i < e.to && !is_free_edge[e.id]) {
			out_edge_count[i] ++;
			result.emplace_back(i, e.to);
		}
	}
	while (!leaf.empty() && leaf.front() != 0) {
		auto top = leaf.front(); leaf.pop();
		if (out_edge_count[top] % 2 == 0) {
			result.emplace_back(parent[top], top);
			out_edge_count[parent[top]]++;
		}
		else {
			result.emplace_back(top, parent[top]);
			out_edge_count[top]++;
		}
		child_count[parent[top]]--;
		if (child_count[parent[top]] == 0) leaf.push(parent[top]);
	}
	if (out_edge_count[0] % 2 == 0) {
		for (const auto& pair : result) {
			std::cout << pair.first + 1 << " " << pair.second + 1 << "\n";
		}
	}
	else {
		std::cout << -1 << std::endl;
	}
}

Measured memory_bytes: 9724
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using pll = pair<ll,ll>;
using Graph = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i,l,r) for(ll i = (l); i <= (ll)(r); i++)
#define rep3(i,l,r) for(ll i = (l); i >= (ll)(r); i--)
#define dup(x,y) (((x)+(y)-1)/(y)) // x/yの除算の切り上げ
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; }
const int inf = 1001001001;
const ll INF = 1LL << 60;
const ll mod = 1000000007; //1000000007
const ld pi = acos(-1);
 
//xor演算
//a^b=b^a
//a^(b^c)=(a^b)^c
//a^a=0
//a+b=a^b + 2(a&b)
//(4a)^(4a+1)^(4a+2)^(4a+3)=0
 
 
int main(){
 
    ios::sync_with_stdio(false);
    cin.tie(0);

    string s;
    cin >> s;
    ll n=s.size();
    ll dp[101010][5]={};
    dp[0][0]=1;
    rep2(i,0,n-1){
        rep2(j,0,3){
            if(s[i]=='?'){
                dp[i+1][j] = (dp[i][j]*3)%mod;
            }
            if(s[i]!='?'){
                dp[i+1][j] = dp[i][j]%mod;
            }
        }
            if(s[i]=='A'){
                dp[i+1][1] += dp[i][0]%mod;
            }
            if(s[i]=='B'){
                dp[i+1][2] += dp[i][1]%mod;
            }
            if(s[i]=='C'){
                dp[i+1][3] += dp[i][2]%mod;
            }
            if(s[i]=='?'){
                dp[i+1][1] += dp[i][0]%mod;
                dp[i+1][2] += dp[i][1]%mod;
                dp[i+1][3] += dp[i][2]%mod;
            }
        }
    cout << dp[n][3]%mod << endl;
}

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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, x, t;
    cin >> n >> x >> t;
    int res = n/x + (int)(n%x!=0);
    cout << (res * t) << '\n';
}


Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
int gr(int n,int k,int i)
{
	if (!i)
	return n/k;
	int j=(n/k-i+k)/k;
	return gr(n-j*k,k,(i+j*(k-1))%(n/k-j+1));
}
int main()
{
	int t,x=0;
	scanf("%d",&t);
	while (t--)
	{
		int n,k;
		scanf("%d%d",&n,&k);
		x^=gr(n-n%k,k,n%k);
	}
	printf(x? "Takahashi":"Aoki");
}

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

enum{
    RED=0,
    GREEN,
    BLUE
};

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;


int main(){
    int N;
    ULL num[3];
    ULL count;
    int i,j;
    int type = 0;
    string s;
    cin >> N;
    cin >> s;
    for(i=0;i<3;i++){
        num[i] = 0;
    }
    for(i=0;i<N;i++){
        if(s[i] == 'R'){
            num[RED]++;
        }else if(s[i] == 'G'){
            num[GREEN]++;
        }else{
            num[BLUE]++;
        }
    }
    count = num[0] * num[1] * num[2];
    for(i=0;i<N-2;i++){
        for(j=1;i + j * 2 < N;j++){
            if(s[i] != s[i+j] && s[i+j] != s[i+j*2] && s[i] != s[i+j*2]){
                count--;
            }
        }
    }
    cout << count << endl;
    return 0;
}


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

int cal(string s,string t){
	int z1=0,z2=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='0')z1++;
		if(t[i]=='0')z2++;
	}
	if(z1!=z2)return 1145141919;
	int cnt=0;
	for(int i=0;i<s.size();i++){
		int p=i;
		for(;t[p]!=s[i];p++);
		for(;p>i;p--){
			swap(t[p],t[p-1]);
			cnt++;
		}
	}
	
	return cnt;
}

int main(){
	
	
	string s="",s1="",s2="";
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		char c;
		cin>>c;
		s+=c;
	}
	for(int i=0;i<m;i++){
		int k;cin>>k;
		for(int j=0;j<k;j++){
			s1+=(i%2+'0');
			s2+=((i+1)%2+'0');
		}
	}
	
	cout<<min(cal(s,s1),cal(s,s2))<<endl;
	
	return 0;
}


Measured memory_bytes: 1216
#include<iostream>

using namespace std;

#define BLANK -1

int main(){
	int w, h;
	
	while(cin >> w >> h && w && h){

		int dp[h][w];
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				dp[i][j] = BLANK;		
			}
		}

		int n, x, y;
		cin >> n;
		for(int i = 0; i < n; i++){
			cin >> y >> x;
			dp[x-1][y-1] = 0;	
		}

		int init = 1;
		for(int i = 0; i < w; i++){
			if(dp[0][i] == 0) init = 0;
			dp[0][i] = init;
		}
		init = 1;
		for(int i = 0; i < h; i++){
			if(dp[i][0] == 0) init = 0;
			dp[i][0] = init;
		}


		for(int i = 1; i < h; i++){
			for(int j = 1; j < w; j++){
				if(dp[i][j] == BLANK) dp[i][j] = dp[i-1][j] + dp[i][j-1];
			}
		}

		cout << dp[h-1][w-1] << endl;
	}
}

Measured memory_bytes: 1160
#include<iostream>
#include<cmath>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int N, M;
    cin >> N >> M;
    int a[N], b[N], c[M], d[M];
    rep(i,N) cin >> a[i] >> b[i];
    rep(i,M) cin >> c[i] >> d[i];
    for(int i=0; i<N; i++){
        int min=2000000000;
        int ans;
        for(int j=0; j<M; j++){
            int x=abs(a[i]-c[j]);
            int y=abs(b[i]-d[j]);
            int tmp=x+y;
            if(tmp<min){
                min=tmp;
                ans=j+1;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/abc154/tasks/abc154_e

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

string S,T;

string ans = "Yes";

void solve(){
	for(int i=0;i<S.size();i++){
		if(S[i]!=T[i]){
			ans = "No";
			return;
		}
	}
}

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

    solve();

	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
#define forna(i,a,n) for(int i=a;i<n;i++)
typedef long long int lli;
using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli t,n,m;
cin>>n>>m;
cout<<n*m<<endl;
}


Measured memory_bytes: 3640
D=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(D)]
for i in range(D):
  a=10**9
  b=0
  for j in range(26):
    if a>=(s[i][j]-c[j]*(D-i-1)):
      a=s[i][j]-c[j]*(D-i-1)
      b=j
  print(j+1)

Measured memory_bytes: 9204
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		long input[] = new long[n];
		long ball[] = new long[200001];
		

		for(int i = 0; i < n; i++){
			input[i] = scan.nextLong()-1;
		}
		
		Arrays.fill(ball, 0);
		for(int i = 0; i < n; i++){
			ball[(int)input[i]] ++;
		}
		
		long sum = 0;
		
		for(int i = 0; i < 200001; i++){
			long x = ball[i];
			sum += (x*(x-1))/2; 
		}

		for(int i = 0; i < n; i++){
			long x = input[i];
			long y = ball[(int) x];
			long z = Math.max(y - 1, 0);
			System.out.println(sum - ((y * (y - 1))/2) + ((z * (z - 1))/2));
		}
	}
}

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

int main()
{
	int64_t n, mod = 1000000007;
	cin >> n;
	vector<vector<int>> as(n, vector<int>(n));
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			cin >> as[i][j];
		}
	}
	vector<int64_t> dp(1 << n, 0);
	dp[0] = 1;
	for (int i = 0; i < (1 << n); i++)
	{
		int j = __builtin_popcount(i);
		for (int k = 0; k < n; k++)
		{
			if ((i >> k) & 1)
			{
				continue;
			}
			if (as[k][j])
			{
				(dp[i | (1 << k)] += dp[i]) %= mod;
			}
		}
	}
	cout << dp[(1 << n) - 1] << endl;
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> vec1(n);
  vector<int> vec2(n);
  for (int i = 0; i < n; i++){
    cin >> vec1.at(i);
  }
  vec2 = vec1;
  
  int sum = 0;
  
  sort(vec2.begin(), vec2.end());
  
  for (int i = 0; i < n; i++){
    if (vec1.at(i) != vec2.at(i)){
      sum++;
    }
  }
  if (sum == 0 || sum == 2){
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

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

using namespace std;

int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    vector< vector<char> > C(H, vector<char>(W));

    for(int i=0;i<H;++i){
        for(int j=0;j<W;++j){
            cin >> C[i][j];
        }
    }

    int ans = 0;
    
    for(int i = 0; i < (1 << H); ++i){
        for(int j = 0; j < (1 << W); ++j){

            int count = 0;
            for(int h = 0; h < H; ++h){
                if((i >> h) & 1) continue;
                for(int w = 0; w < W; ++w){
                    if((j >> w) & 1) continue;
                    if(C[h][w] == '#') ++count;
                }
            }
            ans += (K == count);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________


	int n;
	string s;
	cin >> n >> s;
	if (n % 2 == 0 && s.substr(0, n / 2) == s.substr(n / 2, n / 2))
	{
		cout << "Yes" << en;
	}
	else
	{
		cout << "No" << en;
	}


	return 0;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a>b){
		for(int i=1;i<=a;i++) cout<<b;
	}
	else
	{
		for(int i=1;i<=b;i++) cout<<a;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid
/// ye tec khaphan ke yadam bemone : age jayi didi soale masir hamiltoni mikhad rasasho bokon yal oilery;https://mobomovie1.top/series/%D8%AF%D8%A7%D9%86%D9%84%D9%88%D8%AF-%D8%B3%D8%B1%DB%8C%D8%A7%D9%84-%D9%81%D8%B1%DB%8C%D9%86%D8%AC-fringe-2008-2013-%D8%A8%D8%A7-%D8%B2%D9%8A%D8%B1%D9%86%D9%88%D9%8A%D8%B3-%D9%81%D8%A7%D8%B1/
/// age ye ja mikhasti to dp az ozv i k ta entekhab koni bejash ye log bezan (nominal) hamoon 2**k va o 1 ent kon
const int N=2e5+100;
ll t[N];
ll x[N];
ll y[N];
int32_t main(){
    ll n;
    cin >> n;
    for (int i=1;i<=n;i++){
        cin >> t[i] >> x[i] >> y[i];
    }
    ll x1=0,y1=0,t1=0;;
    for (int i=1;i<=n;i++){
        ll z=abs(x[i]-x1)+abs(y[i]-y1);
        ll t2=t[i]-t1;
        if (z%2!=t2%2){
            cout <<"No" << endl;
            return 0;
        }
        if (z>t2){
            cout << "No" << endl;
            return 0;
        }
        t1=t[i];
        x1=x[i];
        y1=y[i];
    }
    cout << "Yes" << endl;
    return 0;

}



/*
7
1 2
2 3
3 4
4 5
3 6
6 7
3
1 5
5 5
6 4
*/













Measured memory_bytes: 3584
number = input()
list = number.split()


def hoge(a, b):
    if a * 4 < b:
        print("No")
        return
    else:
        for i in range(a):
            n = i + 1
            n2 = a - n
            if n * 2 + n2 * 4 == b:
                print("Yes")
                return
        else:
            if a * 4 == b:
                print("Yes")
                return
            print("No")


hoge(int(list[0]), int(list[1]))

Measured memory_bytes: 9196
n=int(input())
a=sorted([int(i) for i in input().split()])
m,k=n//3,0
for i in range(n):
  d=i%3*m+i//3
  if a[d]^a[(d+2*m)%n]!=a[(d+m)%n]:
    k=1
print(['Yes','No'][k])


Measured memory_bytes: 60784