akhauriyash/Code-Regression huggingface dataset:
/*
  AUTHOR:SOURABH
  CREATED:13:09:20
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ordered_set tree<ll , null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define W while
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(it,s) for(it=s.begin();it!=s.end();it++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define mod 1000000007
#define MAXN 10000001
#define M 32

using namespace std;
using namespace __gnu_pbds;

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

    //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    ll t,x;
    t=1;
    //cin>>t;
    W(t--)
    {
        cin>>x;
        cout<<!x;
    }
}








Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
namespace Dinic{
	#define N 30005
	#define M 300005
	#define INF 0x3f3f3f3f
	struct edge{
		int flow,t,next;
	}e[M];int ecnt,head[N];
	void addedge(int f,int t,int fl){
		e[++ecnt]=(edge){fl,t,head[f]};head[f]=ecnt;
		e[++ecnt]=(edge){0,f,head[t]};head[t]=ecnt;
	}
	//----------------
	int S,T;
	int dis[N],cur[N];
	bool BFS(){
		memset(dis,0x3f,sizeof(dis));
		dis[S]=0;queue<int> que;que.push(S);
		while(!que.empty()){
			int u=que.front();que.pop();
			for(int i=head[u];i;i=e[i].next){
				if(e[i].flow!=0&&dis[e[i].t]==0x3f3f3f3f){
					dis[e[i].t]=dis[u]+1,que.push(e[i].t);
				}
			}
		}
		return dis[T]!=INF;
	}
	
	int DFS(int u,int a){
		if(u==T||a==0) return a;
		int ret=0;
		for(int &i=cur[u];i;i=e[i].next){
			if(e[i].flow==0||dis[e[i].t]!=dis[u]+1) continue;
			int f=DFS(e[i].t,a<e[i].flow? a:e[i].flow);
			if(f){
				e[i].flow-=f;e[i^1].flow+=f;
				ret+=f;a-=f;
				if(a==0) return ret;
			}
		}
		return ret;
	}
	int work(int S1,int T1){
		S=S1,T=T1;
		int ret=0;
		while(BFS()){
			memcpy(cur,head,sizeof(cur));
			ret+=DFS(S1,INF);
		}
		return ret;
	}
	void initialize(){
		ecnt=1;memset(head,0,sizeof(head));
	}
	#undef N
	#undef M
}

#define add(x,y,flow) Dinic::addedge(x,y,flow)

int h,w;
char a[105][105];
int id(int r,int c,int side){//0 -> Èëµã 1 -> ³öµã 
	return ((r-1)*w+(c-1))*2+side+1;
}
int idr[105],idc[105];
int main(){
	Dinic::initialize();
	scanf("%d%d",&h,&w);
	for(int i=1;i<=h;i++)
		scanf("%s",a[i]+1);
	int cnt=id(h,w,1);
	for(int i=1;i<=h;i++) idr[i]=++cnt;
	for(int i=1;i<=w;i++) idc[i]=++cnt;
	
	int idS,idT;
	for(int i=1;i<=h;i++)
		for(int j=1;j<=w;j++){
			if(a[i][j]=='.') continue;
			if(a[i][j]=='S')
				idS=id(i,j,1); 
			else if(a[i][j]=='T')
				idT=id(i,j,0);
			add(id(i,j,0),id(i,j,1),1);
			add(id(i,j,1),idr[i],INF);
			add(id(i,j,1),idc[j],INF);
			add(idr[i],id(i,j,0),INF);
			add(idc[j],id(i,j,0),INF);
		}
	
	int ans=Dinic::work(idS,idT);
	if(ans>=INF) ans=-1;
	printf("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int x,n;
    cin>>x>>n;
    set<int>s;
    int y;
    for(int i=-100;i<=200;i++)
    {
        s.insert(i);
    }
    for(int i=0;i<n;i++)
    {
        cin>>y;
        s.erase(y);
    }
    auto j=s.lower_bound(x);
    int mn=1e9;
    mn=*j-x;
    j--;
    if(mn>=x-*j)
    {
        cout<<*j;
        return 0;
    }
    j++;
    cout<<*j;
} 
    
 


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

int main() {
  int H, W;
  cin >> H >> W;
  W += 2;
  vector<string> A(H);
  for (int i=0; i < W; i++) {
    cout << "#";
  }
  cout << endl;
  
  for (int i=0; i < H; i++) {
    cin >> A.at(i);
    cout << "#" << A.at(i) << "#" << endl;
  }
  for (int i=0; i < W; i++) {
    cout << "#";
  }
  cout << endl;
}

Measured memory_bytes: 3628
// https://atcoder.jp/contests/abc049/tasks/arc065_a

#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))

int main() {
    int pos = 0, find = 0;
    string s, w[] = {"dream", "dreamer", "erase", "eraser"};
    cin >> s;

    // 逆順にしてから探す
    reverse(s.begin(), s.end());
    for (int i = 0; i < 4; i++) {
        reverse(w[i].begin(), w[i].end());
    }

    while (pos < s.length()) {
        find = 0;
        for (int i = 0; i < 4; i++) {
            if (s.substr(pos, w[i].length()) == w[i]) {
                pos += w[i].length();
                find = 1;
                break;
            }
        }
        if (find == 0) {
            break;
        }
    }

    if (pos == s.length()) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

#define max(x, y) ((x) > (y) ? (x) : (y))

int main(void) {
    int N, W;
    int v[100], w[100];
    int dp[10001];  // dp[i] : ??????i????¶??????????????????????????????\????????¨???????????????????????§??? => dp[0] = 0
    int i, j;

    scanf("%d %d", &N, &W);
    for( i = 0; i < N; i++ ) {
        scanf("%d %d", v + i, w + i);
    }
    for( i = 0; i <= W; i++ ) {
        dp[i] = 0;
    }

    for( i = 0; i < W; i++ ) {
        for( j = 0; j < N; j++ ) {
            if( i + w[j] <= W ) {
                dp[i + w[j]] = max(dp[i + w[j]], dp[i] + v[j]);
            }
        }
    }

    printf("%d\n", dp[W]);

    return 0;
}

Measured memory_bytes: 636
#!/usr/bin/perl
use POSIX qw(floor);

my ($n) = map { $_ - 0 } split(/\s+/,<STDIN>);
my @A = map { $_ - 0 } split(/\s+/,<STDIN>);

my @cntA = ();
$#cntA = 10**5;

my $tot = 0;
for(my $i=0;$i<$n;$i++){
  $cntA[$A[$i]]++;
  $tot += $A[$i];
}

my ($q) = map { $_ - 0 } split(/\s+/,<STDIN>);
for(my $i=0;$i<$q;$i++){
  my ($b,$c) = map { $_ - 0 } split(/\s+/,<STDIN>);
  $tot -= ( $b * ( $cntA[$b] - 0 ) );
  my $zo = ( $cntA[$b] - 0 );
  $cntA[$c] = ( $cntA[$c] - 0 ) + $zo;
  $cntA[$b] = 0;
  $tot += ( $c * $zo );
  print "$tot\n";
}


exit(0);



Measured memory_bytes: 23464
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const long long M = 10e9+7;
int main()
{
	int a,b;cin>>a>>b;
	if(a<=b)
	{
		while(b--)
		{
			cout<<a;
		}
		cout<<"\n";
	}
	else {
		while(a--)
		{
			cout<<b;
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll n;
  cin>>n;
  ll mx = 0;
  vector<pair<ll,ll> > v;
  rep(i,0,n){
    ll a;
    cin>>a;
    v.pb(mp(a,i));
    mx = max(mx,a);
  }
  sort(all(v));
  reverse(all(v));
  vector<ll> ans(n);
  rep(i,0,n){
    if(v[i].fi==mx){
      ans[v[i].se] = v[1].fi;
    }
    else{
      ans[v[i].se] = mx;
    }
  }
  rep(i,0,ans.sz){
    cout << ans[i] << endl;
  }  
  return 0;
}

Measured memory_bytes: 7276
#include<iostream>
#include<bitset>
#include<cmath>
using namespace std;
int main(){
	int weight;
	while(cin>>weight){
		bitset<10> num(weight);
		int i;
		for(i=0;num[i]==0;++i);
		cout<<pow(2.0,i);
		for(++i;i<10;++i){
			if(num[i]==1)cout<<' '<<pow(2.0,i);
		}
		cout<<endl;
	}
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;

int main() {
  string s;
  cin >> s;
  if(s == "ABC") {
    cout << "ARC" << endl;
  } else {
    cout << "ABC" << endl;
  }
  return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pll pair<ll,ll>
#define vi vector < int >
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define s(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define pf(x) printf("%d\n",x)
#define pfl(x) printf("%lld\n",x)
#define flash ios_base::sync_with_stdio(false);cin.tie(0)
#define goog(x) cout << "Case #" << x << ": "
#define MAX5 200005
#define MAX6 2000005
#define MLOG 18
#define limit 1e18
#define mod 1000000007   
void __print(int x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif


int power(int x, int y, int p){
    int res = 1;
    x = x % p;
    while (y > 0){
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

int v[MAX5];

string noOf(int x){
	int r = 0;
	string t = "";
	while(x){
		r = x % 10;
		t += (r + '0');
		x /= 10;
	}
	reverse(all(t));
	return t;
}

void solve(){
    map < string , int > m;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string x; 
        cin >> x;
        m[x]++;
    }
    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;
} 
signed main(){  
//   freopen("output.txt", "r", stdin);
//   freopen("tt.txt", "w", stdout);
    // flash;
    int t = 1;
    //  cin >> t;  
    for(int tc = 1; tc <= t; tc++){
    // goog(tc);
        solve();
		if(tc != t) cout << endl;
    }
}

Measured memory_bytes: 3636
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        Integer[] a = new Integer[n];
        for(int i=0; i<n; i++){
            a[i] = scan.nextInt();
        }
        Arrays.sort(a, Collections.reverseOrder());
        
        int alice = 0;
        int bob = 0;
        for(int i=0; i<n; i++){
            if(i%2==0) alice+=a[i];
            else bob+=a[i];
        }
        System.out.println(alice - bob);

        scan.close();
    
    }

}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

map<PII, int> mp;
int main() {
    int n;
    cin >> n;

    for(int i=1; i<=n; i++) {
        int a = to_string(i)[0]-'0';
        int b = i%10;
        mp[{a,b}]++;
    }

    LL ans = 0;
    for(int i=1; i<10; i++) {
        for(int j=1; j<10; j++) {
            ans += mp[{i,j}]*mp[{j,i}];
        }
    }

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

Measured memory_bytes: 256
n, y = map(int, input().split())

cnt1000 = -1
cnt5000 = -1
cnt10000 = -1


for a in range(n + 1):
    for b in range(n + 1 - a):
        c = n-a-b
        if y == 10000*a + 5000*b + 1000*c:
            cnt10000 = a
            cnt5000 = b
            cnt1000 = c
            print(str(cnt10000) + ' ' + str(cnt5000) + ' ' + str(cnt1000))
            exit()

print(-1, -1, -1)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define N 100010
#define ll long long
int main()
{
    string s;
    cin>>s;
    int ans = 0;
    int n = s.size();
    if(n == 1){
        ans = 0;
    }
    else{
        for(int i = 0; i < n/2; i++){
            if(s[i] != s[n-1-i]){
                ans++;
            }
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3536
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct graph_scc{
	int V;
	static const int MAX=200000;
	vector<int> G[MAX];
	vector<int> rG[MAX];
	vector<int> vs;
	bool used[MAX];
	int cmp[MAX];
	void init(int n){
		V=n;
		for(int i=0;i<V;i++){
			G[i].clear();
			rG[i].clear();
		}
		vs.clear();
		memset(cmp,0,sizeof(cmp));
	}
	void add_edge(int from,int to){
		G[from].push_back(to);
		rG[to].push_back(from);
	}

	void dfs(int v){
		used[v]=true;
		for(int i=0;i<G[v].size();i++){
			if(!used[G[v][i]])dfs(G[v][i]);
		}
		vs.push_back(v);
	}
	void rdfs(int v,int k){
		used[v]=true;
		cmp[v]=k;
		for(int i=0;i<rG[v].size();i++){
			if(!used[rG[v][i]])rdfs(rG[v][i],k);
		}
	}

	int scc(int n){
		V=n;
		memset(used,0,sizeof(used));
		vs.clear();
		for(int v=0;v<V;v++){
			if(!used[v])dfs(v);
		}
		memset(used,0,sizeof(used));
		int k=0;
		for(int i=vs.size()-1;i>=0;i--){
			if(!used[vs[i]]){
				rdfs(vs[i],k++);
			}
		}
		return k;
	}
};

int n,m,w;
vector<P> G[100005];
graph_scc gr;
int ord[100005];
bool dp[100000][105];

int main(void){
	scanf("%d%d%d",&n,&m,&w);
	bool zero=false;
	for(int i=0;i<m;i++){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		gr.add_edge(a,b);
		if(c==0)zero=true;
		G[a].push_back(P(b,c));
	}
	gr.scc(n);
	for(int i=0;i<n;i++){
		ord[gr.cmp[i]]=i;
		dp[i][0]=true;
	}
	for(int i=0;i<n;i++){
		int v=ord[i];
		for(int j=0;j<G[v].size();j++){
			int to=G[v][j].first;
			int cost=G[v][j].second;
			for(int k=0;k+cost<=100;k++){
				if(dp[v][k]){
					dp[to][k+cost]=true;
				}
			}
		}
	}
	int ma=-1;
	if(zero)ma=0;
	for(int i=0;i<n;i++){
		for(int j=1;j<-w;j++){
			if(dp[i][j]){
				ma=max(ma,j);
			}
		}
	}
	if(ma==-1){
		printf("NA\n");
	}else{
		printf("%d\n",ma+w);
	}
	return 0;
}



Measured memory_bytes: 46068
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	string s; REP(i, 2)cin >> s;
	cout << 'A' << s[0] << 'C' << endl;
}

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

// ================== CODE PREWRITTEN BEFORE THE CONTEST/PROBLEM ================== //
#define int long long
#define pb push_back
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define inf 0x3f3f3f3f

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef set<int> si;
typedef map<string, int> msi;
// ================== CODE WRITTEN DURING THE CONTEST/PROBLEM ================== //

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

    int n;
    cin>>n;
    string s1;
    cin>>s1;

    int rT = 0;
    for(int i = 0; i<n; i++){
      if(s1[i]=='R')rT++;
      else rT--;
    }
    if(rT>0)cout<<"Yes\n";
    else cout<<"No\n";

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int n;

int main() {
    cin >> n;
    vector<int> a(n);
    bool flag=false;
    REP(i,n){
        cin >> a[i];
        if(a[i]%2==1)
            flag=true;
    }
    if(flag){
        put("first");
    }else{
        put("second");
    }
    return 0;
}



Measured memory_bytes: 640
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
dp=[0]*(10**5+1)
ans=sum(A)
for i in range(N):
  dp[A[i]]+=1
for _ in range(Q):
  B,C=map(int,input().split())
  dp[C]+=dp[B]
  ans+=dp[B]*(C-B)
  dp[B]=0
  print(ans)

Measured memory_bytes: 20980
#include<bits/stdc++.h>
#define mod 1000000007
#define mx 10005
//#define y 3
using namespace std;
typedef  long long int ll;
#define  f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
#include <bitset>

void input(){
int n, m;
cin>>n >> m;
vector<int>A(n);
f(i, n) cin >> A[i];
sort(A.begin(), A.end());
vector<pair<int, int> > B(m);
f(i, m){
   int a, b;cin >>a >> b;
   B[i] = {a, b};
}
sort(B.begin(), B.end(),[&](const pair<int, int> &a,const pair<int, int> &b) {return a.second > b.second;});
int i= 0; int j = 0;
while( i < n && j < m){
    if(A[i] >= B[j].second)break;
    --B[j].first;
    A[i] = B[j].second;
    if(B[j].first == 0)++j;
    ++i;
}
ll sum  = 0;
f(i, n)sum += (ll)A[i];
cout << sum <<endl;
}
int main(){
    input();
    return 0;
}



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

 
int main(){
  int x,y;
  cin >>x>>y;
  
  if(x==2){
    if(x==y)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  else if(x==4||x==6||x==9||x==11){
    if(y==4||y==6||y==9||y==11) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  else{
    if(y==1||y==3||y==5||y==7||y==8||y==10||y==12){
      cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
  }
}
  


Measured memory_bytes: 256
//WrittenBiDP
//frog

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>

#define MAXN 1000050000

using namespace std;

typedef vector <int> vi;

vi a, b, c;
vi ansa, ansb, ansc;

int main() {
	//ifstream In("input.txt");
	//ofstream Out("output.txt");

	int n;
	//In >> n;
	cin >> n;

	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		a.push_back(t);
		cin >> t;
		c.push_back(t);
		cin >> t;
		b.push_back(t);
	}

	ansa.resize(n);
	ansb.resize(n);
	ansc.resize(n);


	ansa[0] = a[0];
	ansb[0] = b[0];
	ansc[0] = c[0];

	for (int i = 1; i < n; i++) {
		ansa[i] = max(ansb[i - 1], ansc[i - 1]) + a[i];
		ansb[i] = max(ansa[i - 1], ansc[i - 1]) + b[i];
		ansc[i] = max(ansa[i - 1], ansb[i - 1]) + c[i];
	}

	cout << max(ansa[n - 1], max(ansb[n - 1], ansc[n - 1]));
	cin >> n;
	return 0;
}

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

void solve(){

    long long x,k,d;
    cin>>x>>k>>d;

    long long p = 0;
    
    if(x<0) x = -1*x;
    
    p = min(k, x/d);
    k -= p;
    
    x -= (p*d);
    
    if(k%2 == 0) cout<<x<<endl;
    else cout<<abs(x-d)<<endl;
return;

}
int main() {
	// your code goes here

        solve();
    
    return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#endif


typedef long long ll; 
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
 
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

const ll INF = (ll)1e9;
const int maxN = (int)1e6;

void solve() {
  int n;
  cin >> n;
  set<string> s;
  string t;
  for (int i = 0 ; i < n ; i++) {
    cin >> t;
    s.insert(t);
  }
  cout << s.size();
}
 
int main() {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
  int t = 1;
  // cin >> t;
  while (t--) {
    solve();
  }
 
  return 0;
}

Measured memory_bytes: 19188
#include<stdio.h>
int main(void)
{
	int N, A, B, C, D[10001] = { 0 }, sum = 0,j, d=0, ans=0, i, rest=0, ham=0, b=0, pns=0;
	scanf("%d", &N);/*N?????????????????°????¨????*/
	scanf("%d %d", &A, &B);/*A????????°????????????B?????????????????°?????????*/
	scanf("%d", &C);/*C????????°?????????????????°*/
	for (i = 1; i <= N; i++)
	{
		scanf("%d", &D[i]);/*i???????????????????????°*/
	}
	for (i = 1; i <= N; i++)
	{
		for (j = N; j > i; j--)
		{
			if (D[i] < D[j]) {
				rest = D[i];
				D[i] = D[j];/*?????????????????????*/
				D[j] = rest;
			}
		}
	}
	sum = C; /*??????????????????????????¶???????????°?????????????????°*/
	d = A;/*??????????????????????????¶???????????°?????????*/
	ans = sum / d;/*1????????????????????????????????°*/
	ham = sum;
	b = d;
	for (i = 1; i <= N; i++)
	{
			ham = ham+ D[i];
			b = b+B;
			pns = ham / b;
		if (ans < pns)
		{
			ans = pns;
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

double calc(int N, int i, int depth, int visited, vector<int> &x, vector<int> &y, double d) {
    if(depth == N) {
        return d;
    }

    double res = 0;
    REP(j, N) {
        if((visited&(1<<j)) == 0) {
            double dis = sqrt((double)(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2)));
            res += calc(N, j, depth + 1, visited | (1<<j), x, y, d + dis);
        }
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    vector<int> x(N), y(N);
    REP(i, N) {
        cin >> x[i] >> y[i];
    }
    int fact = 1;
    FOR(i, 1, N + 1) {
        fact *= i;
    }
    double res = 0;
    REP(i, N) {
        res += calc(N, i, 1, 1<<i, x, y, 0)/fact;
    }
    printf("%.9f\n", res);
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mem(dp,a) memset(dp,a,sizeof(dp))
#define pb(x) push_back(x)
#define m_p(x,y) make_pair(x,y)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repush_back(i,a,b) for(ll i=a;i>=b;i--)
#define f(n) for(ll i=0;i<n;i++)
#define r(n) for(ll j=0;j<n;j++)
#define F first
#define S second
#define pi 3.14159265359
#define hs ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
typedef long long int ll;
ll HRX=1e18;
ll INF=1e9+7;

const ll N=3*100007;
vector<ll>adj[N];
bool vis[N];
ll n,e,src,dest;

void bfs(ll s)
{
  ll dist[N];
  f(N)
  {
     dist[i]=0;
  }
  queue<ll>q;
  if(!vis[s])
    vis[s]=true;
  q.push(s);
  while(!q.empty())
  {
    ll u=q.front();
    q.pop();
    f(adj[u].size())
    {
     ll v=adj[u][i];
     if(!vis[v])
     {
        vis[v]=1;
        dist[v]=dist[u]+1;
        q.push(v);
     }
    }
  }
  if(dist[dest]%3==0 && dist[dest]!=0)
    cout<<dist[dest]/3<<endl;
  else
    cout<<"-1"<<endl;

}
int main()
{
  hs;
  cin>>n>>e;
  f(e)
  {
     ll x,y;
     cin>>x>>y;
     adj[x].pb(y+n);
     adj[x+n].pb(y+2*n);
     adj[x+2*n].pb(y);
  }
  cin>>src>>dest;
  mem(vis,0);
  bfs(src);
  return 0;


}




Measured memory_bytes: 19456
#include <bits/stdc++.h>
using namespace std;
char out(string s,int sz)
{
    return s[sz];
}

int main()
{
    int n,check=0;
    cin >> n;
    string s;
    string c;
    vector <string> p(n);
    for(int i=0;i<n;i++){
        if(i!=0) c=s;
        cin >> s;
        p.at(i)=s;
        for(int j=0;j<i;j++) if(p.at(i)==p.at(j)) check=1;
        if(i!=0 && out(s,0) != out(c,c.size()-1)) check=1;
    }
    if(check){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

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

int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for(long long i=0;i<n;i++){
    cin >> a[i];
  }
  
  for(int i=0;i<n-k;i++){
    if(a[i]<a[i+k]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
 
bool isprime(int n)
{
    if (n < 2) return false;
    if (n == 2) return true;
    if (n % 2 == 0) return false;
    for (int i = 3; i*i <= n; i += 2)
    {
        if (n % i == 0)
        {
            return false;
        }
    }
    
    return true;
}
 
bool islike2017(int n)
{
    if (isprime(n) && isprime((n+1)/2))
    {
        return true;
    }
    else
    {
        return false;
    }
}
 
int main()
{
        int q;
    cin >> q;

    vector<int> l(q), r(q);
    for (int i = 0; i < q; i++)
    {
        cin >> l[i] >> r[i];
    }

    int lmin, rmax;
    lmin = *min_element(l.begin(), l.end());
    rmax = *max_element(r.begin(), r.end());

    vector<int> like2017;

    for (int i = lmin; i <= rmax; i++)
    {
        if (i % 2 != 0 && islike2017(i))
        {
            like2017.push_back(i);
        }
            
    }

    int count, cur;
    for (int i = 0; i < q; i++)
    {
        count = 0; cur = 0;
        while (l[i] > like2017[cur]) cur++;
        while (r[i] >= like2017[cur] && like2017.begin() + cur != like2017.end())
        {
            count++;
            cur++;
        }
        
        cout << count << endl;
    }
 
}

Measured memory_bytes: 1536
/*

*/
#include <bits/stdc++.h>

using namespace std;

#define ll           long long int
#define mp           make_pair
#define pb           push_back
#define fi           first
#define si           second
#define fastIO       ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n)       for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n)      for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n)       for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n)      for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m)    for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m)   for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m)   for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
const int nax = 1e7;
const int mod = 1e9+7;



int main(){
fastIO
	ll n, ans=0;cin>>n;
	ll cost[n][3], dp[n][3];
	for(ll i=0; i<n; i++){
		cin>>cost[i][0]>>cost[i][1]>>cost[i][2];
		if(i == 0){
			dp[0][0] = cost[0][0];
			dp[0][1] = cost[0][1];
			dp[0][2] = cost[0][2];
			ans = max(dp[0][0], max(dp[0][1], dp[0][2]));
		}
	}

	for(ll i=1; i<n; i++){
		dp[i][0] = cost[i][0] + max(dp[i-1][1], dp[i-1][2]);
		dp[i][1] = cost[i][1] + max(dp[i-1][0], dp[i-1][2]);
		dp[i][2] = cost[i][2] + max(dp[i-1][0], dp[i-1][1]);
		if(i == n-1){
			ans = max(dp[i][0], max(dp[i][1], dp[i][2]));
		}
	}
	cout<<ans;
}

Measured memory_bytes: 8296
n = int(input())
a = list(map(int, input().split()))
new_a = []
sum = 0
minus_count = 0
zero_flag = 0
min_a = 0

for i in range(n):
	new_a.append(abs(a[i]))

for i in range(n):
	if a[i] < 0:
		minus_count += 1
	if a[i] == 0:
		zero_flag = 1

if zero_flag == 1:
	for i in range(n):
		sum += abs(a[i])
elif minus_count % 2 == 0:
	for i in range(n):
		sum += abs(a[i])
else:
	for i in range(n):
		sum += new_a[i]
	sum = sum - min(new_a) * 2

print(sum)

Measured memory_bytes: 14492
/*jai_ganeshdeva*/

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpll vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
#define modA(cccc,bbbb ,p) (((cccc+bbbb)%p+p)%p)
#define modS(cccc,bbbb ,p) (((cccc-bbbb)%p+p)%p)
#define modM(cccc,bbbb ,p) ((((cccc%p)*(bbbb%p))%p+p)%p)

long long int modp(lld a,lld p,lld n)
{
    lld d[100];
    lld i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

// lld fac[500005]; 

// void getfac(lld p)
// {
//     fac[0] = 1; 
//     for (lld i=1 ; i<=500005; i++) 
//         fac[i] = fac[i-1]*i%p; 
// }    

// long long int nCrmodp(lld n, lld r,lld p) 
// { 
//    // Base case 
//    if (r==0) 
//       return 1; 
     
//     return (fac[n]* modInverse(fac[r], p) % p * 
//             modInverse(fac[n-r], p) % p) % p; 
// }

// bool sorter(lld a, lld b)
// {
//     vector<lld> v2;
//     vector<lld> w;
//     // cout<<"A == " <<a<<"  B== "<<b;
//     while(a>=1)
//     {
//         v2.pb(a%10);
//         a/=10;
//     }
//     while(b>=1)
//     {
//         w.pb(b%10);
//         b/=10;
//     }   
       
//     reverse(all(v2));
//     reverse(all(w));
//     lld l1 = v2.size();
//     lld l2 = w.size();
//     lld  l = (l1*l2)/__gcd(l1,l2);
//     // cout<<l1<< " "<<l2<< " "<<l<< " ";
//     for(int i=0;i<l;i++)
//     {
//         if(v2[i%l1]!=w[i%l2])
//         {
//             // cout<< "   "<< (v2[i%l1] > w[i%l2])<<"\n";
//             return v2[i%l1] > w[i%l2];
//         }
//     }
//     // printf("false\n");
//     return false;
// }


lld p1=1e8 + 7,p2=998244353;
lld l,r,mid,ans=0;
lld n,i,j,k,g,m;
lld x,y,n1,n2,h,z,c;
lld aa=1;
lld ss=1;

void solve()
{

    cin >> n;
    if(n>=30) cout<<"Yes";
    else cout<<"No";
}

int main()
{
 
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
    
    // cin>>t;
    // cout<<t;
     // getfac(p1);
    //check the value by which modulo is to be taken
    // lld ans=0;
    // precompute();
    for(int i=0;i<t;i++)
    {
        // cout<<"Case #"<<i+1<<": ";
        solve();
        cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3652
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

template <long long mod>
long long mod_pow(long long a, long long b) {
    if (b == 0) return 1;
    long long ret = mod_pow<mod>(a, b / 2);
    ret = ret * ret % mod;
    if (b % 2 == 1) ret = a * ret % mod;
    return ret;
}

template <long long mod>
struct Comb {
    int n;
    vector<long long> fact, inv;

    Comb(int n)
        : n(n), fact(n + 1, 0), inv(n + 1, 0) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % mod;
        inv[n] = mod_pow<mod>(fact[n], mod - 2);
        for (int i = n; i >= 1; i--) inv[i - 1] = inv[i] * i % mod;
    }

    long long operator()(int m, int k) {
        if (m > n || m < k || k < 0)
            return 0;
        else
            return fact[m] * inv[m - k] % mod * inv[k] % mod;
    }
};

const ll MOD = TEN(9) + 7;
int r1, c1, r2, c2;
Comb<MOD> comb(2000010);

ll s(int r, int c) {
    return comb(r + 1 + c, c);
}

ll g(int r, int c) {
    ll res = 0;
    for (int i = 0; i <= r; i++) {
        res = (res + s(i, c)) % MOD;
    }
    return res;
}

int main() {
    fastio();

    cin >> r1 >> c1 >> r2 >> c2;

    cout << (g(r2, c2) - g(r1 - 1, c2) - g(r2, c1 - 1) + 2LL * MOD + g(r1 - 1, c1 - 1)) % MOD << endl;

    return 0;
}

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

int main() {
	
	int n;
	cin >> n;
	
	map<string, int> smap;
	ll ans = 0;
	rep(i, n){
		string s;
		cin >> s;
		sort(s.begin(), s.end());
		smap[s]++;
	}
	
	for(auto p: smap){
		ans += (ll) p.second * (p.second - 1) / 2;
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {
    int N;
    cin >> N;
    vector<int> A(N),B(N),C(N-1);
    for(int i=0;i<N;i++){
        cin >> A.at(i);
    }
    for(int i=0;i<N;i++){
        cin >> B.at(i);
    }
    for(int i=0;i<N-1;i++){
        cin >> C.at(i);
    }
    int satis = 0;
    
    for(int i=0;i<N;i++){
        satis += B.at(A.at(i)-1);
        if(i>0 && A.at(i-1)+1 == A.at(i)){
            satis += C.at(A.at(i-1)-1);
        }
    }

    cout << satis << endl;
}



Measured memory_bytes: 256
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    ans = 0
    for d in range(1, n + 1):
        ans += d * (n - d + 1)

    for _ in range(n - 1):
        u, v = map(int, input().split())
        if u > v:
            u, v = v, u
        ans -= u * (n - v + 1)

    print(ans)
resolve()

Measured memory_bytes: 73792
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

int main() {
    //ifstream cin("f.in");

    int n, m; cin >> n >> m; 
    
    vector<vector<int>> mat(n, vector<int> (n, 0));
    vector<int> b(n, 0);

    for(int i = 0; i < m; ++i) {
        int x, y; cin >> x >> y;
        x -= 1, y -= 1;
        mat[x][y] = 1;
        b[x] |= (1 << y);
    }
    
    auto add = [&] (int &a, int b) {
        a += b;
        while(a >= MOD) {
            a -= MOD;
        }
        while(a < 0) {
            a += MOD;
        }
    };

    vector<int> dp((1 << n), 0);
    vector<int> set_bits((1 << 15), 0);
    
    for(int i = 1; i < (1 << 15); ++i) {
        set_bits[i] = set_bits[i >> 1] + (i & 1);
    }

    dp[0] = 1;

    for(int mask = 0; mask < (1 << n); ++mask) {
        for(int sub = mask; sub > 0; sub = ((sub - 1) & mask)) {
            if((sub & 1) and (sub & 2))
                continue;
            if(dp[mask - sub] == 0)
                continue;

            int ways = 1;
            for(int i = 0; i < n; ++i) {
                if((1 << i) & mask)
                    continue;
                int who = set_bits[(b[i] & sub)];
                ways = 1LL * ways * ((1 << who) - 1) % MOD;
                if(ways == 0) {
                    break;
                }
            }
            
            if(ways == 0) {
                continue;
            }

            for(int i = 0; i < n; ++i) {
                if((1 << i) & sub) {
                    int many = set_bits[b[i] & ((1 << n) - mask)];
                    ways = 1LL * ways * (1 << many) % MOD;
                }
            }

            int prv = dp[mask - sub];
            add(dp[mask], 1LL * prv * ways % MOD);
        }
    }

    int ans = dp[(1 << n) - 1];

    cout << ans << "\n";
}

Measured memory_bytes: 512
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 2019

def solve():
    a = list(map(int, input()))
    n = len(a)
    for i in range(n):
        a[i] *= pow(10,n-i-1,mod)
        a[i] %= mod
    s = [0]+list(accumulate(a))
    d = [0]*mod
    ans = 0
    for i in s:
        j = i%mod
        ans += d[j]
        d[j] += 1
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 86848
#include <iostream>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <cmath>
#include <cstdarg>
#include <cstdlib>
#include <string>

#include <vector>
#include <tuple>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

int main(int argc, char const *argv[]) {
    long long x, y;
    cin >> x >> y;
    
    int count = 0;
    while(x <= y) {
        count ++;
        x *= 2;
    }
    cout << count << endl;
    return 0;
}

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

	int a, b;
	
int main () {
	cin >>a >>b;
	
	if (a>b && b!= 1) {
		cout <<"Alice"<< endl;
	} else {if (b>a && a!=1){
		cout << "Bob" <<endl;
	} else {if (a==b){
		cout << "Draw" << endl;
	} else {if (b>a && a==1){
		cout << "Alice" << endl;
	} else {if (a>b && b==1){
		cout << "Bob" << endl;
	}
	}
	}
	}
}
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;

int a[100000];
int b[100000];
int c[100000];
int main() {
  int n,a,b;
  cin >> n;
  if(n == 1){
    cout << "Hello World" << endl;
  }else{
    cin >> a >> b;
    cout << a + b << endl;
  }
}



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

int main(){
    
    int N;
    string S;
    cin>>N>>S;
    vector<long long int> T(26,1);
    for(int i=0;i<N;i++){
        T[S[i]-'a']++;
    }
    long long int ans=1;
    for(int i=0;i<26;i++){
        ans*=T[i];
        ans=ans%1000000007;
    }
    cout<<(ans-1)%1000000007<<endl;
}


Measured memory_bytes: 512
package main

import "fmt"

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

	matrix := make([]string, h+2)
	for i := 0; i < w+2; i++ {
		matrix[0] += "."
		matrix[h+2-1] += "."
	}
	for i := 1; i < h+1; i++ {
		var s string
		fmt.Scan(&s)
		matrix[i] = "." + s + "."
	}

	fmt.Println(solve(matrix))
}

func solve(m []string) string {
	for i := 1; i < len(m)-1; i++ {
		for j := 1; j < len(m[i])-1; j++ {
			if m[i][j] != '#' {
				continue
			}
			if m[i+1][j] == '#' {
				continue
			}
			if m[i-1][j] == '#' {
				continue
			}
			if m[i][j+1] == '#' {
				continue
			}
			if m[i][j-1] == '#' {
				continue
			}
			return "No"
		}
	}
	return "Yes"
}

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

ll n, freq[1000010];

int main() {
	cin>>n;
	ll a[n], fpb=0;
	for (int i=0; i<n; i++) {
		cin>>a[i];
		fpb=__gcd(fpb, a[i]);
		freq[a[i]]++;
	}
	bool pw=1, sw=1;
	for (int i=2; i<1000010; i++) {
		ll cnt=0;
		for (int j=i; j<1000010; j+=i) {
			cnt+=freq[j];
		}
		if (cnt>1) pw=0;
	}
	if (fpb>1) sw=0;
	if (pw) cout<<"pairwise coprime"<<endl;
	else if (sw) cout<<"setwise coprime"<<endl;
	else cout<<"not coprime"<<endl;
}

Measured memory_bytes: 19184
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int r = scanner.nextInt();
		int c = scanner.nextInt();
		int all = 0;
		int box[][] = new int[r + 2][c + 2];
		for (int i = 0; i < r; i++) {
			int totalc = 0;
			for (int j = 0; j < c; j++) {
				int d = scanner.nextInt();
				box[i][j] = d;
				totalc = totalc + d;
			}
			box[i][c] = totalc;
			all = totalc + all;

		}
		box[r][c] = all;
		for (int i = 0; i < c; i++) {
			int totalr = 0;
			for (int j = 0; j < r; j++) {
				totalr = box[j][i] + totalr;
			}
			box[r][i] = totalr;
		}
		for (int i = 0; i < r + 1; i++) {
			for (int j = 0; j < c + 1; j++) {
				System.out.print(box[i][j]);
				if(j!=c) {
					System.out.print(" ");
				}else {
					System.out.println();
				}
			}
			
		}

	}
}



Measured memory_bytes: 42284
#include <stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a==b){
        printf("a == b\n");
    }
    else if(a<b){
        printf("a < b\n");
    }
    else{
        printf("a > b\n");
    }
   
   return 0;
}

Measured memory_bytes: 1796
import java.util.*;
import java.io.*;

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    
        String s = br.readLine();
        
        if(s.equals("AAA") || s.equals("BBB")){
            out.println("No");
        }else{
            out.println("Yes");
        }
        out.close();
        
    }
}

Measured memory_bytes: 32592
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, a, b;

int main(){
	cin >> n;
	if(n == 1){cout << "Hello World" << endl;}
	else{
		cin >> a >> b;
		cout << a+b << endl;
	}
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
//素集合データ構造:Disjoint Set

//union find tree
#include<iostream>
#include<cstdio>
#include<cstdlib>
#define rep(i,j) for(i=0;i<j;i++)
using namespace std;

typedef int Natural;//ノード数により...


//配列外参照対策していない
//Node 0 to n-1でも1 to nでもOKなはず
class UnionFindTree
{
public:
  Natural Node_num;
  Natural *parents;
  Natural *ranks;

  UnionFindTree(Natural n):Node_num(n+1)
  {
    n++;
    parents=new Natural[n];
    ranks=new Natural[n];
    for(Natural i=0;i<n;i++)
      {
	parents[i]=i;
	ranks[i]=0;
      }
  }
  
  ~UnionFindTree()
  {
    delete[] parents;
    delete[] ranks;
  }

  Natural get_root(Natural x)
  {
    if(parents[x]==x)return x;
    else 
      {
	//探索と同時に根につなぎ変える
	return parents[x]=get_root(parents[x]);
      }
  }

  void unite(Natural x,Natural y)
  {
    //異なる集合にいたら統合
    if( (x=get_root(x))!=(y=get_root(y)) )
      {
	//木が浅くなるような統合をする
	if(ranks[x]>ranks[y])
	  parents[y]=x;
	else if(ranks[x]<ranks[y])
	  parents[x]=y;
	else
	  {
	    parents[x]=y;
	    ranks[y]++;
	  }
      }
  }

  //xとyが同じ集合にあるか
  bool is_same(Natural x,Natural y)
  {
    return get_root(x)==get_root(y);
  }

};


int main()
{
  int n,q;
  cin>>n>>q;
  UnionFindTree uft(n);
  int i;
  rep(i,q)
    {
      int query,x,y;
      cin>>query>>x>>y;
      if(query)//is_same
	cout<< (uft.is_same(x,y) ? 1 : 0 )<<endl;
      else //unite
	uft.unite(x,y);
    }
  return 0;
}

Measured memory_bytes: 1272
N = gets.to_i
H = gets.strip.split.map(&:to_i)

max = 0
s = 0
(N-1).downto(1) do |i|
  if H[i] <= H[i-1]
    s += 1
    if max < s
      max = s
    end
  else
    s = 0
  end
end

puts max

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

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()
    goal = N*2+1
    edge = [set() for _ in range(goal+1)]

    red = [LI() for _ in range(N)]
    blue = [LI() for _ in range(N)]

    for i in range(1,N+1):
        edge[0].add(i)
    for i in range(N+1,goal):
        edge[i].add(goal)

    for i in range(N):
        a,b = red[i]
        for j in range(N):
            c,d = blue[j]
            if a < c and b < d:
                edge[i+1].add(N+j+1)

    ans = 0

    while True:
        q = collections.deque()
        node = [-1] * (goal + 1)
        node[0] = 0
        q.append(0)
        while q:
            u = q.pop()
            for v in edge[u]:
                if node[v] >= 0: continue
                node[v] = u
                if v == goal:
                    ans += 1
                    break
                q.append(v)
            else:
                continue
            break
        else:
            break

        v = goal
        while v > 0:
            u = node[v]
            edge[u].remove(v)
            edge[v].add(u)
            v = u

    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 75452