akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

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

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int prime[1000001];
int main()
{
    int n;
    cin >> n;
    vector<int> vi(n);
    REP(i, n)
    {
        cin >> vi[i];
    }
    int a = gcd(vi[0], vi[1]);
    FOR(i, 2, n)
    {
        a = gcd(a, vi[i]);
    }
    if (a != 1) {
        cout << "not coprime" << endl;
        return 0;
    }
    for (int i = 2; i < 1000001; i++) {
        if (prime[i] == 0) {
            for (int j = i; j < 1000001; j += i) {
                prime[j] = i;
            }
        }
    }
    set<int> si;
    REP(i, n)
    {
        set<int> si2;
        int a = vi[i];
        while (a != 1) {

            si2.insert(prime[a]);
            a /= prime[a];
        }
        for (auto x : si2){
            if (si.find(x) != si.end()) {
                cout << "setwise coprime" << endl;
                return 0;
            }
            si.insert(x);
        }
    }
    cout << "pairwise coprime" << endl;
}

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

using namespace std;
#define ll long long
#define dbug printf("I am here\n");
const int maxn = 2e5+100;

const ll inf = 1e18;
ll arr[maxn] , n , m;
vector< pair < ll , ll > > storing;
vector < ll > number;

int main()
{
    cin >> n >> m;
    for(int i = 1; i<=n; i++){
        ll p; cin >> p; number.push_back(p);
    }
    sort(number.begin(),number.end());
    for(int i = 1; i<=m; i++){
        ll u , v; cin >> u >> v;
        storing.push_back({v,u});
    }
    sort(storing.begin(),storing.end());
    reverse(storing.begin(),storing.end());
    ll cur = 0;
    for(auto v : storing){
        ll p1 = v.first , p2 = v.second;
        ll nex = cur + v.second;
        for(ll i = cur; i<min(n,nex); i++){
            if(number[i] < p1){
                number[i] = p1;
            }
        }
        cur = nex;
    }
    ll sum = 0;
    for(int i = 0; i<n; i++){
        sum += number[i];
    }
    cout << sum << endl;
    return 0;


}



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

int main() {
  string ss,st;
  cin>>ss>>st;
  int s[109],t[109];
  for(int i=0;i<ss.size();++i) s[i]=int(ss[i]);
  for(int i=0;i<st.size();++i) t[i]=int(st[i]);
  sort(s,s+ss.size());
  sort(t,t+st.size(),greater<int>());
  
  bool ans=true;
  int i=0;
  while(i<ss.size() && i<st.size()){
    if(s[i]<t[i]){
      ans=true;
      break;
    }
    else if(s[i]>t[i]){
      ans=false;
      break;
    }
    else{
      if(i==st.size()-1){
        ans=false;
        break;
      }
    }
    i++;
  }
  
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
typedef long long ll;
typedef double dd;
#define For(i,j,k) for (int i=(int)j;i<=(int)k;++i)
#define Forr(i,j,k) for (int i=(int)j;i>=(int)k;--i)
#define Set(a,p) memset(a,p,sizeof(a))
using namespace std;

template<typename T>bool chkmax(T &a,T b) { return a<b?a=b,1:0; }
template<typename T>bool chkmin(T &a,T b) { return a>b?a=b,1:0; }

const int maxn=3e5+1e2;
int n;
int Ans;
int a[maxn];

inline void file() {
	freopen("ARC100E.in","r",stdin);
	freopen("ARC100E.out","w",stdout);
}

inline int read() {
	int x=0,p=1;
	char c=getchar();
	while (!isdigit(c)) { if (c=='-') p=-1; c=getchar();}
	while (isdigit(c)) { x=(x<<1)+(x<<3)+(c-'0'); c=getchar();}
	return x*p;
}

int main() {
//	file();
	n=read();
	For (i,0,(1<<n)-1) a[i]=read();
	For (i,1,(1<<n)-1) {
		int max1=0,max2=0;
		for (int j=i;;j=(j-1)&i) {
			if (a[j]>max1) max2=max1,max1=a[j];
			else if (a[j]>max2) max2=a[j];
			if (!j) break;
		}
		chkmax(Ans,max1+max2);
		printf("%d\n",Ans);
	}
//	cerr << clock() << endl;
	return 0;
}

Measured memory_bytes: 4096
N, T = map(int,input().split())
t = list(map(int, input().split()))

t.append(t[-1] + T)

ans = 0
for i in range(len(t) - 1):
    if t[i+1] - t[i] >= T:
        ans += T
    else:
        ans += t[i+1] - t[i]
print(ans)

Measured memory_bytes: 25200
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int k,a,b;
  cin>>k>>a>>b;
  repi(i,a,b+1){
    if(i%k==0){
      cout<<"OK"<<endl;
      return 0;
    }
  }
  cout<<"NG"<<endl;

  return 0;
}


Measured memory_bytes: 3652
# -*- coding: utf-8 -*-
import math

#入力
#S = str(input())
A1, A2, A3 = map(int, input().split())
#N = int(input())

list = []
list.append(A1)
list.append(A2)
list.append(A3)
list.sort()

print (list[1]-list[0] + list[2]-list[1])

Measured memory_bytes: 3060
# -*- coding:utf-8 -*-

