akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <set>
#include <map>
#define ll long long
using namespace std;

ll arr[1111111];
int ccounts[1111111];
int mcounts[1111111];


ll Brute(const string& S, int k) {
    ll ans = 0;
    for(int i=0;i<S.size();i++) {
        if (S[i]=='D') {
            ll num_m = 0;
            for(int j=i;j<S.size();j++) {
                if (j-i>=k)
                    break;
                if (S[j]=='C')
                    ans += num_m;
                num_m += (S[j]=='M');
            }
        }
    }
    return ans;
}


int main() {
    int N;
    cin>>N;
    string S;
    cin>>S;

    // DMC
    
    // sum_{i : S[i]=D} sum_{j : i <= j <= i+k-1, S[j]=C} [mcounts[j]-mcounts[i]]
    //  sum_{i : S[i]=D} sum_{j : i <= j <= i+k-1, S[j]=C} mcounts[j]
    // -sum_{i : S[i]=D} mcounts[i] * sum_{j : i <= j <= i+k-1, S[j]=C}
    
    arr[0]=0;
    ccounts[0]=0;
    mcounts[0]=0;
    for(int i=0;i<N;i++) {
        mcounts[i+1]=mcounts[i]+ (S[i]=='M');
        ccounts[i+1]=ccounts[i]+(S[i]=='C');
        arr[i+1]=0;
        if (S[i]=='C') {
            arr[i+1] = mcounts[i+1];
        }
    }
    
    
    for(int i=1;i<=N;i++)
        arr[i]+=arr[i-1];
    
    
    //  sum_{i : S[i]=D} (arr[i+k-1]-arr[i])
    // -sum_{i : S[i]=D} mcounts[i] * (countsC(i,i+k-1))
    
    
    
    int Q;
    cin>>Q;
    for(int q=1;q<=Q;q++) {
        int k;
        cin>>k;
        
        ll ans = 0;
        for(int i=1;i<=N;i++) {
            if (S[i-1]=='D') {
                int en = min(i+k-1,N);
                ans += arr[en]-arr[i]-(ll)mcounts[i]*(ll)(ccounts[en]-ccounts[i]);
            }
        }
        cout << ans << endl;
        
    }
}

Measured memory_bytes: 17796
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0186
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int[] items = RIntAr();
                if (items[0] == 0) break;
            
                Console.WriteLine(BuyChicken(items));
            }
        }

        private static string BuyChicken(int[] items)
        {
            int minPurchaseCount = items[0];
            int budget = items[1];
            int priceAChick = items[2];
            int priceNChick = items[3];
            int stockAChick = items[4];

            for (int i = stockAChick ; i > 0 ; i--)
            {
                int costAChick = priceAChick * i;
                if (costAChick > budget) continue;

                int cntNchick = (budget - costAChick) / priceNChick;
                if (i + cntNchick >= minPurchaseCount)
                {
                    return i.ToString() + " " + cntNchick.ToString();
                }
            }
            return "NA";
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 13852
#include <stdio.h>
int min(int a, int b) { return (a < b) ? a : b; }
void MRoy() {
    int n, b[111];
    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++) scanf("%d", b + i);
    b[n - 1] = b[n - 2];
    
    int Ans = b[0];
    for (int i = 1; i < n; i++) {
        Ans += min(b[i], b[i - 1]);
    }
    printf("%d\n",Ans);
}
int main() {
    MRoy();
    return 0;
}

Measured memory_bytes: 128
pub mod io {
    use std::io;

    pub fn read_line() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }

    pub trait Read {
        fn read(s: &str) -> Self;
    }

    macro_rules! def_read {
        ($t: ty) => {
            impl Read for $t {
                fn read(s: &str) -> $t {
                    s.parse().unwrap()
                }
            }
        }
    }

    def_read!(i32);
    def_read!(i64);
    def_read!(isize);
    def_read!(usize);
    def_read!(f64);

    impl<T: Read> Read for Vec<T> {
        fn read(s: &str) -> Self { s.split_whitespace().map(|w| T::read(w)).collect() }
    }

    macro_rules! def_read_tuple {
        ($($t: ident),*) => {
            impl<$($t : Read + Default),*> Read for ($($t),*) {
                fn read(s: &str) -> Self {
                    let ws = s.split_whitespace().collect::<Vec<_>>();
                    let mut i = 0;
                    ( $({i += 1; $t::read(ws[i - 1])}),* )
                }
            }
        };
    }

    def_read_tuple!(T0, T1);
    def_read_tuple!(T0, T1, T2);
    def_read_tuple!(T0, T1, T2, T3);
    def_read_tuple!(T0, T1, T2, T3, T4);

    pub fn readln<T: Read>() -> T { T::read(&read_line()) }
}

