akhauriyash/Code-Regression huggingface dataset:
L = input()
MOD = 10 ** 9 + 7
dp1 = [0] * len(L)
dp2 = [0] * len(L)
dp1[0] = 1
dp2[0] = 2
for i in range(1, len(L)):
    s = L[i]
    if s == '0':
        dp1[i] = (3 * dp1[i - 1]) % MOD
        dp2[i] = dp2[i - 1]
    else:
        dp1[i] = (3 * dp1[i - 1] + dp2[i - 1]) % MOD
        dp2[i] = (2 * dp2[i - 1]) % MOD
print((dp1[-1] + dp2[-1]) % MOD)


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

int main() {
    int n; cin >>n;
    map<string, int> memo;
    string tmp;
    int c_max = 0;
    for (int i = 0; i < n; i++) {
        cin >>tmp;
        memo[tmp] += 1;
    }

    int max_v = 0;
    for (const auto& x: memo) {
        int v = x.second;
        if (v > max_v) max_v = v;
    }

    for (auto it = memo.begin(); it != memo.end(); it++) {
        if (it->second == max_v) {cout << it->first << endl;}
    }
    return 0;
}

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

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

using namespace std;

using ll = long long;

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

    int N;
    ll K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N) {
        cin >> A[i];
        --A[i];
    }

    int pos = 0;
    ll t = 0;
    unordered_map<int, ll> first_time;
    bool skipped = false;
    while (true) {
        if (!skipped) {
            if (first_time.count(pos)) {
                ll period = t - first_time[pos];
                t += (K - t) / period * period;
                skipped = true;
            } else {
                first_time[pos] = t;
            }
        }
        if (t == K) break;
        pos = A[pos];
        ++t;
    }

    cout << (pos + 1) << endl; // 1-based indexing;
    
    return 0;
}


Measured memory_bytes: 11044
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
constexpr bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
constexpr bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

void Pr(bool f){
  cout << (f ? "Yes" : "No") << "\n";
  exit(0);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ld r;
  cin >> r;
  print(2*PI*r);
}


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