def solve():
    N = int(input())
    MOD = 10**9 + 7

    """
    AGCTをそれぞれ、
    0123と置き換えて考える
    
    条件は
    ・文字0~3のみで構成される
    ・012を含まない
    ・隣同士をswapしても012を含まない

    出ちゃダメなパターンを考えると、
    ・012
    ・102
    ・021
    ・0?12
    ・01?2

    条件を満たしている部分文字列Sに対して、
    ・S+0 をしたときは大丈夫
    ・S+1 をしたとき、最後が021になるとダメ
    ・S+2 をしたとき、最後が012, 102, 0?12, 01?2になるとダメ
    ・S+3 をしたときは大丈夫
    
    と考えると、部分文字列の最後の3文字を見ると条件を満たしているかを判定できる

    dp[i][c1][c2][c3] := 部分文字列の長さiのときで、部分文字列の最後の文字列がc1c2c3のときの、条件を満たす個数
    """

    dp = [[[[0 for _ in range(4)] for __ in range(4)] for ___ in range(4)] for ____ in range(N+1)]

    for c1 in range(4):
        for c2 in range(4):
            for c3 in range(4):
                dp[0][c1][c2][c3] = 0
                dp[1][c1][c2][c3] = 0
                dp[2][c1][c2][c3] = 0
                dp[3][c1][c2][c3] = 1
    dp[3][0][2][1] = 0
    dp[3][0][1][2] = 0
    dp[3][1][0][2] = 0

    for i in range(3, N):
        for c1 in range(4):
            for c2 in range(4):
                for c3 in range(4):
                    if dp[i][c1][c2][c3] == 0:
                        # 0のやつは、何を足しても0
                        dp[i+1][c1][c2][c3] = 0
                        continue

                    for a in range(4):
                        # aは次に足す文字(0~3)
                        if ((c2==0 and c3==2 and a==1) or
                            (c2==0 and c3==1 and a==2) or
                            (c2==1 and c3==0 and a==2) or
                            (c1==0 and c3==1 and a==2) or
                            (c1==0 and c2==1 and a==2)):
                            # 021, 012, 102, 0?12, 01?2 になるとダメ
                            dp[i+1][c2][c3][a] = 0
                            continue

                        # それ以外の場合
                        dp[i+1][c2][c3][a] += dp[i][c1][c2][c3]
                        dp[i+1][c2][c3][a] %= MOD
    
    ans = 0
    for c1 in range(4):
        for c2 in range(4):
            for c3 in range(4):
                ans += dp[N][c1][c2][c3]
                ans %= MOD
    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 3440
#include <stdio.h>
int people(int x, int y){
  int z = x/(2*y+1);
  return z;
}

int remain(int x, int y){
  int z = x%(2*y+1);
  return z;
}

int main(void){
  int N, D;
  scanf("%d %d", &N, &D);
  int a = people(N,D);int b = remain(N,D);
  if(b != 0){a++;}
  printf("%d", a);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define inf 1e18
#define ll long long int
using namespace std;
int main(void){
  int n,W,i,j;
  cin>>n>>W;
  ll w[n],v[n];
  for(i=0;i<n;i++)
  cin>>w[i]>>v[i];
  ll dp[W+1][n+1];
	memset(dp,0,sizeof dp);
	for(i=w[0];i<=W;i++)
	dp[i][1]=v[0];
  for(i=2;i<=W;i++){
	  for(j=1;j<=n;j++){
		  if(i>=w[j-1])
		  dp[i][j]=max(dp[i][j-1],dp[i-w[j-1]][j-1]+v[j-1]);
		  else
		  dp[i][j]=dp[i][j-1];
	  }
  }
  cout<<dp[W][n]<<endl;
}


Measured memory_bytes: 79104
#include <stdio.h>
#include <iostream>
#include <queue>
#include <cstdio>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string.h>
#include <limits.h>
#include <map>
#include <string>
#include <bitset>
#include <vector>
using namespace std;
int l[200005],r[200005];
char s[200005];
int main() {
    int n,k,c,t=1,pre=0,now;
    cin>>n>>k>>c;
    scanf("%s",s);
    while(s[pre]=='x') pre++;
    l[t++]=pre;
    while(t<=k)
    {
        now=pre+1;
        while(now-pre<=c||s[now]=='x') now++;
        l[t++]=now;
        pre=now;
    }
    pre=n-1;
    t=k;
    while(s[pre]=='x') pre--;
    r[t--]=pre;
    while(t>=1)
    {
        now=pre-1;
        while(pre-now<=c||s[now]=='x') now--;
        r[t--]=now;
        pre=now;
    }
    for(int i=1;i<=k;i++)
        if(l[i]==r[i])
            printf("%d\n",l[i]+1);
    return 0;
}


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

#define ls(x) ch[x][0]
#define rs(x) ch[x][1]
#define rep(i , j , k) for(int i = j ; i <= k ; i ++)
#define Rep(i , j , k) for(int i = j ; i >= k ; i --)

using namespace std ;
using ll = long long ;
using pii = pair <int , int> ;
using vii = vector <int> ;

auto ot = [&]() { cerr << "ATS TXDY" << '\n' ; int ATS_nantf_txdy = true ; } ;
auto _ios = [&]() { ios :: sync_with_stdio(false) ; cin.tie(nullptr) ; cout.tie(nullptr) ; } ;

namespace stO_ATS_Orz {
  template < class T > void cmax(T & x , T y) { if(x > y) x = y ; }
  template < class T > void cmin(T & x , T y) { if(x < y) x = y ; }
  template < class T > void abs(T x) { if(x < 0) x = -x ; }
  const int N = 1000000 ;
  bool dp[N] ; char s[N] ;
  int a[N] ;
  void main() {
    int n ; cin >> n;
    cin >> s + 1 ;
    for(int i = 1 ; i <= n ; i ++) a[i] = s[i] & 15 ;
    for(int i = 1 ; i <= n ; i ++) a[i] ++ ;
    dp[0] = 1 ;
    for(int i = 1 ; i <= n ; i ++) {
      for(int j = 11 * 11 ; ~ j ; j --) dp[j * 11 + a[i]] |= dp[j] ;
    }
    int ans = 0 ;
    for(int i = 11 * 11 + 1 ; i <= 11 * 11 * 11 ; i ++) if(dp[i]) ans ++ ;
    cout << ans << '\n' ;
  }
}
signed main() {
  // _ios() ;
  ot() ;
  return stO_ATS_Orz :: main() , 0 ;
}


Measured memory_bytes: 2432
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    ll N, M;
    cin >> N >> M;
    vector<pair<ll,ll>>AB(N);
    for (int i=0; i<N; i++){
        ll ai, bi;
        cin >> ai >> bi;
        pair<ll,ll>ps;
        ps.first = ai;
        ps.second = bi;

        AB[i] = ps;
    }
    sort(all(AB));
    ll ans = 0;
    for (int i=0; i<N; i++){
        if (M <= 0)break;
        ll ai, bi;
        ai = AB[i].first;
        bi = AB[i].second;
        ans += ai * min(M,bi);
        M -= min(M,bi);
    }
    cout << ans << endl;
}

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

