akhauriyash/Code-Regression huggingface dataset:
n = int(input())
for i in range(1,n+1):
    if i % 3 == 0:
        print(" {0}".format(i), end="")
    else:
        x = i
        while x != 0:
            if x % 10 == 3:
                print(" {0}".format(i), end="")
                break;
            x //= 10;
print("")


Measured memory_bytes: 5868
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(char, a);
    YES(toupper(a) == a, "A", "a");
}

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

namespace ABC_Training
{

    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var result = Program.Prediction(s);
            Console.WriteLine(result);
        }
        const string SUN = "Sunny";
        const string CLO = "Cloudy";
        const string RAI = "Rainy";
        private static string Prediction(string s)
        {
            if (s == SUN) return CLO;
            if (s == CLO) return RAI;
            return SUN;
        }
    }
}


Measured memory_bytes: 11092
import sys
sys.setrecursionlimit(10**5)
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
        self.weight = [0]*(n+1)
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            r = self.Find_Root(self.root[x])
            self.weight[x] += self.weight[self.root[x]]
            self.root[x] = r
            return r
    def GetWeight(self, x):
        self.Find_Root(x)
        return self.weight[x]
    def Unite(self, x, y, w):
        w += self.GetWeight(x)
        w -= self.GetWeight(y)
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        if(x == y):
            return False
        if self.rnk[x] < self.rnk[y]:
            x, y = y, x
            w = -w
        if self.rnk[x] == self.rnk[y]:
            self.rnk[x] += 1
        self.root[y] = x
        self.weight[y] = w
        return True
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)
    def Count(self, x):
        return -self.root[self.Find_Root(x)]
    def Diff(self, x, y):
        return self.GetWeight(y) - self.GetWeight(x)

N, M = map(int, input().split())
uf = UnionFind(N+1)
for _ in range(M):
    l, r, d = map(int, input().split())
    if not uf.isSameGroup(l, r):
        uf.Unite(l, r, d)
    else:
        if uf.Diff(l, r) != d:
            print('No')
            exit()

print('Yes')


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

int main(){
    int h, m, s;
    cin >> s;
    
    h = s / 3600; s %= 3600;
    m = s / 60; s %= 60;
    
    cout << h << ":" << m << ":" << s << endl;
    
    return 0;
}

Measured memory_bytes: 1164
N, A = map( int, input().split())
X = list( map( int, input().split()))
dp = [ [0]*(50*N+1) for _ in range(N+1)]
dp[0][0] = 1
for k in range(N):
    x = X[k]
    for i in range(N-1,-1,-1):
        for j in range(50*N+1-x):
            dp[i+1][x+j] += dp[i][j]
ans = 0
for i in range(1,N+1):
    ans += dp[i][i*A]
print(ans)


Measured memory_bytes: 42476
# coding: utf-8

bound, check = map(int,input().split())

l = list(map(int,input().split()))

now = 0
if now <= check:
    count = 1
else :
    count = 0
for i in range(bound):
    now += l[i]
    if now <= check:
        count += 1

print(count)

Measured memory_bytes: 3060
/*

    author : s@if

*/

#include<bits/stdc++.h>
using namespace std;
#define NIL -1
#define fi first
#define sec second
#define MAX INT_MAX
#define INF 99999999
#define ll long long
#define PI acos(-1.0)
#define MOD 1000000007
#define PLL pair<ll,ll>
#define PII pair<int,int>
#define ull unsigned long long
#define triplell pair<pair<ll,ll> , ll>
#define triple pair<pair<int,int> , int>
#define For(i,n) for(int i=0;i<(int)n;i++)
#define Forn(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define forba(i,a,b) for(int i=(int)b;i>=(int)a;i--)

bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)1e5+9;
char ch[1009][1009];
int n, m , cnt;

bool chekh(int x, int y)
{
    if(x>=0 && x<n && y>=0 && y<m)
        return true;

    return false;
}

void solve(vector<PII>v1)
{
    int i, j ;

    while(1)
    {
      /*  for(int i = 0;i<v1.size();i++)
            cout<<v1[i].fi<<" "<<v1[i].sec<<endl;

            cout<<endl<<endl; */

        vector<PII>v2;

        bool flag = false;

        for(int i=0;i<v1.size();i++)
        {
            PII u = v1[i];

            for(int j=0;j<4;j++)
            {
                int nx = u.fi+dx[j];
                int ny = u.sec+dy[j];

                if(chekh(nx,ny) && ch[nx][ny]=='.')
                {
                    if(!flag)
                    {
                        cnt++;
                        flag = true;
                    }
                    ch[nx][ny] = '#';
                    v2.push_back(PII(nx,ny));
                }
            }
        }

        v1 = v2;

        if(v2.size()==0)
            return ;
    }

    return ;
}

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,p,q,x,y,u,v,r,tc,t;

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

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

     cnt = 0;

    vector<PII>v1;

    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            if(ch[i][j]=='#')
            {
                v1.push_back(PII(i,j));
            }
        }
    }

   // memset(vis,0,sizeof(vis));
    solve(v1);

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

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  ll n;cin>>n;
  ll x[n];rep(i,0,n)cin>>x[i];
  sort(x,x+n);

  ll ans=INF;

  ll l=0,r=101;
  ll k=500;
  while(k--){
  // while(r-l>1){
    ll c1=(2*l+r)/3;
    ll c2=(l+2*r)/3;

    ll sum[2];CLR(sum,0);
    rep(i,0,n){
      sum[0]+=(c1-x[i])*(c1-x[i]);
      sum[1]+=(c2-x[i])*(c2-x[i]);
    }
    chmin(ans,min(sum[0],sum[1]));
    // out(c1<<":"<<c2);
    if(sum[0]>sum[1])l=c1;
    else if(sum[0]<sum[1])r=c2;
    else break;
  }

  out(ans);

  return 0;
}


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