int main(){
	int n,ans=1,MAX=0;
	cin>>n;
	int h[n];
	for(int i=0;i<n;i++){
		cin>>h[i];
		if(i==0) continue;
		if(h[MAX]<=h[i]){
			MAX=i;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
n,ma,mb = list(map(int,input().split()))
G=[]
for i in range(n):
    G.append(list(map(int,input().split())))

DP = [[10000 for _ in range(500)] for _ in range(500)]
DP[0][0]=0
for i in range(n):
    for j in reversed(range(400)):
        for k in reversed(range(400)):
            if DP[j][k]==10000:continue
            DP[j+G[i][0]][k+G[i][1]] = min(DP[j][k]+G[i][2],DP[j+G[i][0]][k+G[i][1]])

ans=10000
for i in range(1,min(400//ma,400//mb)+1):
    ans=min(ans,DP[ma*i][mb*i])

if ans==10000:
    print(-1)
else:
    print(ans)
    


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

int dp[3005][3005], dpr[3005][3005];

char A[3005], B[3005], Ans[3005];

int N, M;

void f(int a, int b, int c, int d) {
	if(c <= dp[a][b]) return;
	dp[a][b] = c;
	dpr[a][b] = d;
}

int main() {
	scanf(" %s %s", A+1, B+1);
	N = int(strlen(A+1));
	M = int(strlen(B+1));

	for(int i = 1; i <= N; i++) for(int j = 1; j <= M; j++) {
		if(A[i] == B[j]) f(i, j, dp[i-1][j-1]+1, 0);
		f(i, j, dp[i][j-1], 1);
		f(i, j, dp[i-1][j], 2);
	}

	for(int i = N, j = M, k = dp[i][j], c; k;) {
		c = dpr[i][j];
		if(!c) {
			Ans[k] = A[i];
			i--; j--; k--;
		} else if(1 == c) j--;
		else i--;
	}

	puts(Ans+1);
	return 0;
}

Measured memory_bytes: 70784
import math

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

ans1 = 0
ans2 = 0
ans3 = 0
ans4 = 0

for i in range(n):
	a = math.fabs(x[i] - y[i])
	ans1 += a
	ans2 += a**2
	ans3 += a**3
	ans4 = max(ans4, a) 

print(ans1)
print(ans2**(1./2.))
print(ans3**(1./3.))
print(ans4)


Measured memory_bytes: 5716
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(X: int, Y: int):
    ans = 0
    if X == 3:
        ans += 1
    elif X == 2:
        ans += 2
    elif X == 1:
        ans += 3
    
    if Y == 3:
        ans += 1
    elif Y == 2:
        ans += 2
    elif Y == 1:
        ans += 3
    
    if X == 1 and Y == 1:
        ans += 4
    
    print(ans*10**5)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    solve(X, Y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) {
  v = vector<T>(n, x);
}
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n) {
  v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i];
}
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

lli n, m;
vector<pair<lli, lli>> e;
vector<vector<lli>> v;
vector<lli> len;

lli dfs(lli node) {
  if (len[node] < 0) {
    lli l = 0;
    for (lli to : v[node]) {
      l = max(l, 1 + dfs(to));
    }
    return len[node] = l;
  } else {
    return len[node];
  }
}

int main() {
  cin >> n >> m;
  init_n(e, m);
  for (lli i=0; i<m; ++i) cin >> e[i].first >> e[i].second;
  init_n(v, n+1);
  for (auto&& p : e) v[p.first].push_back(p.second);
  init_n(len, n+1, -1);
  lli l = 0;
  for (lli node = 0; node <= n; ++node) {
    l = max(l, dfs(node));
  }
  cout << l << endl;
  return 0;
}


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

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

const long long MOD = 1000000007;

int main(){
  ll r,d,x;
  cin >> r >> d >> x;
  rep(i,10){
    x = r*x - d;
    cout << x << endl;
  }
}


Measured memory_bytes: 256
N, L = map(int, input().split())
A = [L + i for i in range(N)]
sum_A = sum(A)
ans = []
for i in range(N):
    B = A.copy()
    del B[i]
    ans.append(sum(B))
c = [abs(ans[i] - sum_A) for i in range(N)]
index = c.index(min(c))
print(ans[index])


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N;
	cin >> N;
	vector<int> A(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	vector<int> dp(N, INT_MAX);
	for (auto i = N - 1; i >= 0; --i)
	{
		auto it = upper_bound(dp.begin(), dp.end(), A[i]);
		*it = A[i];
	}

	auto ans = 0;
	for (auto i = 0; i < N; ++i)
	{
		if (dp[i] >= INT_MAX)
		{
			break;
		}
		ans = i + 1;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
char p[100010];
int mk[100010],cmx[100005],cmn[100005];
main()
{
	int t;
    scanf("%s",&p[1]);
    for(int i = 0;i < 26;i++)
    {
        char ck='a'+i;
        for(int j = 1;p[j];j++)
        {
            cmx[j]=-1e9;
            cmn[j]=1e9;
            if(p[j]==ck)
            mk[j]=1;
            else
            mk[j]=-1;
            mk[j]+=mk[j-1];
        }
        int ck1=0;
        int ss=strlen(&p[1]);
        for(int j = 1;p[j];j++)
        {
            cmn[j]=mk[j];
            //if(j!=ss)
            cmn[j]=min(cmn[j-1],cmn[j]);
        }
        for(int j = ss;j>=1;j--)
        {
            cmx[j]=mk[j];
            if(j!=ss)
            cmx[j]=max(cmx[j+1],cmx[j]);
        }
        for(int j = 2;j <= ss;j++)
        {
            //printf("%d ",mk[j]);
            if(mk[j]>0)
            {
                printf("%d %d",1,j);
                return 0;
            }
        }
        //printf("----\n");
        for(int j = 3;j <= ss;j++)
        {
            //if(i==2)
            //printf("%d %d\n",cmn[j-2],cmx[j]);
            if(cmx[j]>cmn[j-2])
            {
                int ck1=1,ck2=1;
                for(int k = 1;k <= j-2;k++)
                {
                    if(cmn[j-2]==mk[k])
                    ck1=k;
                }
                for(int k = j;k <= ss;k++)
                {
                    if(cmx[j]==mk[k])
                    ck2=k;
                }
                printf("%d %d",ck1+1,ck2);
                return 0;
            }
        }
    }
    printf("-1 -1");
}
/*
dabaac

abcacb
-1 -2 -1 -2 -1 -2

-1 0 -1 0 1 0
*/


Measured memory_bytes: 1536
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;

ll gcd(ll a,ll b){
	if(a<b)swap(a,b);
	return (a%b?gcd(a%b,b):b);
	
}

int main()
{
	int a,b,c;
	string S,T;
	cin>>S>>T;
	cout<<T<<S;
}


Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv,
    std.functional, std.math, std.numeric, std.range, std.stdio, std.string,
    std.random, std.typecons, std.container;

ulong MAX = 100_100, MOD = 1_000_000_007, INF = 1_000_000_000_000;
alias sread = () => readln.chomp();
alias lread(T = long) = () => readln.chomp.to!(T);
alias aryread(T = long) = () => readln.split.to!(T[]);
alias Pair = Tuple!(long, "a", long, "b");
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);

void main()
{
    long a, b, c, k;
    
    scan(a, b, c, k);
    if (a > k)
        k.writeln();
    else if (a + b >= k)
        a.writeln();
    else
        writeln(a - (k - (a + b)));
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}


Measured memory_bytes: 2716
/*input
5 3 1
*/
/**
    Author: Kristopher Paul
    Date Created: 16-01-2020
    Contest Name:
                _/    _/   _/_/_/_/   _/   _/_/_/_/
               _/  _/     _/    _/   _/   _/
              _/_/       _/_/_/_/   _/   _/_/_/_/
             _/  _/     _/  _/     _/         _/
            _/    _/   _/    _/   _/   _/_/_/_/
**/
#include<bits/stdc++.h>
#include<stdio.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int ll
#define pb push_back
#define INF 1e18
#define MOD 1000000007
//#define MOD 998244353
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap unordered_map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

//Uncomment for File I/O
/*
#define cin fin
#define cout fout

ifstream fin("input.in");
ofstream fout("input.out");
*/

using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void solve(){
    int n,k,s;
    cin >> n >> k >> s;
    if(k == 0){
        int v = ceil(pow(10,9));
        if(s == v){
            v--;
        }
        FOR(i,0,n){
            cout << v << " ";
        }
        cout << endl;
    }else{
        int v = ceil(pow(10,9));
        if(s == v){
            v--;
        }
        FOR(i,0,n){
            if(k == 0){
                cout << v << " ";
                continue;
            }
            cout << s << " ";
            k--;
        }
        cout << endl;
    }
}

signed main(){
    FastIO;
    int t = 1;
//    cin >> t;
    WL(t){
        solve();
    }
}

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

namespace ABC49
{
    static class Program
    {
        private static readonly string[]  s_targets = new[]
        {
            "dreamer", "dream", "eraser", "erase"
        };

        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            if (Check(s, 0))
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }

        private static bool Check(string s, int startIndex)
        {
            foreach (var x in s_targets)
            {
                if (s.Length - startIndex < x.Length) continue;

                var matched = true;

                for (var i = 0; i < x.Length; i++)
                {
                    if (s[startIndex + i] != x[i])
                    {
                        matched = false;
                        break;
                    }
                }

                if (matched)
                {
                    var nextIndex = startIndex + x.Length;
                    if (nextIndex >= s.Length || Check(s, nextIndex))
                        return true;
                }
            }

            return false;
        }
    }
}


Measured memory_bytes: 4440
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int k,n,ans;
int x,y,a,b,c;
int p[111111],q[111111],r[111111];
signed main(){
	cin>>x>>y>>a>>b>>c;
	rep(i,a)cin>>p[i];
	rep(i,b)cin>>q[i];
	rep(i,c)cin>>r[i];
	priority_queue<int,vector<int>,greater<int>> que;
	sort(p,p+a,greater<>());sort(q,q+b,greater<>());sort(r,r+c);
	rep(i,x){
		ans+=p[i];
		que.push(p[i]);
	}
	rep(i,y){
		ans+=q[i];
		que.push(q[i]);
	}
	rep(i,c){
		if(que.top()<r[i]){
			ans=ans-que.top()+r[i];
			que.pop();
			que.push(r[i]);
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 4724
A = []
for i in range(3):
    temp = list(map(int, input().split()))
    A += temp
N = int(input())
bingo = [0]*9
for i in range(N):
    b = int(input())
    if b in A:
        bingo[A.index(b)] = 1
flag = bingo[0]*bingo[1]*bingo[2] + bingo[3]*bingo[4]*bingo[5] + bingo[6]*bingo[7]*bingo[8]
flag += bingo[0]*bingo[3]*bingo[6] + bingo[1]*bingo[4]*bingo[7] + bingo[2]*bingo[5]*bingo[8]
flag += bingo[0]*bingo[4]*bingo[8] + bingo[2]*bingo[4]*bingo[6]
if flag > 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import sys
input = sys.stdin.buffer.readline

def main():
    N = int(input())
    a = list(map(int,input().split()))
    
    cum = [0]
    for i in range(N):
        cum.append(cum[-1]+a[-i-1])
    
    cum.reverse()
    ans = 1
    if N == 0:
        if a[0] == 1:
            print(1)
        else:
            print(-1)
        exit()
    if a[0] != 0:
        print(-1)
        exit()
    base = 1
    for i in range(1,N):
        if a[i] > base*2:
            print(-1)
            exit()
        use = min(base*2,cum[i]+a[i])
        ans += use
        base = use-a[i]
    
    if base*2 < a[-1]:
        print(-1)
    else:
        print(ans+a[-1])

if __name__ == "__main__":
    main()


Measured memory_bytes: 83456
#include <iostream>

using namespace std;

int main(){
  int A,A_hi, B,B_low,K;
  cin >> A >> B >> K;
  A_hi = A + K - 1;
  B_low = B - (K - 1);
  if(B_low <= A_hi){for(int i = A; i <= B; ++i) cout << i << endl;}
  else{
    for(int i = A; i <= A_hi; ++i) cout << i << endl;
    for(int i = B_low; i <= B; ++i) cout << i << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
template <class T>
using Vec2 = vector<vector<T>>;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <class T1, class T2>
bool chmax(T1 &a, const T2 b){if(a < b){a = b; return true;} return false;}
template <class T1, class T2>
bool chmin(T1 &a, const T2 b){if(a > b){a = b; return true;} return false;}
ll pow2(const int n){return (1LL << n);}
void co() { cout << endl; }
template <class Head, class... Tail>
void co(Head&& head, Tail&&... tail) {
    cout << head << ' ';
    co(forward<Tail>(tail)...);
}
void ce() { cerr << endl; }
template <class Head, class... Tail>
void ce(Head&& head, Tail&&... tail) {
    cerr << head << ' ';
    ce(forward<Tail>(tail)...);
}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const int n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18L+1;
constexpr ll MOD = 1e9L+7;
constexpr ll MOD_N = 998244353;
constexpr ld EPS = 1e-11;
const double PI = acos(-1);

int main(void){
    ll x;
    cin >> x;
    co(1 - x);

    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

int main() {
    int N, M, Q;
    while (cin >> N >> M >> Q, N + M + Q) {
        vector<vector<bool>> v(M, vector<bool>(N, true));
        vector<int> lsts(N, 0);
        REP (i, 0, Q) {
            string s, b;
            cin >> s >> b;
            vector<int> ss(N, 0);
            REP (j, 0, N) {
                ss[j] = (s[j] - '0') ^ lsts[j];
            }
            REP (j, 0, N) {
                REP (k, 0, M) {
                    if (ss[j] + '0' != b[k]) {
                        v[k][j] = false;
                    }
                }
            }
            lsts = ss;
        }
        REP (i, 0, M) {
            int cnt = 0;
            int index = -1;
            REP (j, 0 ,N) {
                if (v[i][j]) {
                    cnt++;
                    index = j;
                }
            }
            if (cnt == 1) {
                char out = index;
                if (out <= 9) out += '0';
                else out += 'A' - 10;
                cout << out;
            } else {
                cout << '?';
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3228
import Control.Monad ( replicateM )
import Data.List ( sort, group )
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )

readInts :: IO [Int]
readInts = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [n,m] <- readInts
  abs   <- replicateM m readInts
  mapM_ print $ honsu n abs

honsu
  :: Int -> [[Int]] -> [Int]
honsu n as = map (length . tail) . group . sort . concat $ ([1..n] : as)

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

int main() {
    int a, b;
    char op;
    while (true) {
        scanf("%d %c %d", &a, &op, &b);
        if (op == '?') {
            break;
        }
        if (op == '+') {
            printf("%d\n", a+b);
        } else if (op == '-') {
            printf("%d\n", a-b);
        } else if (op == '%') {
            printf("%d\n", a%b);
        } else if (op == '/') {
            printf("%d\n", a/b);
        } else if (op == '*') {
            printf("%d\n", a*b);
        }
    }
}

Measured memory_bytes: 3204
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
   
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

int main(){
	int N;
	cin>>N;
	vector<int> A;
	rep(i,N){
		int a;
		cin>>a;
		A.push_back(a);
	}
	rep(i,N-1)cout<<A[i]<<" ";
	cout<<A[N-1]<<endl;
	REP(i,1,N){
		int a = A[i];
		A.erase(A.begin()+i);
		int j=i-1;
		for(;a<A[j];j--);
		A.insert(A.begin()+j+1,a);
		rep(j,N-1){
			cout<<A[j]<<" ";
		}
		cout<<A[N-1]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3160
# 入力、宣言
intLen=int(input())
intList=sorted(list(map(int,input().split())))

result="YES"

# 処理
# 対象項目と次の項目を比較
for i in range(len(intList)-1):
    if intList[i]==intList[i+1]:
        result="NO"

# 出力
print(result)

    

Measured memory_bytes: 26808
class UFT(object):
    def __init__(self,N):
        self.par={i:i for i in range(1,N+1)}
        self.h={i:0 for i in range(1,N+1)}
    def find(self,n):
        if self.par[n]==n:
            return n
        else:
            self.par[n]=self.find(self.par[n])
            return self.par[n]
    def unite(self,a,b):
        a=self.find(a)
        b=self.find(b)
        if self.h[a]>self.h[b]:
            self.par[b]=a
        else:
            self.par[a]=b
            self.h[a]+=1
    def issame(self,a,b):
        return self.find(a)==self.find(b)

n,m=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(m)]
s=0

for i in range(m):
  obj=UFT(n)
  for (j,k) in enumerate(l):
    if i!=j:
      a,b=k
      obj.unite(a,b)
  a,b=l[i]
  if not obj.issame(a,b):s+=1

print(s)

Measured memory_bytes: 3572
#include <stdio.h>
#include <string.h>
#include <algorithm>

const int kN = 200 + 5;
const int MOD = 998244353;
int n;

struct Point {
    int x, y;

    Point() {}

    Point(int x, int y): x(x), y(y) {}

    Point operator - (const Point &rhs) const
    {
        return Point(x - rhs.x, y - rhs.y);
    }

    void read()
    {
        scanf("%d%d", &x, &y);
    }

    bool operator < (const Point &rhs) const
    {
        return x < rhs.x || x == rhs.x && y < rhs.y;
    }
};

int det(const Point &a, const Point &b)
{
    return a.x * b.y - a.y * b.x;
}

int det(const Point &a, const Point &b, const Point &c)
{
    return det(b - a, c - a);
}

int inverse(int x)
{
    return x == 1 ? x : (MOD - MOD / x) * 1ll * inverse(MOD % x) % MOD;
}

inline void add(int &a, int b)
{
    a += b;
    if (a < 0) a += MOD;
    else if (a >= MOD) a -= MOD;
}

inline int mul(int x)
{
    return x;
}

template<typename... Args>
inline int mul(int x, Args... args)
{
    return x * 1ll * mul(args...) % MOD;
}

Point pt[kN];

int pw[kN];

int work()
{
    pw[0] = 1;
    for (int i = 1; i < kN; ++ i)
        pw[i] = mul(pw[i - 1], 2);
    int ret = pw[n];
    add(ret, -1 - n);
    for (int i = 0; i < n; ++ i) {
        for (int j = i + 1; j < n; ++ j) {
            int cnt = 0;
            for (int k = j + 1; k < n; ++ k)
                if (det(pt[i], pt[j], pt[k]) == 0)
                    ++ cnt;
            add(ret, -pw[cnt]);
        }
    }
    return ret;
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++ i)
        pt[i].read();
    printf("%d\n", work());
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(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; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    ll N,M;
    cin >> N >> M;
    if (N>=3 && M>=3) cout << (N-2)*(M-2) << endl;
    else if (N==2 || M==2 && N!=1 && M!=1) cout << 0 << endl;
    else if (N==1 && M==1) cout << 1 << endl;
    else if (N==1 || M==1) cout << N*M-2 << endl;
}

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

int main(){
    string L;
    cin >> L;
    ll len = L.size();
    ll ans;
    vector<ll> dp1(len + 1, 0);
    vector<ll> dp2(len + 1, 0);
    dp1[1] = 2;
    dp2[1] = 1;
    for (ll i = 1; i < len; i++){
        if (L[i] == '0'){
            dp1[i + 1] = dp1[i];
            dp2[i + 1] = (dp2[i] * 3) % 1000000007;
        }
        else{
            dp1[i + 1] = (dp1[i] * 2) % 1000000007;
            dp2[i + 1] = (dp1[i] + dp2[i] * 3) % 1000000007;
        }
    }
    ans = (dp1[len] + dp2[len]) % 1000000007;
    cout << ans << endl;
}

Measured memory_bytes: 5048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_Beginner_Contest_146
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            int r = 0;
            switch (S)
            {
                case "SUN":
                    r = 7;
                    break;
                case "MON":
                    r = 6;
                    break;
                case "TUE":
                    r = 5;
                    break;
                case "WED":
                    r = 4;
                    break;
                case "THU":
                    r = 3;
                    break;
                case "FRI":
                    r = 2;
                    break;
                case "SAT":
                    r = 1;
                    break;
                default:
                    break;
            }
            Console.WriteLine(r);
        }
    }
}


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

const ll INF = 1LL << 60;

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

    ll MIN = INF;

    sort(h.begin(), h.end());

    for (int i = 0; i < N-K+1; i++) {
        ll diff = INF;
        diff = h[i+K-1]-h[i];
        MIN = min(MIN, diff);
    }

    cout << MIN << endl;
    return 0;
}

Measured memory_bytes: 768
num_list = [int(i) for i in input().split()]

LEN = 3
abc_sum = 0
for i in range(len(num_list) - 1):
  abc_sum += num_list[i]

bca_sum = 0
reversed_list = list(reversed(num_list))
for i, num in enumerate(reversed_list, 1):
  if i == LEN:
    break
  bca_sum += num

cab_sum = 0
cab_sum += num_list[-1]
cab_sum += num_list[0]

l = [abc_sum, bca_sum, cab_sum]

print(min(l))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int n, m;

bool is_ok(vector<pair<int, int>> &conditions, vector<int> &target) {
  if (target.size() != n) return false;

  rep(i, m) {
    if (target[conditions[i].first - 1] != conditions[i].second) return false;
  }
  return true;
}

int main()
{  
  cin >> n >> m;
  vector<pair<int, int>> vec;
  rep(i, m) {
    int s, c;
    cin >> s >> c;
    vec.push_back(make_pair(s, c));
  }
  if (n == 1 && m == 0) {
    cout << 0 << endl;
    return 0;
  }
  rep(i, m) {
    if (n > 1 && vec[i].first == 1 && vec[i].second == 0) {
      cout << -1 << endl;
      return 0;
    }
  }
  int ans =  1000;
  repr(i, 999) {
    int r = i/10;
    vector<int> seq(1, i%10);
    while(r) {
      seq.push_back(r%10);
      r /= 10;
    }

    reverse(seq.begin(), seq.end());
    if (is_ok(vec, seq)) ans = min(ans, i);
  }
  cout << (ans == 1000 ? -1 : ans) << endl;
  return 0;
}

Measured memory_bytes: 3604
from collections import Counter
n = int(input())
lis = list(map(int, input().split()))

a = Counter(lis[::2])
b = Counter(lis[1::2])

aa = sorted(a.items(), key=lambda x:x[1], reverse=True)
bb = sorted(b.items(), key=lambda x:x[1], reverse=True)

aa.append((0, 0))
bb.append((0, 0))

if aa[0][0] == bb[0][0]:
    res = n - max(aa[0][1]+bb[1][1], aa[1][1]+bb[0][1])
else:
    res = n - aa[0][1] - bb[0][1]
print(res)


Measured memory_bytes: 21184
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()

int s[200001], x[200001];

int subsum(int l, int r) {
  if (l > 0)
    return s[r] - s[l - 1];
  else
    return s[r];
}

int subxor(int l, int r) {
  if (l > 0)
    return x[r] ^ x[l - 1];
  else
    return x[r];
}

int n, a;
int sum = 0;
int xr = 0;
int l = 0;
int r = 0;
ll ans = 0;

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
  if (ci - cn == cm) {
    fread_unlocked(cn, 1, cm, stdin);
    ci = cn;
  }
  return *ci++;
}
inline int getint() {
  int A = 0;
  if (ci - cn + 16 > cm)
    while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
  else
    while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
  return A;
}

int main() {
  //
  ios::sync_with_stdio(false);
  n = getint();
  rep(i, n) {
    a = getint();
    sum += a;
    s[i] = sum;
    xr = xr ^ a;
    x[i] = xr;
  }
  while (l < n) {
    while (r < n - 1 && subsum(l, r + 1) == subxor(l, r + 1)) {
      r++;
    }
    ans += r - l + 1;
    l++;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1920
#include <stdio.h>
int main(void)
{ 
	int n,i,k[4][13],w,j;
	char md,dat[4];
	
	dat[0]='S'; dat[1]='H'; dat[2]='C'; dat[3]='D';
	
	for(i=0 ; i<13 ; i++){
		k[0][i]=0;
		k[1][i]=0;
		k[2][i]=0;
		k[3][i]=0;
	}
	scanf("%d",&n);
	
	for(i=1 ; i<=n*2 ; i++){
		scanf("%c %d",&md,&w);
		switch(md){
			case 'S':
				k[0][w-1]=1;
				break;
			case 'H':
				k[1][w-1]=1;
				break;
			case 'C':
				k[2][w-1]=1;
				break;
			case 'D':
				k[3][w-1]=1;
				break;
		}
	}
	
	for(i=0 ; i<4 ; i++){
		for(j=0 ; j<13 ; j++){
			if(k[i][j]==0)
				printf("%c %d\n",dat[i],j+1);
		}
	}
	
	return 0;
}

Measured memory_bytes: 1824
/* A - Lucky7 */

#include <stdio.h>

int main(void){
  int N, count = 0;
  scanf("%d", &N);
  while(count == 0 && N > 0){
    if(N % 10 == 7){
      count += 1;
      break;
    }else{
      N /= 10;
    }
  }

  if(count > 0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}

Measured memory_bytes: 1648
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmax(a, b) a = max(a, b);
#define chmin(a, b) a = min(a, b);
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define MOD 1000000007
int main() {
    int n;
    cin >> n;
    vector<vector<int>> dp(n+1, vector<int>(1 << n));
    dp[0][0] = 1;
    rep(i, n) rep(j, n) {
        int a;
        cin >> a;
        if (a) rep(s, 1 << n) if ((s >> j & 1) == 0) {
            dp[i+1][s | 1 << j] += dp[i][s];
            dp[i+1][s | 1 << j] %= MOD;
        }
    }
    cout << dp[n][(1 << n) - 1] << endl;
}


Measured memory_bytes: 191748
#include<stdio.h>

int main(){

   int n,i;
   int y=0;
   char s[101];

   scanf("%d",&n);
   for(i=0;i<n;i++)
      scanf("%c",&s[i]);

   for(i=0;i<n;i++)
      if(s[i]=='Y')
         y++;

   if(y==0) printf("Three");
   else printf("Four");
   return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var l = ReadLine();

            if (9 < l[0] || 9 < l[1])
            {
                Console.WriteLine("-1");
            }
            else
            {
                Console.WriteLine(l[0] * l[1]);
            }
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define fi first
#define se second
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define IT iterator 
#define vi vector<int>
#define TP template<class o>
#define SZ(a) ((int)a.size())
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int N=2e5+10,size=1<<20,mod=998244353,inf=2e9;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
    char c=gc; x=0; int f=1;
    while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
    while(isdigit(c)) x=x*10+c-'0',c=gc;
    x*=f;
}
template<class o> void qw(o x) {
    if(x/10) qw(x/10);
    putchar(x%10+'0');
}
template<class o> void pr1(o x) {
    if(x<0)x=-x,putchar('-');
    qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
    if(x<0)x=-x,putchar('-');
    qw(x); putchar('\n');
}

int n,a[N],ans;

int main() {
    qr(n);for(int i=0;i<n;i++) qr(a[i]);
    sort(a,a+n);
    for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++) if(a[i]^a[j])
            for(int k=j+1;k<n;k++)
                if(a[i]+a[j]>a[k]&&a[j]^a[k]) ans++;
    pr2(ans); 
}


Measured memory_bytes: 3640
import sys

input = sys.stdin.readline


def main():
    N = int(input())

    x, y = divmod(N, 11)
    ans = x * 2
    if 0 < y <= 6:
        ans += 1
    elif 6 < y <= 11:
        ans += 2

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.util.*;
import java.io.PrintWriter;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		for(int i=0; i<n; i++){
			a[i]=sc.nextInt();
		}
		Arrays.sort(a);
		long ans=a[n-1];
		int ind=n-2;
		int tind=n-5;;
		for(int i=n-3; i>=0; i--){
			if(i==tind){
				ind--;
				tind=i-2;
			}
			ans+=a[ind];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 60356
ch = list("abcdefghijklmnopqrstuvwxyz")

s = list(input())
t = list(input())
import numpy as np

s = np.array(s)
t = np.array(t)

flag = True
for i in ch:
  t_temp = (t[s == i])
  s_temp = (s[t == i])
  if len(set(t_temp)) > 1 or len(set(s_temp)) > 1:
    flag = False
    
if flag:print("Yes")
else:print("No")

Measured memory_bytes: 16328
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int main(){
    int K,X;
    scanf("%d %d",&K,&X);
    if(500*K>=X)
      puts("Yes");
    else
      puts("No");
  return 0;
}


Measured memory_bytes: 128
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 4e5 + 10 ;
const ll INF = 1e18 + 10 ;
int main(){
    fastio
    int n ;
    cin >> n ; 
    string s ; 
    cin >> s ; 
    int cnt = 0 ;
    for(int i = 0; i + 3 <= n; i++){
        if ( s.substr(i, 3) == "ABC" ) cnt++ ; 
    }
    cout << cnt << endl;
    return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}

/*[check]
木のパスはa-bに対して全て違う。
loopのみで構成されていないと条件を満たさない。
loopのみで構成=全偶数
*/

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> p(n);
    rep(i, m){
        int a, b; cin >> a >> b;
        a--; b--;
        p[a]++; p[b]++;
    }

    bool even = true;
    rep(i, n){
        if (p[i]%2!=0) even=false;
    }
    if(even) cout << "YES" << endl;
    else cout << "NO" << endl; 
}


Measured memory_bytes: 640
n,q=map(int,input().split())
s=input()
imos=[0]*(len(s)+1)
for i in range(len(s)-1):
  if s[i]=="A" and s[i+1]=="C":imos[i+1]+=1
  imos[i+2]=imos[i+1]

for i in range(q):
  l,r=map(int,input().split())
  print(imos[r-1]-imos[l-1])
    

Measured memory_bytes: 51544
#include<bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<iostream>
#define pb push_back
#define fi first
#define se second
#define sz(x)  x.size()
#define cl(x)  x.clear()
#define all(x)  x.begin() , x.end()
#define r(x)  scanf("%d", &x)
#define rr(x , y)  scanf("%d%d" , &x , &y)
#define rst(s)  scanf("%s" , s)
#define rl(x)  scanf("%lld" , &x)
#define rrl(x , y)  scanf("%lld%lld" , &x , &y)
#define w(x)  printf("%d" , x)
#define ww(x , y)  printf("%d %d" , x , y)
#define wl(x)  printf("%lld" , x)
#define wwl(x , y)  printf("%lld %lld" , x , y)
#define sp()  printf(" ")
#define en()  puts("")
#define rep(i , x , n)  for(int i = x ; i <= n ; i ++) 
#define per(i , n , x)  for(int i = n ; i >= x ; i --) 
#define mem0(x)  memset(x , 0 , sizeof(x))
#define mem_1(x)  memset(x , -1 , sizeof(x))
#define mem_inf(x)  memset(x , inf , sizeof(x))
#define mem__inf(x)  memset(x , -inf , sizeof(x))
#define p_queue priority_queue
#define debug(x)  printf("%d\n" , x)
#define ddebug(x , y)  printf("%d %d\n" , x , y)
using namespace std ;
//mt19937  rnd(chrono::high_resolution_clock::now().time_since_epoch().count()) ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair<int , int> pii ;
typedef pair<ll , ll> pll ;
typedef pair<int , ll> pil ;
typedef pair<ll , int> pli ;
const int inf = 0x3f3f3f3f ;
const int maxn = 3e5 + 5 ;
const int maxm = 2e6 + 5 ;
const ll mod = 998244353 ;
int main()
{
	int n ;
	r(n) ;
    ll ans = 0 ;
    rep(i , 1 , n)  if(i % 3 != 0 && i % 5 != 0)  ans += i ;
    wl(ans) , en() ;
	return 0 ;
}


Measured memory_bytes: 3816
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;


int main() {
	LL A, B, C;
	cin >> A >> B >> C;
	C = min(C, A + B + 1);
	cout << B + C << endl;
	return 0;
}

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

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

using namespace std;
using ll = long long;

const int INF = 1001001001;
const int MOD = 1000000007;



int main(){
	int x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	priority_queue<ll> p, q, r;

	rep(i,a){
		int t;cin >> t;
		p.push(t);
	}
	rep(i,b){
		int t;cin >> t;
		q.push(t);
	}
	rep(i,c){
		int t;cin >> t;
		r.push(t);
	}

	ll ans = 0;
	rep(i,x){
		ll t = p.top();p.pop();
		r.push(t);
	}
	rep(i,y){
		ll t = q.top();q.pop(); 
		r.push(t);
	}
	rep(i,x+y){
		ans += r.top();r.pop();
	}

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


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

const int MAXN = 105;

int N;
int dp[3][MAXN];

int main() {
	scanf("%d", &N);
	for (int i = 1; i <= 2; i++)
		for (int j = 1; j <= N; j++) {
			int x;
			scanf("%d", &x);
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + x;
		}
	
	printf("%d\n", dp[2][N]);
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>

using namespace std;
typedef long long ll;

int main(){
    string str;
    cin>>str;
    int n = str.size();
    vector<vector<int> > dp(2, vector<int>(2019, 0));
    ll ans = 0;
    dp[0][str[0]-'0']=1;
    for(int i = 1; i<n;i++){
        int num = str[i]-'0';
        fill(dp[i&1].begin(), dp[i&1].end(), 0);
        dp[i&1][num]=1;

        for (int j = 0; j < 2019; j++) {
            int j_ = (j*10+num) % 2019;
            if(j_==0) ans += dp[(i&1) ^1][j];
            dp[i&1][j_]+=dp[(i&1) ^1][j];
        }
    }
    cout<<ans<<endl;
    return 0;

}

Measured memory_bytes: 3336
#include<iostream>
#include<math.h>
#include<algorithm>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)

using namespace std;

int main(){
	int a, b, x;
	cin >> a >> b >> x;
	if(a > x){
		cout << "NO" << endl;
	}else if(a+b < x){
		cout << "NO" << endl;
	}else{
		cout << "YES" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
ans=0
for i in range(n):
    a=list(map(int, input().split()))
    x=c
    for j in range(m):
        x+=a[j]*b[j]
    if x > 0:
        ans+=1
print(ans)

Measured memory_bytes: 38480
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		String strCom = " ";
		BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
		while(true){
			String charaStr = br.readLine();
			if (charaStr.equals("-")){
				break;
			}

			int shuffleNum =Integer.parseInt(br.readLine());

			for (int i = 0;i < shuffleNum;i++){

				int moveLength = Integer.parseInt(br.readLine());
				
				if (i == 0) {
					strCom = charaStr;
				}
				
				String str1 = strCom.substring(0, moveLength);
				String str2 = strCom.substring(moveLength, strCom.length());

				strCom = str2.concat(str1);
			}
			System.out.println(strCom);
		}
	}
}

Measured memory_bytes: 24232