using namespace std;

int main() {
  int n, k, s;
  while (true) {
    cin >> n >> k >> s;
    if (n == 0) break;

    int ans = 0;
    for (int bit = 0; bit < (1 << n); bit++) {
      if (__builtin_popcount(bit) != k) {
        continue;
      }
      int res = 0;
      for (int i = 1; i <= n; i++) {
        if (bit & 1 << (i - 1)) {
          res += i;
        }
      }
      if (res == s) {
        ans++;
      }
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3116
package main

import (
	"bufio"
	"fmt"
	"os"
	"sync"
)

func main() {
	s := scanRowText()
	t := scanRowText()

	min := len(t)
	for i := 0; i <= len(s)-len(t); i++ {
		substr := s[i : len(t)+i]

		replaceChar := len(t)
		for j := 0; j < len(substr); j++ {
			if substr[j] == t[j] {
				replaceChar--
			}
		}
		if min > replaceChar {
			min = replaceChar
		}
	}

	fmt.Println(min)
}

var once sync.Once
var scanner *bufio.Scanner

func scanRowText() string {
	once.Do(func() {
		scanner = bufio.NewScanner(os.Stdin)
		scanner.Split(bufio.ScanWords)
	})
	scanner.Scan()
	return scanner.Text()
}


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

#define pb         push_back

const int INF = 100000000;

int main(void) {
	while(1){
		string s;
		getline(cin, s);
		if(s == ".") break;

		stack<char> st;
		bool success = true;
		for(int i=0; i<s.size(); i++){
			if(s[i] == '(' || s[i] == '['){
				st.push(s[i]);
			}
			if(s[i] == ')'){
				if(st.size() == 0){
					success = false;
					break;
				}
				
				char c = st.top();
				st.pop();
				if(c != '(') success = false;
			}
			if(s[i] == ']'){
				if(st.size() == 0){
					success = false;
					break;
				}

				char c = st.top();
				st.pop();
				if(c != '[') success = false;
			}
		}
		if(st.size() != 0) success = false;

		if(success){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}

	}
	
	return 0;
}

Measured memory_bytes: 1180
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPL(i,f,n) for(int i=f, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

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

	int H,W;
	char s[60][60];
	cin >> H >> W;
	REP(i, H) {
		scanf("%s",&s[i]);
	}
	bool ans = true;
	int dx[4] = { 1,-1,0,0 };
	int dy[4] = { 0,0,1,-1 };
	REP(i, H) {
		REP(j, W) {
			if (s[i][j] == '#') {
				bool found = false;
				REP (k, 4) {
					int i2 = i + dx[k];
					int j2 = j + dy[k];
					if (i2 >= 0 && i2 < H 
						&& j2 >= 0 && j2 < W && s[i2][j2] == '#') {
						found = true;
					}
				}
				if (!found) {
					ans = false;
					break;
				}
			}
		}
	}
	cout << (ans?"Yes":"No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i, n) for (int i = 0; i < (n); i++)
using pint = pair<int, int>;
using Graph = vector<vector<int>>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

// auto mod int
const int mod = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint (ll x = 0) : x ((x % mod + mod) % mod) {}
    mint operator-() const { return mint (-x); }
    mint &operator+= (const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint &operator-= (const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint &operator*= (const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+ (const mint a) const { return mint (*this) += a; }
    mint operator- (const mint a) const { return mint (*this) -= a; }
    mint operator* (const mint a) const { return mint (*this) *= a; }
    mint pow (ll t) const {
        if (!t) return 1;
        mint a = pow (t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const { return pow (mod - 2); }
    mint &operator/= (const mint a) { return *this *= a.inv(); }
    mint operator/ (const mint a) const { return mint (*this) /= a; }
};
istream &operator>> (istream &is, const mint &a) { return is >> a.x; }
ostream &operator<< (ostream &os, const mint &a) { return os << a.x; }

// combination mod prime
struct combination {
    vector<mint> fact, ifact;
    combination (int n) : fact (n + 1), ifact (n + 1) {
        assert (n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }
    mint operator() (int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} c (300100);

int main() {
    ll n, a, b, k;
    cin >> n >> a >> b >> k;
    mint ans = 0;
    rep (i, n + 1) {
        if (i * a > k) break;
        if ((k - a * i) % b == 0) {
            ans += c (n, i) * c (n, (k - a * i) / b);
        }
    }
    cout << ans << "\n";
}

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

int main(){
  int A,B;
  cin >> A >> B;
  
  if(A>B) cout << A+(A-1) << endl;
  else if(A==B) cout << A*2 << endl;
  else cout << B+(B-1) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
LL N,H,W;

int main(){
	cin>>N>>H>>W;
	
	cout<<(N-H+1)*(N-W+1)<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int n,Mod;
#define Maxn 605
int dp[Maxn][Maxn];
int g[Maxn];
struct Data{
	int val,id;
	bool operator <(const Data &z)const{return val==z.val?id>z.id:val<z.val;}
}seq[Maxn<<1];
int calc(int K){
	int tmp=0;
	dp[0][0]=1;
	for(register int i=1;i<=2*n;++i){
		if(seq[i].id>=n)tmp++;
		for(register int j=0;j<=i-tmp;++j){
			if(seq[i].id>=n)dp[i][j]=1ll*dp[i-1][j]*(seq[i].val-j-tmp+2+Mod)%Mod;
			else{
				dp[i][j]=0;
				if(j!=i-tmp)dp[i][j]=(dp[i][j]+1ll*dp[i-1][j]*(g[seq[i].id]-n-K-i+tmp+j+2+Mod))%Mod;
				if(j)dp[i][j]=(dp[i][j]+1ll*dp[i-1][j-1]*(seq[i].val-j-tmp+2))%Mod;
			}
		}
	}
	return dp[2*n][K];
}
int main(){
	scanf("%d%d",&n,&Mod);
	for(register int i=0;i<n;++i){
		seq[i+1]=(Data){floor(sqrt(n*n-i*i-1)),i};
		g[i]=floor(sqrt(4*n*n-i*i));
		if(i==0)g[i]=2*n-1;
    }
    for(register int i=n;i<2*n;++i)seq[i+1]=(Data){floor(sqrt(4*n*n-i*i)),i};
    sort(seq+1,seq+2*n+1);
    int Ans=0;
    for(register int i=0;i<=n;++i){
    	if(i&1)Ans=(Ans-calc(i)+Mod)%Mod;
    	else Ans=(Ans+calc(i))%Mod;
	}
	printf("%d\n",Ans);
    return 0;
}

Measured memory_bytes: 1408
use strict;
use warnings;

chomp(my $nm = <>);
my ($n, $m) = split(/ /, $nm);

chomp(my $input_a = <>);
my @a = split(/ /, $input_a);
my $a_ref = \@a;
@$a_ref = sort {$b <=> $a} @$a_ref;

my $sum;
for my $i (0..$n-1) {
  $sum += $a_ref->[$i];
}

if ($a_ref->[$m-1] >= $sum/(4*$m)) {
  print "Yes\n";
} else {
  print "No\n";
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;cin>>s;
  for(int i=0;i<s.size()-1;i++){
    if(s[i] == 'A' && s[i+1] == 'C'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][] bingo = new int [3][3];  //ビンゴカードを表す配列
		int[][] bingoCheck = new int[3][3];  //当たりをチェックするための配列
		//ビンゴカードの入力
		for(int x=0 ; x<3 ; x++) {
			for(int y=0 ; y<3 ; y++) {
				bingo[x][y] = sc.nextInt();
			}
		}
		//抽選番号の個数の入力と、配列に抽選番号の入力
		int sum = sc.nextInt();
		int num[] = new int[sum];
		for(int i=0 ; i<sum ; i++) {
			num[i] = sc.nextInt();
		}
		//抽選番号とカード内とで、同じ数字があるか判断
		for(int i=0 ; i<sum ; i++) {
			for(int x=0 ; x<3 ; x++) {
				for(int y=0 ; y<3 ; y++) {
					if(bingo[x][y]==num[i]) {
						//bingoCheckのあたりの場所に+1する
						bingoCheck[x][y]=1;
					}
				}
			}
		}
		//ビンゴのパターン
		int pattern1 = bingoCheck[0][0] + bingoCheck[0][1] + bingoCheck[1][2];  //縦1列目
		int pattern2 = bingoCheck[1][0] + bingoCheck[1][1] + bingoCheck[1][2];  //縦2列目
		int pattern3 = bingoCheck[2][0] + bingoCheck[2][1] + bingoCheck[2][2];  //縦3列目
		int pattern4 = bingoCheck[0][0] + bingoCheck[1][1] + bingoCheck[2][2];  //ななめ右下
		int pattern5 = bingoCheck[2][0] + bingoCheck[1][1] + bingoCheck[0][2];  //ななめ左下
		int pattern6 = bingoCheck[0][0] + bingoCheck[1][0] + bingoCheck[2][0];  //横1列目
		int pattern7 = bingoCheck[0][1] + bingoCheck[1][1] + bingoCheck[1][2];  //横2列目
		int pattern8 = bingoCheck[0][2] + bingoCheck[1][2] + bingoCheck[2][2];  //横3列目

		//いずれかのパターンが3であればビンゴになっている
		if(pattern1==3 || pattern2==3 || pattern3==3 || pattern4==3 || pattern5==3 || pattern6==3 || pattern7==3 || pattern8==3) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}
	}
}


Measured memory_bytes: 21844
#include<stdio.h>
#include<string.h>
int main(){
    char moji[200],moji2[100], ao[100];
 
    int a,b,c;
    scanf("%s",&moji);
    scanf("%s",&ao);
    strcpy(moji2, moji);
    strcat(moji,moji2);
 
    if(strstr(moji,ao) != NULL)
    {printf("Yes\n");
    }else{
        printf("No\n");
    }
 
    //scanf("%d",&a);
 return 0;
} 


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

int main(){
	long long n,i,cur=0,ans=0;
	cin >> n;
	vector<long long> a(n);
	for(i=0; i<n; i++){
		cin >> a[i];
		if(a[i]<0){
			cur++; a[i]=-a[i];
		}
	}
	sort(a.begin(),a.end());
	if(cur%2) a[0]=-a[0];
	for(i=0; i<n; i++){
		ans+=a[i];
	}
	cout <<ans;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int a;
long long b;
int main()
{
	scanf("%d",&a);
	for(int i=1;i<=a;i++)
		if(i%3!=0&&i%5!=0)b+=i;
	printf("%lld",b);
	return 0;
}

Measured memory_bytes: 3828
S = input()

TEXTS = ['dream', 'dreamer', 'erase', 'eraser']

is_updated = True
while is_updated and len(S) > 0:
  is_updated = False
  for text in TEXTS:
    if S[len(S) - len(text):] == text:
      S = S[:len(S) - len(text)]
      is_updated = True

if S == '':
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3236
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;
	
	char buf[L], *S , *T, c;
	 
	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}
	
	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}
	
	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}
	
	char B[25], *outs=B+20, *outr=B+20;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;
		
		if(!a)*--outs = '0';
		else 
			while(a)
				*--outs = (a % 10) + 48, a /= 10;
		
		if(x)
			*--outs = x;
		
		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

const int MAXN = 100010;
const int MAXP = 10000000;
const u64 MOD = 1000000007;
const f80 MI = f80(1)/MOD;
const ll INF = 10000000000000000LL;
const ll inf = 5000000000000LL;

int n, m;
vector<int> v[MAXN];
int deg[MAXN];
int pre[MAXN];

int root;

int main()
{
	
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n-1+m; ++ i)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		v[x].push_back(y);
		deg[y] ++;
	}
	for (int i = 1; i <= n; ++ i)
		if (deg[i] == 0)
			root = i;
	
	queue<int> Q;
	Q.push(root);
	while (!Q.empty())
	{
		int x = Q.front();
		Q.pop();
		for (auto y : v[x])
		{
			if (!-- deg[y])
			{
				Q.push(y);
				pre[y] = x;
			}
		}
	}
	
	for (int i = 1; i <= n; ++ i)
		printf("%d\n", pre[i]);
	
	return 0;
}


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

int main(){
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if(a == 7 && b == 5 && c == 5){
		printf("YES\n");
	}else if(a == 5 && b == 7 && c ==5){
		printf("YES\n");
	}else if(a == 5 && b == 5 && c == 7){
		printf("YES\n");
	}else{
		printf("NO\n");
	}

	return 0;
}

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

using namespace std;

#ifdef DEBUG_MODE
#define DBG(n) n;
#else
#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int WWW = 0;WWW < (n);WWW++)cerr << v[WWW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> P;

vector<pair<int, int>> edge;
vector<vector<int>> v(111111);
vector<vector<int>> vv(111111);
vector<bool> erase(111111);
vector<int> score(111111);
int n;

pair<int, int> dfs(int saisyo) {
	queue<pair<pair<int, int>, int>> q;
	q.push(MP(MP(saisyo, -1), 0));
	int ret = -1;
	int cou = 0;
	while (!q.empty()) {
		auto now = q.front(); q.pop();
		int node = now.FI.FI;
		int prev = now.FI.SE;
		int cost = now.SE;
		REP(i, v[node].size()) {
			if (v[node][i] == prev)continue;
			int seica = cost + score[v[node][i]] + 1;
			if (cou <= seica) {
				cou = seica;
				ret = v[node][i];
			}
			q.push(MP(MP(v[node][i], node), seica));
		}
	}

	return MP(ret, cou);
}

int f() {
	pair<int, int> hazi;
	REP(i, n) {
		if (!erase[i]) {
			hazi = dfs(i);
			break;
		}
	}
	if (hazi.FI == -1) {
		return 0;
	}
	return dfs(hazi.FI).SE;
}

int main() {

	ll ans = 0;
	cin >> n;
	REP(i, n - 1) {
		int a, b; cin >> a >> b;
		a--; b--;
		edge.PB(MP(a, b));
		vv[a].PB(b);
		vv[b].PB(a);
	}

	string str;
	cin >> str;

	queue<int> q;
	REP(i, n)if (str[i] == 'B' && vv[i].size() == 1)q.push(i);
	int flag = 0;
	REP(i, n)if (str[i] == 'W')flag++;
	if (flag == 0) {
		cout << 0 << endl;
		return 0;
	}
	else if (flag == 1) {
		cout << 1 << endl;
		return 0;
	}

	while (!q.empty()) {
		int now = q.front(); q.pop();
		if (str[now] != 'B')continue;
		int cou = 0;
		int seica;
		REP(i, vv[now].size()) {
			if (!erase[vv[now][i]]) {
				cou++;
				seica = vv[now][i];
				if (cou > 1)break;
			}
		}
		if (cou <= 1) {
			erase[now] = true;
			if (cou == 1)q.push(seica);
		}
	}
	REP(i, n - 1) {
		int a = edge[i].FI;
		int b = edge[i].SE;
		if (!erase[a] && !erase[b]) {
			v[a].PB(b);
			v[b].PB(a);
			ans += 2;
		}
	}
	DBG(SHOW1d(erase, n););
	REP(i, n) {
		int tmp = 0;
		tmp += (str[i] == 'W');
		tmp += (v[i].size() % 2 == 1);
		if (tmp == 1) {
			ans += 1;
			score[i] = 1;
		}
		else {
			score[i] = -1;
		}
	}
	cout << ans - f() << endl;

	return 0;
}


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

#ifdef __WIN32
#define LLFORMAT "I64"
#else
#define LLFORMAT "ll"
#endif

using namespace std;

struct edge {
	int to, cap, rev;

	edge() {}
	edge(int to, int cap, int rev): to(to), cap(cap), rev(rev) {}
};

struct max_flow {
	int n, S, T;
	vector<vector<edge> > g;

	max_flow() {}
	max_flow(int N): n(N) { g.resize(N); }
	max_flow(int N, int s, int t): n(N), S(s), T(t) { g.resize(N); }

	inline void add_edge(int from, int to, int cap) {
		g[from].push_back(edge(to, cap, g[to].size()));
		g[to].push_back(edge(from, 0, g[from].size() - 1));
		return;
	}

	inline int dinic() {
		vector<int> dst(n), iter(n);
		auto bfs = [&]() {
			fill(dst.begin(), dst.end(), -1);
			queue<int> q;
			q.push(S);
			dst[S] = 0;
			while(!q.empty()) {
				int u = q.front();
				q.pop();
				for (auto &e: g[u]) if(e.cap && !~dst[e.to]) dst[e.to] = dst[u] + 1, q.push(e.to);
			}
			return dst[T] != -1;
		};
		int ret = 0;
		while(bfs()) {
			fill(iter.begin(), iter.end(), 0);
			function<int(int, int)> dfs = [&](int u, int f) {
				if(u == T) return f;
				int t = f;
				for (int &i = iter[u]; i < g[u].size(); ++i) {
					auto &e = g[u][i];
					if(e.cap && dst[e.to] == dst[u] + 1) {
						int F = dfs(e.to, min(t, e.cap));
						e.cap -= F;
						g[e.to][e.rev].cap += F;
						t -= F;
						if(!t) return f;
					}
				}
				return f - t;
			};
			static const int oo = INT_MAX;
			for (int f = dfs(S, oo); f; f = dfs(S, oo)) ret += f;
		}
		return ret;
	}
};

int main() {
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<vector<int> > apr(n + 1);
	max_flow flow(n * 2, 0, 1);
	for (int i = 1; i < n; ++i) {
		int sz, foo = i + n;
		cin >> sz;
		flow.add_edge(foo, 1, 1);
		flow.add_edge(0, i + 1, 1);
		while(sz--) {
			int u;
			cin >> u;
			flow.add_edge(u, foo, 1);
			apr[u].push_back(foo);
		}
	}
	if(flow.dinic() != n - 1) { cout << "-1\n"; return 0; }
	vector<int> rem(n * 2, -1), con(n * 2, -1);
	for (int i = 1; i < n; ++i) {
		int u = i + n;
		for (auto &e: flow.g[u]) if(e.cap && e.to >= 2 && e.to <= n) rem[u] = e.to;
		if(!~rem[u]) { cout << "-1\n"; return 0; }
	}
	queue<int> q;
	q.push(1);
	while(!q.empty()) {
		int u = q.front();
		q.pop();
		for (int i: apr[u]) if(!~con[i]) {
			q.push(rem[i]);
			con[i] = u;
		}
	}
	for (int i = 1; i < n; ++i) {
		int u = i + n;
		if(!~rem[u] || !~con[u]) { cout << "-1\n"; return 0; }
	}
	for (int i = 1; i < n; ++i) {
		int u = i + n;
		cout << rem[u] << ' ' << con[u] << endl;
	}
	return 0;
}

Measured memory_bytes: 29640
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    getline(cin,s);
    int a=s.length();
    char c=s[a-1];
    //char arr[5]={'a','e','i','o','u'};
    
        if(c=='s'){
            s=s+"es";
            
        }
        else{
            s=s+"s";
        
        }

    cout<<s;
}

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

int input() {
    int x;
    cin >> x;
    return x;
}

void output(int x) {
    cout << x << endl;
    return;
}

void output(string x) {
    cout << x;
    return;
}

vector<string> vecinput(int x) {
    vector<string> vec(x);
    for (int i = 0; i < x; i++)
        cin >> vec[i];
    return vec;
}
 
int main() {
    int N = input();
    int L = input();
    vector<string> S = vecinput(N);
    sort(S.begin(), S.end());
    for (int i = 0; i < N; i++){
        output(S[i]);
    }
    cout << endl;
}

Measured memory_bytes: 3704
#include <iostream>
#include <string>

using namespace std;

int main()
{
    int N;
    string S;
    cin >> N;
    cin >> S;
    int ans=0;
    for(int i=0;i<N-2;++i){
        ans += S.substr(i, 3) == "ABC";
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

#define PI 3.14159265359

int main(int argc, char **argv)
{
    int R;
    cin >> R;
    cout << 2 * (double)R * PI << endl;
    return 0;
}


Measured memory_bytes: 3788
#include <iostream>
using namespace std;
int main(void){
    
    //変数：華氏で表された温度「 F 」と置く
    int F;
   
    //入力：華氏で表された温度「 F 」を入力
    cin >> F;
    
    //出力：摂氏を求める
    cout << (F - 30)/2 << endl;
    
    return 0;
}


Measured memory_bytes: 3084
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

constexpr int MOD = 1'000'000'007;

long long power(long long x, long long n, long long mod = MOD) {
    if (n == 0) return 1;
    if (n % 2 == 0) return power(x * x % mod, n/2, mod);
    else return x * power(x, n-1, mod) % mod;
}

// auto mod int
struct mint {
    LL x;
    mint(LL x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(const LL &t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
    LL operator()() const {
        return x;
    }
};
using VM = vector<mint>;
using VVM = vector<VM>;

void solve() {
    int n;
    cin >> n;
    VLL c(n);
    REP(i,0,n) cin >> c[i];
    sort(all(c));
    reverse(all(c));
    mint pat = power(2,n-1) * power(2,n-1);

    mint ans = 0;
    REP(i,0,n) {
        ans += (i+2) * c[i];
    }
    ans *= pat;
    cout << ans() << endl;
}

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

Measured memory_bytes: 1792
import fractions
n = int(input())
a = list(map(int,input().split()))
l = []
m = []
l.append(0)
m.append(0)
for i in range(n):
    l.append(fractions.gcd(l[i],a[i]))
    m.append(fractions.gcd(m[i],a[-(i+1)]))
b = [fractions.gcd(l[i],m[-(i+2)]) for i in range(n)]
print(max(b))

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

int main(void){
    int a, b, k;
    cin >> a >> b >> k;

    int count = 0;
    for(int i = std::min(a,b); i > 0 ; i--){
        if(a % i == 0 && b % i == 0){;
            if(++count == k){
                cout << i;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<numeric>
#include<cstdlib>
#include <iostream>
#define ll long long int
#define all(x) x.begin(),x.end()

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define v vector<long long int> 
#define vv vector< int> 
#define gcd(m,n) __gcd(m,n)
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define itr vector<long long int>::iterator
#define pa pair<long long int ,long long int> 
#define f(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,n) for (ll i=a ; i<n ;i+=1)
#define fe(d,e) for(auto d:e)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
# define N 1005
# define cout1(x) cout<<x<<"\n";
# define  deb(x) cout<<#x<<" "<<x<<"\n";
#define  vii vector<pa>;
using namespace std;


int dfs(char a,char b,map<char,int> visited,map<char,vector<char>> graph){
    if (b==a)return 1;
    visited[a]=1;
    for (auto x:graph[a]){
        if (!visited[x]){
            if(x==b)return 1;
            dfs(x,b,visited,graph);
        }
        
    }
    return 0;

}


int main(){
    ll n;
    cin>>n;
    ll ans =0;
    v arr(n);f(i,n)cin>>arr[i];
    sort(all(arr));
    loop(i,0,n){
        loop(j,i+1,n){
            loop(k,j+1,n){
                if (arr[i]+arr[j]>arr[k] && arr[i]!=arr[j] && arr[j]!=arr[k] && arr[1]!=arr[k])ans+=1;
            }
        }
    }
    cout<<ans<<"\n";

       
       
    
    }


Measured memory_bytes: 3636
n=input()
a=map(int,raw_input().split())
max=-10000000000
min=10000000000
sum=0
for i in range(n):
    sum=sum+a[i]
    if a[i]<min:
        min=a[i]
    if a[i]>max:
        max=a[i]
print('%d %d %d'%(min,max,sum))

Measured memory_bytes: 6928
fun main(args: Array<String>) {
  val s = readLine()!!
  val n = s.length
  var ans = 0L
  var k = 0L
  for (b in 0 until (1 shl (n - 1))) {
    var t = 0L
    for (i in 0 until n) {
      k = k * 10L + (s[i].toLong() - '0'.toLong())
      if ((b shr i) and 1 == 1) {
        t += k
        k = 0
      }
    }
    t += k
    k = 0
    ans += t
  }
  println(ans)
}


Measured memory_bytes: 33668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); 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; }


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

Measured memory_bytes: 3968
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

int n;
vector<pair<int, int> > e[100010];
int res[100010];
bool visited[100010];

void go(int a) {
  visited[a] = true;
  for(auto p : e[a]) {
    int v = p.first;
    int w = p.second;
    if (visited[v]) continue;
    res[v] = res[a] ^ (w&1);
    go(v);
  }
}

void solve() {
  cin >> n;
  REP(_, n-1) {
    int u, v, w;
    cin >> u >> v >> w;
    u--; v--;
    e[u].push_back({v,w});
    e[v].push_back({u,w});
  }
  res[0] = 0;
  go(0);
  REP(i, n) cout << res[i] << endl;
}

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


Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, M; 
	cin >> N >> M;
	int A[35][35] = {}; 
	int ans[35] = {}; 
	for(int i = 1; i <= M; i++){
		ans[i] = 1; 
	}
	for(int i = 0; i < N; i++){
		int K;
		cin >> K; 
		for(int j = 0; j < K; j++){
			int a; 
			cin >> a; 
			A[i][a] = 1; 
		}
		for(int k = 1; k <= M; k++){
			if(A[i][k] == 0){
				ans[k] = 0; 
			}
		}
	}
	int kotae = 0; 
	for(int i = 1; i <= M; i++){
		kotae += ans[i]; 
	}
	cout << kotae << endl; 
}

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

using namespace std;

int main(){
  bool sub[31]={};
  for(int i=0;i<28;i++){
    int n;
    cin>>n;
    sub[n]=true;
  }
  int f=0;
  f=find(sub+f+1,sub+31,false)-sub;
  cout<<f<<endl;
  f=find(sub+f+1,sub+31,false)-sub;
  cout<<f<<endl;
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
bool prime[100004];
void era(){
  prime[0]=1;
  prime[1]=1;
  for(int i=2;i<=100003;i++){
    if(!prime[i]){
      for(int j=i+i;j<=100003;j+=i){
        prime[j]=1;
      }
    }
  }
}
int main(){
  int n;
  cin>>n;
  era();
  for(int i=n;i<=100003;i++){
    if(!prime[i]){cout<<i;return 0;}
  }
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/11/29  Problem: 081_arc_a / Link: https://arc081.contest.atcoder.jp/tasks/arc081_a  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----

mapを使いたいけど使い方が分かりません…

----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;
	VL a(N);
	FOR(i, 0, N) {
		cin >> a[i];
	}

	SORT(a);
	int f = 0;
	FORR(i, N - 1, -1+1) {
		if (!f&&a[i] == a[i - 1]) {
			ans = a[i];
			i--; f = 1;
		}
		else if (f==1&&a[i] == a[i - 1]) {
			ans *= a[i];
			f = 2;
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1024
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var Ls = cin.ReadIntArray(N);

            var max = Ls.Max();
            var others = Ls.Sum() - max;
            Console.Write((max < others) ? "Yes" : "No");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int x;
  for (int i=1;i<10001;i++) {
    cin >> x;
    if (x == 0) {
      break;
    } else {
     cout << "Case " << i << ": " << x << endl;
    }
  }
}


Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;



int main(){
    string s, t, ans;
    cin >> s >> t;
    ans = t + s;
    cout << ans << endl;
}

Measured memory_bytes: 256
month=[31,29,31,30,31,30,31,31,30,31,30,31]
week =['Wednesday','Thursday','Friday','Saturday','Sunday','Monday','Tuesday']

while True:
    sum=0
    m,d=map(int,raw_input().split())
    if m==0 and d==0:
        break
    else:
        for i in range(m-1):
            sum += month[i]
        sum += d
        flag = sum % 7
        print week[flag]


Measured memory_bytes: 4648
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define degreeToRadian(deg) (((deg)/360)*2*M_PI)
#define radianTodegree(rad) (((rad)/2/M_PI)*360)
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const int MOD = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//cin.tie(0);ios::sync_with_stdio(false);
//cout << fixed << setprecision(15) << y << endl;
int main() {
  int n;
  cin >> n;

  int cnt = 0;
  bool ok = false;
  rep (i, n) {
    int a, b;
    cin >> a >> b;
    if (a == b) cnt++;
    else cnt = 0;

    if (cnt == 3) ok = true;
  }

  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3600
#include<iostream>
using namespace std;
int main()
{
	int  x, y;

	cin >> x >> y;

	long long  sum = 0;

	for (int i = y + 1; i <= x; i++)

	{

		sum = sum + (i - y)*(x / i);

		if (x%i - y >= 0)

			sum = sum + 1 + x % i - y;

	}

	if (y == 0)

		sum = sum - x;

	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256