int main()
{
    int A, B, K;
    int count = 0;
    int res;

    std::cin >> A >> B >> K;

    for (int i = std::max(A, B); i >= 1; --i)
    {
        if (A % i == 0 && B % i == 0)
        {
            if (++count == K)
            {
                res = i;
                break;
            }
        }
    }
    std::cout << res << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
//#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i <= n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i <= n; i++)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std;

int main(void)
{
    string s;
    cin >> s;

    if(s[0] == s[1] && s[1] == s[2]) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}
/** atcoder **/


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	  if(a==b && b==c)
	    cout<<"No";
    else if(a==b || b == c || a==c)
	 {
	 	cout<<"Yes";
	 	
	 }

     else
         cout<<"No";
}


Measured memory_bytes: 888
#include<stdio.h>
int x[1000000];
int main()
{
    int n,k,a,i,j,l,m,o,p,ans=0,q,r,s;
    scanf("%d %d",&n,&m);
    for(i=1; i<=n; i++)
    {
        scanf("%d",&k);
        for(j=1; j<=k; j++)
        {
            scanf("%d",&l);
            x[l]++;
        }
    }
    for(i=1;i<=m;i++)
    {
        if(x[i]==n) ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

int main() {
    string s;
    cin >> s;
    ll X, Y;
    cin >> X >> Y;
    vector<ll> hori, vert;
    vector<ll>* now = &hori;
    vector<ll>* next = &vert;
    ll cnt = 0;
    for (ll i = 0; i < s.size(); i++) {
        if (s[i] == 'T') {
            now->push_back(cnt);
            cnt = 0;
            swap(now, next);
        } else {
            cnt++;
        }
    }
    now->push_back(cnt);
    reverse(hori.begin(), hori.end());
    /*
     for (ll i = 0; i < vert.size(); i++) {
     cout << vert[i] << " ";
     }
     cout << endl;
     */
    bool fail = false;
    for (ll i = 0; i < 2; i++) {
        if (fail) {
            continue;
        }
        ll dst = (i == 0) ? X : Y;
        vector<ll>* segs = (i == 0) ? &hori : &vert;
        ll sum = accumulate(segs->begin(), segs->end(), 0);
        if (segs->empty()) {
            fail = fail || (dst != 0);
            continue;
        }
        if (i == 0) {
            dst -= segs->back();
            sum -= segs->back();
            segs->pop_back();
        }
        if (segs->empty()) {
            fail = fail || (dst != 0);
            continue;
        }
        if (!(-sum <= dst && dst <= sum)) {
            fail = true;
            continue;
        }
        auto dp = make_vec_nd(false, segs->size() + 1, 2 * sum + 1);
        dp[0][sum] = true;
        for (ll seg_n = 1; seg_n <= segs->size(); seg_n++) {
            for (ll n = -sum; n <= sum; n++) {
                ll idx = n + sum;
                if (idx - (*segs)[seg_n-1] >= 0) {
                    dp[seg_n][idx] = dp[seg_n][idx]
                    || dp[seg_n-1][idx - (*segs)[seg_n-1]];
                }
                if (idx + (*segs)[seg_n-1] <= 2 * sum) {
                    dp[seg_n][idx] = dp[seg_n][idx]
                    || dp[seg_n-1][idx + (*segs)[seg_n-1]];
                }
                // cout << "dp[" << seg_n << "][" << idx << "] = " << dp[seg_n][idx] << endl;
            }
        }
        fail = fail || !dp[segs->size()][dst + sum];
    }
    if (fail) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}



Measured memory_bytes: 2304
from collections import deque
N,M = map(int, input().split())
rooms = [[] for _ in range(N)]

for _ in range(M):
    a, b= map(int,input().split())
    a -= 1
    b -= 1
    rooms[a].append(b)
    rooms[b].append(a)
reached = [-1]*N
def bfs():
    d = deque() 
    d.append(0)
    reached[0] = 0
    while d:
        # 現在の部屋
        now = d.popleft()
        for i in rooms[now]:
            # すでにその部屋を訪れていない
            if reached[i] == -1:
                reached[i] = now
                d.append(i)
bfs()
print('Yes')
for i in range(1,N):
    print(reached[i]+1)







Measured memory_bytes: 34064
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,count=0;
  string str;

  cin>>n;
  cin>>str;

  if(n%2!=0){ cout<<"No"<<endl; return 0; }
  else{
    n/=2;
    for(int i=0;i<n;i++){
      if(str[i]==str[i+n]) count++;
    }
  }

  if(count==n) cout<<"Yes"<<endl;
  else cout<<"No"<<endl; 

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
#define endl '\n'
using ll = long long;
#define int ll
using db = long double;
using ii = pair<int, int>;

const int N = 1e5 + 5, LG = 19, MOD = 998244353;
const int SQ =320;
const long double EPS = 1e-7;
set<int>st[10];
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
  int n,m;
  cin>>n>>m;
  for(int i = 0, s, c;i<m;i++){
      cin>>s>>c;
    st[s].insert(c);
  }
  f(i,1,n+1)if(st[i].size()>1){
    cout<<-1<<'\n';
    return 0;
  }
  if(st[1].count(0)&&n!=1){
    cout<<-1<<'\n';
    return 0;
  }

  f(i,1,n+1){
    if(st[i].empty())
      cout<<0+(i==1)-(n==1);
    else
      cout<<*st[i].begin();
  }

  return 0;
}


Measured memory_bytes: 256
n = input()

remainder = [0]*2019
remainder[0] += 1
x = 1
rem = 0

for i in range(1, len(n)+1):
	rem = (rem + int(n[-i])*x)%2019
	remainder[rem] += 1
	x *= 10
	x %= 2019
    
res = 0
for e in remainder:
	res += e*(e-1)//2

print(res)

Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
using P = pair<int,int>;
using ll = long long;
static const int INF = 1000000000;
static const ll MOD = 1000000007;
ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll a, b, c, k;
  cin >> a >> b >> c >> k;

  ll ans = 0;
  ans = min(a, k);

  k -= a;
  if(k > 0){
    k -= b;
    if(k > 0){
      ans -= min(c, k);
    }
  }

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

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

#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1000003;
const ll INF = 1e18;
const int inf = 1e9;

const int MAX = mod;
ll fac[MAX], finv[MAX], inv[MAX];

void cominit()
{
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (ll i=2; i<MAX; i++) {
    fac[i] = fac[i-1] * i % mod;
    inv[i] = mod - inv[mod%i] * (mod/i) % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}

ll com(ll n, ll k)
{
  if (n<k) return 0;
  if (n<0 || k<0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

ll modpow(ll a, ll n)
{
  ll res=1;
  while (n>0) {
    if (n&1) res = res*a % mod;
    a = a*a % mod;
    n >>= 1;
  }
  return res;
}

void solve()
{
  cominit();
  int q; cin>>q;
  vector<ll> ans(q);
  for (int i=0; i<q; i++) {
    ll x, d, n;
    cin >> x >> d >> n;

    if (d==0) {
      ans[i] = modpow(x,n);
      continue;
    }

    ll p = x * inv[d] % mod;
    if (p+n-1 >= mod) {
      ans[i] = 0;
      continue;
    }

    ll tmp = modpow(d,n);
    tmp = tmp * fac[p+n-1] % mod;
    if (p>0) tmp = tmp * finv[p-1] % mod;
    ans[i] = tmp;
  }
  for (int i=0; i<q; i++) {
    cout << ans[i] << endl;
  }
}

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


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


int main() {
	int n, a, b; std::cin >> n >> a >> b;
	std::cout << std::min(a * n, b) << std::endl;
}

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

#define ms(s,n) memset(s,n,sizeof(s))
#define all(a) a.begin(),a.end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mk make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;

const int MOD = (int) 1e9+7;
const int INF = (int) 1e9+1;
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}


int main(){
	int n;
	cin>>n;
	if(n%1000==0){
		cout<<0<<endl;
	}
	else{
		cout<<1000-n%1000<<endl;
	}
	return 0;
}


Measured memory_bytes: 3620
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

int main(void){

    ll N,K; cin>>N>>K;
    ll ans = 0;
    ans = (N/K) * (N/K) * (N/K);
    ll tmp = (N/(K/2))-(N/K);
    if(K%2==0) ans += tmp*tmp*tmp;

    cout<<ans<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 998244353;
constexpr int inf = 3e18;

int mod_pow(int x,int y,int m=mod){
	int res=1;
	while(y>0){
		if(y&1)(res*=x)%=m;
		(x*=x)%=m;
		y>>=1;
	}
	return res;
}
int N;
bool query(int n){
	cout<<"? "<<n<<endl;
	char c;cin>>c;
	return c=='Y';
	/*if(n<=N){
		return to_string(n)<=to_string(N);
	}
	return to_string(n)>to_string(N);*/
}
void answer(int n){
	cout<<"! "<<n<<endl;
	/*if(N!=n){
		assert(0);
	}*/
}
void solve(){
	if(query(mod_pow(10,12,inf))){
		for(int i=10;i>0;i--){
			if(!query(mod_pow(10,i,inf)-1)){
				answer(mod_pow(10,i,inf));
				return;
			}
		}
		answer(1);return;
	}
	rep(i,10){
		if(query(mod_pow(10,i,inf))&&query(mod_pow(10,i+1,inf)-1))
			if(!query((mod_pow(10,i+1,inf)-2)*10)){
					answer(mod_pow(10,i+1,inf)-1);
					return;
			}
	}
	int i=10;
	while(i>=0){
		if(query(mod_pow(10,i,inf))&&query(mod_pow(10,i+1,inf)-1)){
			break;
		}
		i--;
	}
	int ng=mod_pow(10,i,inf)-1,ok=mod_pow(10,i+1,inf)-1;
	while(ok-ng>1){
		int mid=(ok+ng)/2;
		if(query(mid*10))ok=mid;
		else ng=mid;
	}
	answer(ok);
}
signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	/*REP(i,1000){
		N=i;
		solve();
	}*/
	solve();
}


Measured memory_bytes: 3692
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int , int>
#define fast ios_base::sync_with_stdio(0)
#define mx 3002
ll arr[mx], dp[mx][mx][2];
int n;
ll fun(int b, int e, int turn)
{
    turn%=2;
    if(b>e) return 0;
    ll& ret = dp[b][e][turn];
    if(ret!=-1) return ret;
    if(turn==0){
        turn++;
        ret = max(arr[b] + fun(b+1, e, turn), arr[e] + fun(b, e-1, turn));
    }
    else{
        turn++;
        ret = min(-arr[b] + fun(b+1, e, turn), -arr[e] + fun(b, e-1, turn));
    }
    return ret;
}
int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
        scanf("%lld",&arr[i]);
    memset(dp, -1, sizeof dp);
    printf("%lld\n",fun(1,n,0));
}



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


int main()
{
	int A,B;
	cin>>A>>B;
	cout<<A*B<<endl;
	return 0;
}


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

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

using namespace std;

int main(){
  ll h;cin>>h;
  ll result=0,c=1;
  while(h>0){
    result+=c;
    c*=2;
    h/=2;
  }

  cout<<result;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<queue>

using namespace std;

static const int N=100;
static const int INF=(1<<21);
int n, MA[N][N];
int d[N];

void Bfs(int s){
  queue<int> q;
  q.push(s);

  for(int i=0; i<n; i++)
  d[i]=INF;

  d[s]=0;
  int u;

  while(!q.empty())
  {
    u=q.front();
    q.pop();

    for(int v=0; v<n; v++)
    {
      if(MA[u][v]==0)
        continue;
      if(d[v] != INF)
        continue;
      d[v]=d[u]+1;
      q.push(v);
    }
  }
  for(int i=0; i<n; i++)
  {
    cout << i+1 << " " <<((d[i] == INF) ? (-1) : d[i]) << endl;
  }
}

int main(){
  int u, k, v;

  cin >> n;

  for(int i=0; i<n; i++)
  {
    for(int j=0; j<n; j++)
      MA[i][j]=0;
  }

  for(int i=0; i<n; i++)
  {
    cin >> u >> k;
    u--;
    for(int j=0; j<k; j++)
    {
      cin >> v;
      v--;
      MA[u][v]=1;
    }
  }

  Bfs(0);

  return 0;
}



Measured memory_bytes: 3140
#include <algorithm>
#include <iostream>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

#define INF 1000000000

using namespace std;

class UnionFind {
public:
    UnionFind(int n) : parent_(n), rank_(n) {
        for (int i = 0; i < n; ++i) {
            parent_[i] = i;
            rank_[i] = 0;
        }
    }

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

    void unite(int x, int y) {
        x = find(x);
        y = find(y);

        if (x == y) return;

        if (rank_[x] < rank_[y]) {
            parent_[x] = y;
        } else {
            parent_[y] = x;
            if (rank_[x] == rank_[y]) rank_[x]++;
        }
    }

    bool same(int x, int y) { return find(x) == find(y); }

    vector<int> parent_, rank_;
};

class Kruskal {
public:
    struct edge {
        int u, v, cost;
    };

    vector<edge> edges_;
    int v_;

    Kruskal(int v) : v_(v) {}

    void add_edge(int u, int v, int cost) { edges_.push_back((edge){u, v, cost}); }

    int kruskal() {
        sort(edges_.begin(), edges_.end(), comp);

        UnionFind uf(v_);

        int res = 0;

        for (const edge& e : edges_) {
            if (!uf.same(e.u, e.v)) {
                uf.unite(e.u, e.v);
                res += e.cost;
            }
        }

        return res;
    }

    static bool comp(const edge& e1, const edge& e2) { return e1.cost < e2.cost; }
};

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

    vector<pair<int, int>> city;

    REP(i, N) {
        int x, y;
        cin >> x >> y;
        city.emplace_back(x, y);
    }

    vector<pair<int, int>> X, Y;

    REP(i, N) {
        X.emplace_back(city[i].first, i);
        Y.emplace_back(city[i].second, i);
    }

    Kruskal kruskal(N);

    sort(ALL(X));
    sort(ALL(Y));

    REP(i, X.size() - 1) {
        kruskal.add_edge(X[i].second, X[i + 1].second, abs(X[i].first - X[i + 1].first));
        kruskal.add_edge(X[i + 1].second, X[i].second, abs(X[i].first - X[i + 1].first));
    }

    REP(i, Y.size() - 1) {
        kruskal.add_edge(Y[i].second, Y[i + 1].second, abs(Y[i].first - Y[i + 1].first));
        kruskal.add_edge(Y[i + 1].second, Y[i].second, abs(Y[i].first - Y[i + 1].first));
    }

    cout << kruskal.kruskal() << endl;

    return 0;
}


Measured memory_bytes: 11412
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iterator>
#include <functional>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstdio>
using namespace std;
#define sz(a)  int((a).size())
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define CLR(a) memset((a), 0, sizeof(a))
#define INF (1 << 31) - 1
const int dh[8] = {-1, 1, 0, 0,1,1,-1,-1};
const int dw[8] = {0, 0, 1, -1,1,-1,1,-1};
typedef long long ll;
typedef pair<int, int> p;
typedef vector <int> VI;
typedef vector <string> VS;

VI LEVEL;
vector <VI> table;

int rec(int n){
	if(LEVEL[n] != -1) return LEVEL[n];
	
	if(table[n].size() == 0){
		return LEVEL[n] = 0;
	}
	
	VI tmp;
	for(int i = 0; i < table[n].size(); i++){
		tmp.pb(rec(table[n][i]));		
	}
	sort( all(tmp) , greater<int>());

	int lvl = 0;
	for(int i = 0; i < tmp.size(); i++){
		lvl = max(lvl , i + 1 + tmp[i]);
	}
	
	return LEVEL[n] = lvl;
}

int main(){

	table.clear();
	LEVEL.clear();
	int n;
	cin >> n;
	LEVEL.resize(n+1);
	table.resize(n+1);
		
	for(int i = 1; i < n + 1; i++){
		LEVEL[i] = -1;
		if(i == n) break;
		int tmp;
		cin >> tmp;
		
		table[tmp].pb(i+1);
	}

	cout << rec(1) << endl;

	return 0;	
}


Measured memory_bytes: 15488
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iomanip>


#define log(x) cout<<x<<endl
#define pb push_back
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;


// <<fixed<<setprecision(6)<<


int gcd(lint x, lint y){
  return y==0 ? x:gcd(y,x % y);
}


int digsum(int n) {
  int res = 0;
  while(n > 0) {
    res += n%10;
    n /= 10;
  }
  return res;
}


int dignum(int n) {
  int res = 0;
  while(n > 0) {
    res++;
    n /= 10;
  }
  return res;
}


int stringcount(string s, char c) {
  return count(s.cbegin(), s.cend(), c);
}


int lcm(lint x, lint y){
  return x/ gcd(x, y) * y;
}


int combi(int n, int r){
  int num = 1;
  for(int i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}


int main(){
  lint a,b,n;
  cin>>a>>b>>n;
  lint x;
  double result=0;
  x=n;
  if(x>=b) x=b-1;
  lint count=0;
  for(lint i=x;count<20000000;count++){
    result=max(result,floor(a*x/b)-a*floor(x/b));
  }
  cout<<result;
}

Measured memory_bytes: 3784
#include <iostream>
#include <queue>
#include <vector>
#define SHN 1000000ll
using namespace std;
int n;
vector<int> d1(100010,SHN),d2(100010,SHN);
vector<int> edge[100010];
void bfs(vector<int> &d,int s)
{
	queue<int> q;
	q.push(s);
	d[s]=0;
	while (!q.empty())
	{
		int x=q.front(); q.pop();
		int t=d[x];
		for (int i=0;i<edge[x].size();i++)
		{
			int xi=edge[x][i];
			if (d[xi]>t+1) d[xi]=t+1,q.push(xi);
		}
	}
}
int main()
{
	cin >>n;
	for (int i=1;i<n;i++)
	{
		int x,y;
		cin >>x>>y;
		x--,y--;
		edge[x].push_back(y);
		edge[y].push_back(x);
	}
	bfs(d1,0);
	bfs(d2,n-1);
	int r1=0,r2=0;
	for (int i=0;i<n;i++)
	{
		//cout <<d1[i]<<" "<<d2[i]<<"\n";
		if (d1[i]<=d2[i]) r1++;
		else r2++;
	}
	cout <<(r1>r2 ? "Fennec" : "Snuke");
	return 0;
}

Measured memory_bytes: 6656
#include <stdio.h>
int main(void){
    int N,i,sum_ppl;
    scanf("%d",&N);
    for (i=1;i<=N;i++){
        int l,r;
        scanf("%d %d",&l,&r);
        sum_ppl=sum_ppl+r-l+1;
    }
    printf("%d",sum_ppl);
    return 0;
}

Measured memory_bytes: 128
///God help me.

#include<bits/stdc++.h>

using namespace std;

pair<int,int>red[1000];
pair<int,int>blu[1000];

bool com(pair<int,int>a, pair<int,int>b){
    if(a.first < b.first)return true;
    else return false;
}

bool com2(pair<int,int>a, pair<int,int>b){
    if(a.second < b.second)return true;
    else return false;
}

int main()
{
    int n;
    cin >> n;
    for(int i = 0; i<n; i++){
        cin >> red[i].first >> red[i].second;
    }
    for(int i = 0; i<n; i++){
        cin >> blu[i].first >> blu[i].second;
    }
    sort(red,red+n,com);
    sort(blu,blu+n,com2);
    int ans = 0;
    bool visit[1000];
    for(int i = 0; i<=n; i++)visit[i] = false;
    for(int i = n-1; i>=0; i--){
        for(int j = 0; j<n; j++){
            if(red[i].first < blu[j].first && red[i].second < blu[j].second && visit[j] == false){
                visit[j] = true;
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define exists(x,m) m.find(x) != m.end()
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

vll primes_up_to(ll lim) {
	vll primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
					41, 43, 47, 53, 59, 61, 67, 71};
	if (lim <= 71) return {primes.begin(), upper_bound(all(primes), lim)};
	for (int num = 73; num <= lim; num++) {
		bool is_prime = true;
		for (int i = 0; primes[i]*primes[i] <= num; i++) {
			if (num % primes[i] == 0) {
				is_prime = false;
				break;
			}
		}
		if (is_prime) primes.pb(num);
	}	
	return primes;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	vi A = vi();
	int maxx = 0;
	rep(i, n) {
		int x; cin >> x;
		A.pb(x);
		maxx = max(maxx, x);
	}	
	vll primes = primes_up_to(1e6);
	umap<int, int> prime_freq = umap<int, int>();
	for (const int& a : A) {
		int b = a;
		for (int i = 0; primes[i]*primes[i] <= b; i++) {
			if (b % primes[i] == 0) prime_freq[primes[i]]++;
			while(b % primes[i] == 0) b /= primes[i];
		}
		if (b != 1) prime_freq[b]++;
	}
	int max_freq = 0;
	for (const auto& [p, freq] : prime_freq) {
		max_freq = max(max_freq, freq);
	}
	if (max_freq <= 1) {
		cout << "pairwise coprime";
	} else {
		cout << (max_freq < n ? "setwise coprime" : "not coprime");
	}
}

Measured memory_bytes: 10940
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處

double s(LL n) {
    LL c = n;
    LL d = 0;
    while (c > 0) {
        d += (c % 10);
        c /= 10;
    }
    return d;
}

double snuke(LL n) {
    return double(n) / s(n);
}

int main() {
    // printf("%lf\n", pow(10LL, 15LL));
    int k;
    scanf("%d", &k);
    int count = 0;

    LL interval = 1;
    LL x = 1;
    while (count < k) {
        if (snuke(x) <= (double)interval) {
        // if (snuke(x) <= snuke(x + interval)) {
            printf("%lld\n", x);
            x += interval;
            count++;
        } else {
            x -= interval;
            interval *= 10;
            x += interval;
        }
    }
}


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

static class DroppingInk
{
    static void Main()
    {
        var drops = new[]
        {
            new[]
            {
                new[] { 0, 0, 0, 0, 0 },
                new[] { 0, 0, 1, 0, 0 },
                new[] { 0, 1, 1, 1, 0 },
                new[] { 0, 0, 1, 0, 0 },
                new[] { 0, 0, 0, 0, 0 },
            },
            new[]
            {
                new[] { 0, 0, 0, 0, 0 },
                new[] { 0, 1, 1, 1, 0 },
                new[] { 0, 1, 1, 1, 0 },
                new[] { 0, 1, 1, 1, 0 },
                new[] { 0, 0, 0, 0, 0 },
            },
            new[]
            {
                new[] { 0, 0, 1, 0, 0 },
                new[] { 0, 1, 1, 1, 0 },
                new[] { 1, 1, 1, 1, 1 },
                new[] { 0, 1, 1, 1, 0 },
                new[] { 0, 0, 1, 0, 0 },
            },
        };

        var q =
            from d in Console.In.ReadToEnd()
                .Split( 
                    new[] { '\r', '\n' }, 
                    StringSplitOptions.RemoveEmptyEntries )
                .Select( x => Array.ConvertAll( x.Split( ',' ), int.Parse ) )
            select
                from y in Enumerable.Range( 0, 10 )
                from x in Enumerable.Range( 0, 10 )
                select d[1] - 2 <= y && y <= d[1] + 2
                    ? d[0] - 2 <= x && x <= d[0] + 2 
                        ? drops[d[2] - 1][y - d[1] + 2][x - d[0] + 2] 
                        : 0
                    : 0;
        q
            .Select( x => x.ToArray() )
            .Aggregate( 
                Enumerable.Repeat( 0, 100 ),
                (x, y) => x.Select( (z, i) => z + y[i] ) )
            .Aggregate(
                new int[2],
                (x, y) => y > 0
                    ? new[] { x[0], Math.Max( x[1], y ) }
                    : new[] { x[0] + 1, x[1] } )
            .ToList()
            .ForEach( Console.WriteLine );
    }
}

Measured memory_bytes: 6244
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

#define MAXN 100005

int d[MAXN];

bool isPrime(int x) {
    if (x == 0 || x == 1) return false;
    if (x == 2) return true;

    for (int i = 2; i * i <= x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}

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

    for (int i = 3; i < MAXN; i += 1) {
        d[i] += d[i - 1];
        if (i % 2 != 0 && isPrime(i) && isPrime((i + 1) / 2)) {
            d[i]++;
        }
    }

    rep(i, q) {
        int l, r;
        cin >> l >> r;
        cout << d[r] - d[l-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define ll long long int
#define ld long double
#define pb push_back 
#define ff first 
#define ss second
#define all(c) c.begin(), c.end()
#define sz(z) (int)z.size()
#define rep(i,a,b) for(int i=a; i<b; ++i)
#define rev(i,a,b) for(int i=a; i>=b; i--)
//Debugging tools 
#define debug(v) cout<<#v<<endl;for(ll i=0; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl;
#define debugn(v,n) cout<<#v<<endl;for(ll i=0; i<n; i++) cout<<v[i]<<" "; cout<<endl;
#define deb(sum) cout<<#sum<<" = "<<sum<<endl;
//Predefined values
#define INF (ll)243000000000000001
#define endl "\n"
#define pi 3.142857142857143
const ll MOD = 1e9 + 7;


int main() { 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.in","r",stdin);
        freopen("output.in","w",stdout);
    #endif
    int t=1;    
    //cin>>t;
    while(t--){
        int x;
        cin>>x;
        cout<<(x^1)<<endl;
    }
    return 0;
}
        
        

















Measured memory_bytes: 3616
#include <iostream>
 
using namespace std;
int main(void){
        int d;
        while(true){
                cin >>d;
                if(cin.eof())
                  break;
                int total=0;
                for(int i=d; i<600; i+=d)
                        total+=d*i*i;
                cout << total << endl;
        }
        return 0;
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();

        int amari =  N % 500;

        System.out.println(amari <= A ? "Yes" : "No");
    }

}

Measured memory_bytes: 23764
from collections import Counter

n = int(input())
a = list(map(int, input().split()))

c = Counter(a)
sm = 0
for v in c.values():
    sm += v * (v - 1) // 2

for e in a:
    v = c[e]
    ans = sm - v * (v - 1) // 2 + (v - 1) * (v - 2) // 2
    print(ans)



Measured memory_bytes: 26772
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

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


int rec(int a, int b, int c) {
	if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) return 0;
	if (a == b && b == c && c == a) return -1;

	return rec((b + c) / 2, (c + a) / 2, (a + b) / 2) + 1;
}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	

	cout << rec(a,b,c) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MODk = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    int n;
    while(cin >> n){
        if(n == 0)return 0;
        vector<vector<int>> field(21, vector<int>(21));
        for(int a = 0;a < n;a++){
            int b,c;cin >> b >> c;
            field.at(b).at(c) = 1;
        }
        field.at(10).at(10) = 0;
        int x = 10,y = 10;
        int m;cin >> m;
        for(int i = 0;i < m;i++){
            char c;
            int d;
            cin >> c >> d;
            if(c == 'E'){
                for(int j = 0;j < d;j++){
                    x++;
                    field.at(x).at(y) = 0;
                }
            }
            if(c == 'W'){
                for(int j = 0;j < d;j++){
                    x--;
                    field.at(x).at(y) = 0;
                }
            }
            if(c == 'N'){
                for(int j = 0;j < d;j++){
                    y++;
                    field.at(x).at(y) = 0;
                }
            }
            if(c == 'S'){
                for(int j = 0;j < d;j++){
                    y--;
                    field.at(x).at(y) = 0;
                }
            }
        }
       // cout<<n<<" "<<m<<endl;
        bool f = 0;
        for(int a = 0;a < 21;a++){
            for(int b = 0;b < 21;b++){
                if(field.at(a).at(b)){
            //        cout<<"No"<<endl;
                    f = 1;
                    break;
                }
            }
            if(f)break;
        }
        if(f)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
}



Measured memory_bytes: 3036
/*
	Powered by C++11.
	Author : Alex_Wei.
*/

#include <bits/stdc++.h>
using namespace std;

//#pragma GCC optimize(3)
//#define int long long

#define ll long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb emplace_back
#define all(x) x.begin(),x.end()
#define sor(x) sort(all(x))
#define rev(x) reverse(all(x))
#define mem(x,v) memset(x,v,sizeof(x))

// Templates start.

namespace IO{
	char buf[1<<21],*p1=buf,*p2=buf,obuf[1<<23],*O=obuf;
	#ifdef __WIN32
		#define gc getchar()
	#else
		#define gc (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
	#endif
	#define pc(x) (*O++=x)
	#define flush() fwrite(obuf,O-obuf,1,stdout)

	inline int read(){
		int x=0,sign=0; char s=gc;
		while(!isdigit(s))sign|=s=='-',s=gc;
		while(isdigit(s))x=(x<<1)+(x<<3)+(s-'0'),s=gc;
		return sign?-x:x;
	}
	void print(int x) {if(x>9)print(x/10); pc(x%10+'0');}
}

namespace math{
	const int mod=998244353;
	const int maxn=1e6+5;

	ll ksm(ll a,ll b){ll s=1,m=a; while(b){if(b&1)s=s*m%mod; m=m*m%mod,b>>=1;} return s;}
	ll inv(ll x){return ksm(x,mod-2);}

	ll fc[maxn],ifc[maxn];
	void init_m(int n){
		fc[0]=1; for(int i=1;i<=n;i++)fc[i]=fc[i-1]*i%mod;
		ifc[n]=inv(fc[n]); for(int i=n-1;i>=0;i--)ifc[i]=ifc[i+1]*(i+1)%mod;
	}
	ll C(ll n,ll m){return fc[n]*ifc[m]%mod*ifc[n-m]%mod;}
}

// Templates end. Please give me more points.

using namespace IO;
//using namespace math;

const int N=2e5+5;

int n,a[N],t;

int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],t^=a[i];
	for(int i=1;i<=n;i++)cout<<(t^a[i])<<" ";
	return 0;
}


Measured memory_bytes: 4376
import random
from copy import deepcopy

d = int(input())
c = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(d)]

ans = []

for i in range(d):
    ans.append(s[i].index(max(s[i]))+1)

def score(l):
    lastd = [0]*26
    point = 0
    for j,k in enumerate(l):
        kk = k-1
        point += s[j][kk]
        lastd[kk] = j+1
        for l in range(26):
            point -= c[l]*(j+1-lastd[l])
    return point

ma = score(ans)

def random_search():
    global ans,ma
    li = deepcopy(ans)
    D = random.randrange(0,d,1)
    Q = random.randrange(0,26,1)
    li[D] = Q+1
    if score(li) > ma:
        ans = deepcopy(li)
        ma = score(li)

for i in range(20000):
    random_search()

for i in ans:
    print(i)

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

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

constexpr int MOD = int(1e9 + 7);
constexpr int INF = int(1e9 + 1);
constexpr ll LLINF = ll(4 * 1e18 + 1);
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int a, b;
    cin >> a >> b;
    int ans = 0;
    if(a >= b){
        ans += a;
        --a;
    }
    else{
        ans += b;
        --b;
    }
    if(a >= b){
        ans += a;
        --a;
    }
    else{
        ans += b;
        --b;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int n, m, maxl = 0, minr = 100000;
    cin >> n >> m;
    for (int i = 0, l, r; i < m; i++) {
        cin >> l >> r;
        if (l > maxl) maxl = l;
        if (r < minr) minr = r;
    }
    cout << max(minr - maxl + 1, 0) << endl;
}

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

using namespace std;

int ar[300];

int main() {
    int n;
    cin >> n;
    int a, b;
    cin >> a >> b;
    
    int ca, cb, cc;
    ca = cb = cc = 0;
    
    for (int i = 0; i < n; i++)
    {
        cin >> ar[i];
        if (ar[i] <= a)
        {
            ca++;
        }
        else if (ar[i] <= b)
        {
            cb++;
        }
        else
        {
            cc++;
        }
    }
    
    cout << min(ca, min(cb, cc));
}


Measured memory_bytes: 256
#include<iostream> 
#include<string> 
#include<vector> 
#include<algorithm> 
#include<cmath>
#include<set>
using namespace std; 


int main()
{

	string s;
	cin >> s;
	int al[26];
	for (int i = 0; i < 26; i++)
	{
		al[i] = 0;
	}
	for (int i = 0; i < s.size(); i++)
	{
		al[s[i] - 'a'] = 1;
	}
	for (int i = 0; i < 26; i++)
	{
		if (al[i] == 0)
		{
			cout << (char)(i+'a') << endl;
			return 0;
		}
		
	}
	cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 512
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int v[3],i;
inline void solve(){
  INS(i,3,v);
  sort(v,v+3);
  OUT(v[0]+v[1]);
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


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

int main(int argc, char const *argv[])
{
	string s;
	cin>>s;
	int ans=700;
	for (int i = 0; i < 3; ++i)
	{
		if (s[i]=='o')
		{
			ans+=100;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import itertools

N, M = [int(i) for i in input().split(' ')]

switch = []
for _ in range(M):
    tmp = list(map(int,input().split(' ')))
    switch.append(tmp[1::])

P = list(map(int,input().split(' ')))
count = 0

for onoff in itertools.product([0,1],repeat=N):
    on_count = 0
    on_count = sum(sum(onoff[i-1] for i in s) % 2 == p for s,p in zip(switch,P))
    if on_count == M:
        count += 1

print(count)
    


Measured memory_bytes: 3064