fn main() {
    let (n, m) = io::readln();

    let inf = 0x10000000;

    let mut g = vec![vec![inf; n]; n];

    for _ in 0..m {
        let (a, b, c): (usize, usize, i32) = io::readln();
        g[a-1][b-1] = c;
        g[b-1][a-1] = c;
    }

    let og = g.clone();

    for k in 0..n {
        for i in 0..n {
            for j in 0..n {
                g[i][j] = std::cmp::min(g[i][j], g[i][k] + g[k][j]);
            }
        }
    }

    let mut ans = 0;

    for i in 0..n {
        for j in i+1..n {
            if og[i][j] < inf && og[i][j] > g[i][j] {
                ans+=1;
            }
        }
    }

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


Measured memory_bytes: 508
/*      ###########################
        #  Author : Pranay Garg   #
        #  College : SGSITS       #
        ###########################
*/      
#include<bits/stdc++.h>
#define ll long long int
#define ironman ios_base::sync_with_stdio(false);cin.tie(NULL);
#define MOD 1000000007  
#define endl '\n'
#define INF 1e18L+1
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
using namespace std;
template<class T> T max(T a, T b, T c) {
    return max(a, max(b, c));
}
template<class T> T min(T a, T b, T c) {
    return min(a, min(b, c));
}
void fastio()
{
    ironman
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
            freopen("error.txt","w",stderr);
    #endif
}
bool prime[100005];
void SieveOfEratosthenes(ll n)//O(nloglogn) 
{  
    memset(prime, true, sizeof(prime)); 
  
    for (ll p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (ll i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
}  
bool isPrime(ll n)//O(sqrt(n))
{
    if(n<2)
        return false;
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
            return false;
    return true;
}
std::vector<ll> factors(ll n)//O(sqrt(n))
{
    std::vector<ll> f;
    for(ll i=2;i*i<=n;i++)
    {
        while(n%i==0)
        {
            f.push_back(i);
            n = n/i;
        }
    }
    if(n>1) f.push_back(n);
    return f;
}
ll gcd(ll a,ll b)//O(logn)
{
    if(!b) return a;
    return gcd(b,a%b);
}
ll modpow(ll x,ll n,ll m)//O(logn)// used for calculating (x^n)%m
{
    if(n==0) return 1%m;
    ll u = modpow(x,n/2,m);
    u = (u%m * u%m)%m;
    if(n%2==1)
        u = (u%m * x%m)%m;
    return u%m;
}
ll eulerstotientfunction(ll n)//O(sqrt(n))
{
    ll ans = n;
    for(ll i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            while(n%i==0)
                n = n/i;
            ans -= ans/i;
        }
    }
    if(n>1)
        ans -= ans/n;
    return ans;
}
ll modinverse(ll x,ll m)//O(logn)
{
    ll temp = eulerstotientfunction(m);
    return modpow(x,temp-1,m);
}
ll ncr(ll n,ll k)
{
    ll res = 1;
    k = min(k,n-k);
    for(ll i=0;i<k;i++)
    {
        res *= (n-i);
        res /= (i+1);
    }
    return res;
}
ll count(ll n)
{
    string str = to_string(n);
    return str.length();
}
int main()
{
    //fastio();
    ll n,ans = 0;
    cin >> n;
    for(ll i=1;i<=n;i++)
        if(count(i)%2!=0) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <complex>
#include <cmath>
using namespace std;
#define rep(i,p) for(int i=0;i<p;i++)
typedef complex<double> xy_t;

// ??????: a.x*b.x
double dot_product(xy_t a, xy_t b) { 
  return (conj(a)*b).real(); 
}
// ??????: a.x*b.y - b.x*a.y
// ????§???¢????¬????????????¢????????????
double cross_product(xy_t a, xy_t b) { 
  return (conj(a)*b).imag(); 
}
// ?????±: ????????¨ p ??????????????´?????? b ????????±
xy_t projection(xy_t p, xy_t b) { 
  return b*dot_product(p,b)/norm(b); 
}
xy_t P[120];
int main() {
  int N;
  double x,y;
  cin >> N;
  rep(i,N) {
    cin >> x >> y;
    P[i] = xy_t(x,y);
  }
  // ??¢????¨????
  double sum = 0.0;
  for (int i=0; i+2<N; ++i) {
    xy_t a=P[0], b=P[i+1], c=P[i+2];
    // ????§???¢ abc ?????¢??????????¨?
    sum += cross_product(c-a,c-b)/2;
  }
  printf("%.1f\n", abs(sum));
}

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

int main(){
  int a, b, c, ans = 0;
  std::cin >> a >> b >> c;
  for (int i = a; i <= b; i++) {
    if(c%i == 0)ans++;
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 1160
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    x,y=map(int, input().split())
    ans=0
    if x==3:
        ans+=100000
    elif x==2:
        ans+=200000
    elif x==1:
        ans+=300000
    if y==3:
        ans+=100000
    elif y==2:
        ans+=200000
    elif y==1:
        ans+=300000
    if x==1 and y==1:
        ans+=400000
    print(ans)

resolve()

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int N;
  string S;

  cin >> N >> S;

  int ans = 1;
  for (int i = 1; i < N; i++) {
    if (S[i - 1] != S[i]) {
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${@o!EW0y47~@)KM*bkB#mP=*bap;U;7hXFenmZ3y~#3lACp3KUz{#x5ad^$@lm~KJgBu3UP``hZZz9{lt6h#BR4<-7O(ygq|e+mdc0jnGJSCCaj4VA~%sW+6u0jRww3O<6zDA=8**zaqqaekYr$H8r>_^cw|Ma24-DkJPIq(??cqb`BsqxS~%Is$RGw3m+pz{fJ^Y|x#NCjykTc=N1z6Tb0E~{tdAsN^#`PRK@qLL5puX*35jRGKM}owM6W)#_V&+Yn3}=43Jf1H(0B+{!6;{YrQ7ui=p;?LQ)nInP+7^(hoX%#5zO{IH^(FT9uvarlsGL2^E43X*8dUaSR<!SGUF2z)L;ApWCxzhhtT5@dNS69&9+#VJ#WZwt~KhLdCt?mES+ycl*-=l9-|nzuZc*y=i>6*fKX<${c2X4rv?EXJmmCsP#WQ|aPCB45#B84I}`E~emv6Nc;uINWL6V!4~GZX5ob@F40?<cJ-1l&rOH1&58O*CG<Z#Kl^UM?pxseKEwkr*ohRuI+tMdBlYq8NzNx;+U#6--HtG3FRTeEnAT4oAguDSC80*zPdcGcc")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 10768
import sys
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return str(input())
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    S = IS()

    ans = "Yes"
    if S[0] == S[1] and S[1] == S[2]:
        ans = "No"
    
    print(ans)


if __name__ == '__main__':
    main()


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repab(i, a, b) for (int i = a; i <= (int)(b); i++)
#define ll long long
#define vec vector
#define pb push_back
#define ft first
#define sd second
#define all(vec) vec.begin(), vec.end()
#define endl "\n"

typedef pair<int, int> P;

const int MOD = 1e9 + 7;
const int INF = 1001001001;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};

//--//--//--//--//--//--//--//--//--//--//--//

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

  int same = 0;
  bool ok = false;
  rep(i, n){
    int d1, d2;
    cin >> d1 >> d2;
    if(d1 == d2){
      same++;
    }
    else{
      same = 0;
    }
    if(same == 3){
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

using pint = P<ll,ll>;

ll n;
vector<vector<ll>> v;
map<pint,ll> mp;
ll dis[100010];

void dfs(ll from, ll node, ll predis){
  dis[node] = predis + mp[{from,node}];
  for(ll e:v[node]){
    if(e == from)continue;
    dfs(node,e,dis[node]);
  }
}

int main(){
  cin >> n;
  v = vector<vector<ll>>(n);
  for(ll i = 0; i < n-1; ++i){
    ll a,b,c; cin >> a >> b >> c; a--; b--;
    v[a].push_back(b);
    v[b].push_back(a);
    mp[{a,b}] = c;
    mp[{b,a}] = c;
  }
  ll q,k; cin >> q >> k; k--;
  dfs(k,k,0);
  for(ll i = 0; i < q; ++i){
    ll x,y; cin >> x >> y; x--; y--;
    cout << dis[x] + dis[y] << endl;
  }
  return 0;
}


Measured memory_bytes: 29952
#include<cstdio>
using namespace std;
int main()
{
	double sum;
	int i,n,cnt;
	scanf("%d",&n);
	cnt=0;
	for(i=1;i<=n;i++)	if(i%2!=0)	cnt++;
	sum=(double)cnt/n;
	printf("%7f\n",sum);
	return 0;
}

Measured memory_bytes: 128
N = int(input())
Z = list(map(int,input().split()))
A = []
for i in range(N):
  A.append([Z[i],i])
MIN = min(A)
MAX = max(A)
#print(A,MAX,MIN)
#print(MIN,MAX)
ans = []
num = 0
if abs(MIN[0]) > abs(MAX[0]):
  Flag = False
  minloc = MIN[1]
  for i in range(N):
    #print(minloc+1,i+1) #1indexにして出力
    ans.append((minloc+1,i+1))
    num += 1
    A[i][0] += MIN[0]
else:
  Flag = True
  maxloc = MAX[1]
  for i in range(N):
    #print(maxloc+1,i+1)
    ans.append((maxloc+1,i+1))
    num +=1
    A[i][0] += MAX[0]

for i in range(N-1):
  if Flag == True:
    ans.append((i+1,i+2))
  else:
    ans.append((N-i,N-1-i))
  num+=1
print(num)
for i in range(len(ans)):
  print(*ans[i])



Measured memory_bytes: 3064
//#include <bits/stdc++.h>
#include<iostream>
#include<utility>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<cfloat>
#include<functional>
#include<string>
#include<numeric>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<chrono>
#include<cctype>
#include<iterator>
#include<bitset>
#include<locale>
#include<chrono>
#include<ctime>
#include<cstring> // for memset
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define all(x) x.begin(),x.end()
#define clr(v,val) memset(v,val,sizeof(v))
#define rep(i,m,n) for(int i=m ; i<n ; i++)
#define forr(i,m,n) for(int i=m ; i<=n ; i++)
#define endl '\n'
#define pb push_back
#define pff push_front
#define re return
#define bit __builtin_popcountll
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int N = 2e5 + 5;
const ll mod = 1e9 + 7;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int main() {
	IO;
	int n; cin >> n;
	string s, ans = ""; cin >> s;
	rep(i, 0, s.size()) {
		int idx = s[i] - 'A';
		ans.pb(char((idx + n) % 26)+'A');
	}
	for (auto i : ans)
		cout << i;

}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int n, i, j;
	int sum = 0;
	int l[200];

	scanf("%d", &n);

	for (i = 0; i < 2 * n; i++) scanf("%d", &l[i]);

	for (i = 0; i < 2 * n; i++) {
		for (j = 2 * n - 1; j > i; j--) {
			if (l[i] > l[j]) {
				int tmp;
				tmp = l[i];
				l[i] = l[j];
				l[j] = tmp;
			}
		}
	}

	for (i = 0; i < 2 * n; i += 2) {
		sum += l[i];
	}

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

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

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

Measured memory_bytes: 256
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define f first 
# define s second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)

using namespace std;

template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

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

const int inf=1e9,mod=1e9+7,N=2e5+5;

void solve(){
	int n;
	cin>>n;
	vector<int>a(n);
	rep(i,n){
		cin>>a[i];
	}
	sort(all(a));
	int ans=0;
	forn(i,1e5){
		if((lb(all(a),i)-a.begin())*2==n){
			ans++;
		}
	}
	cout<<ans;
}

int main(){
 	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)solve();
}

Measured memory_bytes: 3680
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long a = 500000000000l;
  string S;
  long K;
  cin >> S >> K;
  long pos = K;
  rep (i, S.size()) {
    if (S[i] != '1') {
      pos = i;
      break;
    }
  }
  if (pos < K) {
    cout << S[pos] << endl;
  } else cout << 1 << endl;
}

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


Measured memory_bytes: 256
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Integer a[] = new Integer[N];
      	a[0] = 0;
        for (int i=1; i<N; i++) {
            a[i] = sc.nextInt();
        }
        
        int[] res = new int[N];
        
        for (int i = 1; i < N; i++){
            res[a[i] - 1]++;
        }
      
	    for (int i = 0; i < N; i++){
            System.out.println(res[i]);
        }
    }
}

Measured memory_bytes: 64936
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>
#include <set>
#include <numeric>

using namespace std;

template <typename T>
using TABLE = vector<vector<T>>;

using LONG = long long;
using LVEC = vector<long long>;

#define FOR(_i, s, e) for(_i = s; _i < e; ++_i)
#define FOR_INV(_i, s, e) for(_i = e - 1; _i >= s; --_i)

long long PRIME = 1e9 + 7;
long long PRIME2 = 998244353;


using pos = std::pair<LONG, LONG>;

int calcSum(int row, int col, int row_selection, int col_selection, vector<vector<int>>& c){
    int sum = 0;

    for(int y = 0; y < row; ++y){
        int cur_y = 1 << y;

        if((row_selection & cur_y) != 0){
            continue;
        }

        for(int x = 0; x < col; ++x){
            int cur_x = 1 << x;

            if((col_selection & cur_x) != 0){
                continue;
            }

            sum += c[y][x];
        }
    }
    return sum;
}


int colCheck(int row, int col, int row_selection, vector<vector<int>>& c, LONG K){
    int col_max = (1 << col) - 1;
    LONG i;

    int count = 0;
    FOR(i, 0, col_max){
        if(calcSum(row, col, row_selection, i, c) == K){
            ++count;
        }
    }

    return count;
}


int main(){
    LONG i, j, k;

    LONG W, H, K;
    cin >> H >> W >> K;

    vector<vector<int>> c(H, vector<int>(W, 0));
    FOR(i, 0, H){
        string s;
        cin >> s;
        FOR(j, 0, W){
            if(s[j] == '.'){
                c[i][j] = 0;
            }
            else{
                c[i][j] = 1;
            }
        }
    }

    int row_max = (1 << H) - 1;
    LONG sum = 0;

    FOR(i, 0, row_max){
        sum += colCheck(H, W, i, c, K);
    }

    cout << sum;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
  ifstream cin("in.txt");
#endif
  int a, b, c;
  while (cin >> a >> b >> c) {
    bool res = a == b && a == c;
    cout << (res ? "Yes" : "No") << endl;
  }
  return 0;
}


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

int main() {
 	int n;
	cin >> n;
	float a;
	float b;
	if(n % 2 == 0){
		a = n / 2;
	}else{
		a = n / 2 + 1;
	}
	b = a / n;
	cout << b << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <sstream>
#include <map>
#include <cstring>
#include <vector>
#include <queue>
#include <iomanip>
#include <stack>

using namespace std;
typedef long long ll;

ll ans, mx, sum, mn = 1e14, cnt;

ll ac,tle,wa,re;
int main(){
	ll n;
	cin>>n;
	string s[n];
	for(ll i=0; i<n; i++){
		cin>>s[i];
		if(s[i]=="AC") ac++;
		else if(s[i]=="WA") wa++;
		else if(s[i]=="TLE") tle++;
		else if(s[i]=="RE") re++;	
	}
	cout<<"AC x "<<ac<<endl;
	cout<<"WA x "<<wa<<endl;
	cout<<"TLE x "<<tle<<endl;
	cout<<"RE x "<<re<<endl;
	
}

Measured memory_bytes: 6752
#include <bits/stdc++.h>
 
using namespace std;
 
#define LL long long 
#define ULL unsigned long long 
#define LD long double 

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	string s;
	map<string, LL> mapa;
	LL w = 0;
	for(int i=0; i<n; i++) {
		cin>>s;
		sort(s.begin(), s.end());
		auto it = mapa.find(s);
		if(it!=mapa.end()) {
			w+=it->second;
			mapa[s] = it->second + 1;
		}
		else {
			mapa[s] = 1;
		}
	}
	cout<<w;
}


Measured memory_bytes: 11264
import java.util.Scanner;


public class Main {
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		sc.close();

		String ab = a + b;
		int value = Integer.parseInt(ab);

		String ans = "No";

		for(int i = 4; i <= Math.sqrt(value); i++){
			if(i*i == value){
				ans = "Yes";
				break;
			}
		}

		System.out.println(ans);
	}
}


Measured memory_bytes: 25172
N, K = map(int, input().split())
Q = list(map(int, input().split()))
dp = [0 for _ in range(K + 1)]
for i in range(min(K + 1, N + 1)):
  for j in range(i + 1):
    if i != j:
      q = sorted(Q[: j] + Q[-(i - j): ], reverse = True)
    else:
      if i == 0:
        continue
      q = sorted(Q[: j], reverse = True)
    #print(i, j, q)
    k = 0
    while k < K - i:
      if len(q) == 0:
        break
      if q[-1] < 0:
        k += 1
        q.pop()
      else:
        break
    dp[i] = max(sum(q), dp[i])
#print(dp)
print(max(max(dp), 0))

Measured memory_bytes: 3064
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = int(input())
print(a[n-1])


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

int main(){
  int a ;
  cin>>a;
  
  vector<int> as;

  int m = 1;
  while(true){
    as.push_back(a);
     m++;
    if(a % 2== 0){
       a =  a / 2; 
    }
    else{
       a = a * 3 + 1;
    }
    
    
    for(auto ma : as){
      if(ma == a) {
        cout << m << endl;
        return 0;
      }
    }
  }
  
  return 0;
  
}


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

//-30 -10 10 20 50
//-9 -7 -4 -3 1 2 3 4

int main(){
    int N, K;
    cin >> N >> K;
    int x[N];
    for(int i = 0; i < N; i++){
        cin >> x[i];
    }

    long long ans = INT_MAX;
    // cout << ans << endl;
    for(int i = 0; i <=  N - K; i++){
        long long p1 = x[i];
        long long p2 = x[i + K - 1];

        if(p1 * p2 >= 0){
            ans = min(ans, max(abs(p1), abs(p2)));
        }
        else{
            ans = min(ans, abs(p2) + abs(p1) + min(abs(p1), abs(p2)));
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 640
N = int(input())
b = list(map(int, input().split()))
a_list = []
a_list.append(b[0])

for i in range(N-2):
    if b[i] > b[i+1]:
        a_list.append(b[i+1])
    
    else:
        a_list.append(b[i])

a_list.append(b[-1])

print(sum(a_list))

Measured memory_bytes: 3060
L = input()
MOD = 10 ** 9 + 7
N = len(L)

s = 0
ret = 0
for k, v in enumerate(L) :
    if v == '1' :
        ret += pow(2, s, MOD) * pow(3, N-k-1, MOD)
        ret %= MOD
        s += 1

ret += pow(2, s, MOD)

print(ret % MOD)

Measured memory_bytes: 39664
while True:
    a, b = map(int, input().split(' '))
    min_ab = 0
    max_ab = 0
    if a == 0 and b == 0:
        break
    else:
        min_ab = min(a, b)
        max_ab = max(a, b)
    print(str(min_ab) + ' ' + str(max_ab))


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

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int main() {
  int N, M, K;
  cin >> N >> M >> K;
  UnionFind uf(N);
  vector<int> ans(N);
  while(M--) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    uf.unite(a, b);
      --ans[a];
      --ans[b];
    // cerr << "ans[" << a <<"]=" << ans[a] << endl;
    // cerr << "ans[" << b << "]=" << ans[b] << endl;
  }
  vector<vector<int>> to(N);
  while(K--) {
    int c, d;
    cin >> c >> d;
    --c; --d;
    to[c].push_back(d);
    to[d].push_back(c);
  }
  
  rep(i, N) {
    int x = uf.size(i);
    // cerr << "x=" << x<< endl;
    // cerr << "i=" << i << endl;
    for (int c : to[i]) {
      // cerr << "c=" << c << endl;
      if (uf.same(c, i)) --x;
    }
    ans[i] += x-1;
  }

  rep(i, N) {
    cout << ans[i];
    if (i != N-1) cout << " ";
    else cout << endl;
  }
  return 0;
}


Measured memory_bytes: 9064
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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 T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



int A, B;
string str;


bool solve() {
  if (str.size() != A + B + 1) return false;
  for (int i = 0; i < str.size(); ++i) {
	if (str[i] == '-') str[i] = ' ';
  }
  istringstream sin(str);
  vector<int> vec;
  string tmp;
  while (sin >> tmp) {
	vec.push_back((int)tmp.size());
  }

  //COUT(vec);
  
  if (vec.size() != 2) return false;
  if (vec[0] != A) return false;
  if (vec[1] != B) return false;

  return true;
}
		


int main() {
  while (cin >> A >> B >> str) {
	if (solve()) puts("Yes");
	else puts("No");
  }
}


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

using namespace std;

int J[1005][1005] = {};
int O[1005][1005] = {};
int I[1005][1005] = {};
int tate, yoko;
int n;
int main()
{
	cin >> tate >> yoko;
	cin >> n;

	for (int i = 1; i <= tate; i++)
	{
		string hoge;
		cin >> hoge;
		for (int k = 1; k <= yoko; k++)
		{
			switch (hoge[k-1])
			{
			case'J':
				J[i][k]++;
				break;
			case'O':
				O[i][k]++;
				break;
			case'I':
				I[i][k]++;
				break;
			}
		}
		for (int k = 1; k <= yoko+1; k++)
		{
			J[i][k] += J[i][k - 1];
			O[i][k] += O[i][k - 1];
			I[i][k] += I[i][k - 1];
		}
		
	}

	while (n--)
	{
		int x1, x2, y1, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		int jun = 0, oce = 0, ice = 0;
		for (int i = x1; i <= x2; i++)
		{
			jun += J[i][y2] - J[i][y1-1];
			oce += O[i][y2] - O[i][y1 - 1];
			ice += I[i][y2] - I[i][y1 - 1];
		}
		cout << jun <<" "<<oce<<" "<<ice<< endl;
	}

}

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

int main() {
	
	string s; cin >> s;
	const int p = 26;
	vector<int> num(p, 0);
	for (int i = 0; i < s.size(); i++) {
		num[s[i] - 'a']++;
	}
	bool beautiful = true;
	for (int i = 0; i < p; i++) {
		if (num[i] % 2 != 0) beautiful = false;
	}
	if(beautiful) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3600
#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;
	cin >> n;
	while (n--) {
		string order,s;
		cin >> order >> s;
		REP(i,order.length()) {
			string s2,s3;
			switch (order[order.length()-1-i])
			{
			case 'C':
				s2 = s.substr(1, s.length() - 1);
				s = s2 + s[0];
				break;
			case 'J':
				s2 = s.substr(0,s.length() - 1);
				s = s[s.length()-1]+s2;
				break;
			case 'E':
				s2 = s.substr(0, s.length() / 2);
				s3 = s.substr(s.length() - s.length() / 2, s.length() / 2);
				if (s.length() % 2 == 0)
					s = s3 + s2;
				else
					s = s3 + s[s.length() / 2] + s2;
				break;
			case 'A':
				REP(j, s.length() / 2)
					swap(s[j], s[s.length() - 1 - j]);
				break;
			case 'M':
				REP(j, s.length())
					if (isdigit(s[j]))
						s[j] = (((s[j] - '0') + 11) % 10) + '0';
				break;
			case 'P':
				REP(j, s.length())
				if (isdigit(s[j]))
					s[j] = (((s[j] - '0') + 19) % 10) + '0';
				break;
			}
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s; cin >> s;
	string hitachi = "";
	for (int i = 1; i <= 5; i++) {
		hitachi += "hi";
		if (hitachi == s) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define L 100005

typedef struct pp{
  char name[100];
  int t;
  }P;

P Q[L];
int head, tail, n;

void enqueue(P);
  P dequeue();
  int min(int,int);


int main(){
  int e=0,c;
  int i,q;
  P u;
  scanf("%d %d",&n,&q);
  for(i=1;i<=n;i++){
    scanf("%s",Q[i].name);
    scanf("%d",&Q[i].t);}
  head=1; tail=n+1;

  while(head!=tail){
    u=dequeue();
    c=min(q,u.t);
    u.t-=c;
    e+=c;
    if(u.t>0)
      enqueue(u);
    else{

      printf("%s %d\n",u.name,e);

    }
    }
  return 0;}
void enqueue(P x){
  Q[tail]= x;
  tail=(tail+1)%L;}

P dequeue(){
  P x =Q[head];
  head=(head+1)%L;
  return x;}

int min(int a, int b)
{return a<b ? a:b;}



Measured memory_bytes: 12744
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( stdin . lock ( ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        a: u64, b: u64, c: u64, d: u64
    }
    println!("{}", cnt(b,c,d) - cnt(a-1,c,d));
}

fn cnt(n: u64, c: u64, d: u64) -> u64 {
    n - (n / c + n / d - n / lcm(c,d))
}

#[allow(dead_code)]
pub fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
#[allow(dead_code)]
pub fn lcm(a: u64, b: u64) -> u64 {
    a / gcd(a, b) * b
}
#[allow(dead_code)]
#[doc = " ax + by = gcd"]
#[doc = " (gcd, x, y)"]
pub fn extgcd(a: i64, b: i64) -> (i64, i64, i64) {
    if b == 0 {
        (a, 1, 0)
    } else {
        let (gcd, x, y) = extgcd(b, a % b);
        (gcd, y, x - (a / b) * y)
    }
}

Measured memory_bytes: 4352
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;


int main(){
   int A[3][3];
   for(int i = 0; i < 3; i++){
       for(int j = 0; j < 3; j++){
           cin >> A[i][j];
       }
   }
   int N;
   cin >> N;
   int b[N];
   for(int i = 0; i < N; i++){
        cin >> b[i];
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(b[i] == A[j][k]){
                    A[j][k] = -1;
                }
            }
        }
   }
   int ans = 0;
   int cnt = 0;
   for(int i = 0; i < 3; i++){
       for(int j = 0; j < 3; j++){
           if(A[i][j] == -1) cnt++;
       }
       if(cnt == 3) ans++;
       cnt = 0;
   }
   for(int i = 0; i < 3; i++){
       for(int j = 0; j < 3; j++){
           if(A[j][i] == -1) cnt++;
       }
       if(cnt == 3) ans++;
       cnt = 0;
   }
   for(int i = 0; i < 3; i++){
       if(A[i][i] == -1) cnt++;
   }
   if(cnt == 3) ans++;
   cnt = 0;
   for(int i = 0; i < 3; i++){
       if(A[i][2-i] == -1) cnt++;
   }
   if(cnt == 3) ans++;

    if(ans > 0){
        cout << "Yes" << endl;
    } else cout << "No" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define all(v) v.begin(),v.end()
#define pb push_back
#define rep(p,a,b) for(ll p=a ; p<b ; p++)
#define F first
#define S second
using namespace std;


int main()
{
    ll t,i,j,k,ans,n;

    //cin>>t;
    t=1;
    while(t--)
    {
        
        cin>>k;
        if(k>=30)cout<<"Yes";
        else cout<<"No";
    }
    
    return 0;
}


Measured memory_bytes: 3620
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

c = [input() for _ in range(3)]
print(c[0][0], end ="")
print(c[1][1], end ="")
print(c[2][2])

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

#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define in(v) cin>>v;
#define out(v) cout<<v<<"\n"

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int N, M, X, Y;
  in(N); in(M);
  in(X); in(Y);

  int max_x = -100, min_y = 100;
  rep(i, N) {
    int x; in(x);
    max_x = max(max_x, x);
  }
  rep(i, M) {
    int y; in(y);
    min_y = min(min_y, y);
  }
  loop(z,X+1,Y+1)
    if (max_x < z && min_y >= z) {
      out("No War");
      return 0;
    }

  out("War");

  return 0;
}


Measured memory_bytes: 256
n,m=[int(x) for x in input().split()]
arrays=[]
bectors=[]
for s in range(n):
	arrays.append([int(x) for x in input().split()])

for p in range(m):
	bectors.append(int(input()))
	# bectors.append([int(x) for x in input().split()])



for v in arrays:
	_sum_=0
	for i,x in enumerate(v):
		_sum_+=x*bectors[i]

	print(_sum_)



Measured memory_bytes: 6008
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

#define ll long long 
#define N 200010

using namespace std;

ll a[N],len;
ll ans = 0x3f3f3f3f;
ll sum[N],f[N][3];

inline bool check() {
	for(int i = 1; i <= len;++i)
	if(a[i] != 0) return false;
	return true;
}

int main() {
	memset(f,0x7f,sizeof(f));
	scanf("%lld",&len);
	for(int i = 1 ; i <= len ; ++i) {
        scanf("%lld",&a[i]);
        sum[i] = sum[i - 1] + a[i];
    }
	f[0][0] = f[0][1] = f[0][2] = 0;
	if(check()) {
		puts("0");
		return 0;	
	}
	for(int i = 1 ; i <= len ; ++i) {
		int flag1,flag2;
		if(a[i] & 1) flag1 = 1,flag2 = 0;
		else flag1 = 0,flag2 = 1;
		if(a[i] == 0) flag1 = 2,flag2 = 1;
		f[i][0] = min(f[i - 1][0] + flag1,min(f[i][0],sum[i - 1] + flag1));
		f[i][2] = min(min(f[i - 1][2] + flag2,sum[i - 1] + flag2),min(f[i - 1][0] + flag2,f[i][2]));
		f[i][1] = min(min(f[i - 1][1],f[i - 1][2]) + flag1,min(f[i][1],sum[i - 1] + flag1));
		ans = min(ans,min(f[i][1],min(f[i][0],f[i][2])) + sum[len] - sum[i]);
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 8064
N = int(input())
X = [[] for i in range(N)]
for i in range(N):
  A = int(input())
  for j in range(A):
    X[i].append(list(map(int, input().split())))
ans = 0
for s in range(1 << N):
  #1:TRUE, 0:UNKNOWN
  state = [(s >> j) & 1 for j in range(N)]
  f = 0
  for i in range(N):
    if state[i] == 0:
      continue
    for x in X[i]:
      if state[x[0]-1] != x[1]:
        f = 1
        break
    if f == 1:
      break
  if f == 0:
    ans = max(ans, sum(state))
print(ans)

Measured memory_bytes: 74328
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <iterator>
#include <climits>
#include <unordered_map>
#include <queue>


#define rep(i, n) for(int i = 0, end = (int)(n); i < end; i++)

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

inline int ctoi(char c) {
    return (int)(c -'0');
}

// ----------------------------------------------------------

int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 2; i <= n; i+=2) {
        for(ll j = 1; j <= n; j += 2) {
            ++ans;    
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanInit()

	n := nextInt()
	s := nextStr()
	t := nextStr()

	run := 0
	for i := 1; i <= n; i++ {
		if s[n-i:] == t[:i] {
			run = i
		}
	}

	fmt.Println(2*n - run)
}

// ---- readfunc
var sc = bufio.NewScanner(os.Stdin)

func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1776
#include <iostream>
#include <stdio.h>
using namespace std;
main(){
  long N,K,S;
  cin>>N>>K>>S;
  if(K){
  cout<<S;
  for(long i=0;i<K-1;i++)printf(" %ld",S);
  if(S>1000000)for(long i=0;i<N-K;i++)printf(" 1");
  else for(long i=0;i<N-K;i++)printf(" %ld",S+1);
  }else{
  if(S>1000000)for(long i=0;i<N;i++)printf(" 1");
  else for(long i=0;i<N;i++)printf(" %ld",S+1);
  }
}

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

const int INF = 1001001001;
typedef long long ll;
typedef pair<int,int> pint;

int dist[101010];
int k;
int bfs(){
    deque<pint> q;
    q.push_back({1,1});
    dist[1] = 1;
    while(!q.empty()){
        pint p = q.front();
        q.pop_front();
        //現在地
        int now = p.first;
        //現在地までのコスト
        int d = p.second;
        int next = (now+1)%k;
        if(dist[next] > d+1){
            dist[next] = d+1;
            q.push_back({next,d+1});
        }
        next = (now*10) % k;
        if(dist[next] > d){
            dist[next] = d;
            q.push_back({next,d});
        }
    }
    return dist[0];

}

int main(){
    
    cin >> k;
    rep(i,k){
        dist[i] = INF;
    }
    cout<<bfs()<<endl;
    

    

}

Measured memory_bytes: 1024
// 写経

//----------------------------templates
    #pragma GCC optimize ("Ofast")
    #pragma GCC target ("tune=native")
    #pragma GCC target ("avx")
    //----------------------------
    #include <bits/stdc++.h>
    using namespace std;

    typedef long long ll;
    typedef unsigned long long ull;
    #define int ll

    #define FOR(i,j,n) for (int i=(int)(j);i<(n);i++)
    #define REP(i,n) for (int i=0;i<(int)(n);i++)
    #define REPS(i,n) for (int i=1;i<=(int)(n);i++)
    #define REPN(i,n) for (int i=(int)(n)-1;i>=0;i--)
    #define REPNS(i,n) for (int i=(int)(n);i>0;i--)

    #define I(n) scanf("%lld", &(n))
    #define LL(n) scanf("%lld", &(n))
    #define pb(n) push_back((n))
    #define mp(i,j) make_pair((i),(j))
    #define eb(i,j) emplace_back((i),(j))
    #define y0 y3487465
    #define y1 y8687969
    #define j0 j1347829
    #define j1 j234892
    #define uniq(v) v.erase( unique(v.begin(), v.end()), v.end() )

    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())

    typedef vector<int> vi;
    typedef pair<int,int> pi;
    typedef vector<pi> vpi;
    typedef vector<vi> vvi;
    typedef vector<vpi> vvpi;
    typedef vector<vvi> vvvi;

    const int mod = 1000000007;

//--------------------------------------------

class RollingHash{
    const ull MASK30 = (1UL << 30) - 1;
    const ull MASK31 = (1UL << 31) - 1;
    const ull MOD = (1UL << 61) - 1;
    const ull POSITIVIZER = MOD * ((1UL << 3) - 1);
    uint32_t base;
    ull powMemo[10001];
    vector<ull> hash;

    void init(){
        random_device rng;
        base = rng();
        while (base <= 256) base = rng();

        powMemo[0] = 1;
        REP(i,10000) powMemo[i+1] = calcMod(mul(powMemo[i], base));
    }
    ull mul(ull l, ull r){
        ull lu = l >> 31;
        ull ld = l & MASK31;
        ull ru = r >> 31;
        ull rd = r & MASK31;
        ull middle = ld * ru + lu * rd;
        return ((lu * ru) << 1) + ld * rd + ((middle & MASK30) << 31) + (middle >> 30);
    }
    ull calcMod(ull val){
        val = (val & MOD) + (val >> 61);
        return val > MOD ? val - MOD : val;
    }

public:
    RollingHash(string s){
        init();
        hash.resize(s.length()+1);
        REP(i, s.length()) hash[i+1] = calcMod(mul(hash[i], base) + s[i]);
    }
    ull slice(int b, int l){
        return calcMod(hash[b+l] + POSITIVIZER - mul(hash[b], powMemo[l]));
    }
};

int n;
string s;
int ret;
signed main(){
    cin >> n;
    cin >> s;
    RollingHash rh(s);
    REP(i,s.length()) FOR(j,i,s.length())
        while(ret < j-i && j+ret < n && 
            rh.slice(i,ret+1) == rh.slice(j,ret+1)) ret++;
    cout << ret << endl;
}

Measured memory_bytes: 512