akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
using namespace std;

const int maxn=1e5+5;
int fa[maxn];
int tot;
struct way{
    int u,v;
	long long w;
}edge[maxn*4];
struct node
{
	int x,y,id;
}a[maxn];
int find(int x){return fa[x]==x?fa[x]:fa[x]=find(fa[x]);}
void link(int x,int y)
{
    int tx=find(x),ty=find(y);
    fa[ty]=tx;
}
bool cmp(way a,way b){return a.w<b.w;}
bool cmp1(node a,node b){return a.x<b.x;}
bool cmp2(node a,node b){return a.y<b.y;}
int main()
{
    int m,n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
    	a[i].id=i;
    	scanf("%d %d",&a[i].x,&a[i].y);
	}
	sort(a+1,a+1+n,cmp1);
	int cnt=0;
    for(int i=1;i<n;i++)
    {
    	cnt++;
    	edge[cnt].u=a[i].id;
    	edge[cnt].v=a[i+1].id;
    	edge[cnt].w=(long long)(a[i+1].x-a[i].x);
    	cnt++;
    	edge[cnt].u=a[i+1].id;
    	edge[cnt].v=a[i].id;
    	edge[cnt].w=(long long)(a[i+1].x-a[i].x);
	}
	sort(a+1,a+1+n,cmp2);
	for(int i=1;i<n;i++)
    {
    	cnt++;
    	edge[cnt].u=a[i].id;
    	edge[cnt].v=a[i+1].id;
    	edge[cnt].w=(long long)(a[i+1].y-a[i].y);
    	cnt++;
    	edge[cnt].u=a[i+1].id;
    	edge[cnt].v=a[i].id;
    	edge[cnt].w=(long long)(a[i+1].y-a[i].y);
	}
    for(int i=1;i<=n;i++)    fa[i]=i;
    sort(edge+1,edge+cnt+1,cmp);
    for(int i=1;i<=cnt;i++)
    {
        if(find(edge[i].u)!=find(edge[i].v))
        {
            link(edge[i].u,edge[i].v);
            tot=tot+edge[i].w; 
        }
    }
    cout<<tot<<endl;
    return 0;
}

Measured memory_bytes: 8064
# N人 K種類
N, K = map(int, input().split())

check = [0] * N

for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))
    for a in A:
        check[a-1] += 1

count = 0
for checkN in check:
    if checkN == 0:
        count += 1

print(count)
    


Measured memory_bytes: 9180
def InsertSort(A, N): 
    str_A = map(str, A)
    print(" ".join(str_A))
    for i in range(N - 1):
        for j in range(i + 1):
            if A[i + 1 - j] < A[i - j]:
                A[i + 1 - j], A[i - j] = A[i - j], A[i + 1 - j]
            else:
                pass
        str_A = map(str, A)
        print(' '.join(str_A))


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

InsertSort(a, n)


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int INF = 1<<29;
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int H, W, N;
int D[16];
string town[1024];
int dist[1024][1024];
P factory[16];

inline bool in(int r, int c) {
  return 0 <= r && r < H && 0 <= c && c < W;
}

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  cin >> H >> W >> N;
  REP(i, H) cin >> town[i];
  int sr = 0, sc = 0;
  REP(i, H) REP(j, W) {
    if (town[i][j] == 'S') {
      sr = i, sc = j;
      break;
    }
  }

  int ans = 0;
  REP(i, N) {
    REP(r, H) REP(c, W) dist[r][c] = -1;
    queue<T> que;
    que.push(T(sr, sc, 0));
    while (!que.empty()) {
      int r, c, d;
      tie(r, c, d) = que.front(); que.pop();
      if (dist[r][c] != -1) continue;
      dist[r][c] = d;
      if (town[r][c] != 'S' && town[r][c] != '.' && town[r][c] != 'X' && town[r][c] - '0' == i+1) {
	ans += d;
	sr = r, sc = c;
	break;
      }
      REP(j, 4) {
	int nr = r + dr[j], nc = c + dc[j];
	if (in(nr, nc) && town[nr][nc] != 'X' && dist[nr][nc] == -1) {
	  que.push(T(nr, nc, d+1));
	}
      }
    }
  }

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

Measured memory_bytes: 6364
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;



int main(){
	int N,M,X;
	int A[100];

	scanf("%d %d %d", &N,&M,&X);
	for(int i=0;i<M;i++){
		scanf("%d", &A[i]);
	}

	int a = 0;
	int b = 0;
	for(int i=0;i<M;i++){
		if(X<A[i]) a++;
	}
	for(int i=0;i<M;i++){
		if(X>A[i]) b++;
	}

	printf("%d\n", min(a,b));


	return 0;
}


Measured memory_bytes: 256
def main():
    x,y=map(int,input().split())
    if(x%y==0):
        print(-1)
        return
    judge(x,x,y)
    
def judge(X,x,y):
    if(X % y != 0):
        print(x)
        return
    X += x
    if(X>pow(10,18)):
        print(-1)
        return
    judge(X,x,y)
        
if __name__=="__main__":
    main()

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
 
int main() { 
    int a, b, x;
    cin >> x >> a >> b;
    b -= a;
    if(b <= 0) {
        cout << "delicious" << '\n';
    } else if(b - x <= 0) {
        cout << "safe" << '\n';
    } else {
        cout << "dangerous" << '\n';
    }
}

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

int w,d,n;
int fie[55][55];
bool used[55][55];
int ans[55][55];
int a[55],b[55],c[55];
bool used2[55][55];
int cur[55][55];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(void){
	scanf("%d%d%d",&w,&d,&n);
	for(int i=1;i<=w;i++){
		for(int j=1;j<=d;j++){
			ans[i][j]=-114514;
		}
	}
	for(int i=0;i<n;i++){
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
		fie[a[i]][b[i]]=c[i];
		ans[a[i]][b[i]]=c[i];
		used[a[i]][b[i]]=true;
	}
	for(int i=0;i<n;i++){
		queue<P> que;
		memset(used2,false,sizeof(used2));
		que.push(P(a[i],b[i]));
		cur[a[i]][b[i]]=c[i];
		used2[a[i]][b[i]]=true;
		while(que.size()){
			P p=que.front();
			que.pop();
			for(int j=0;j<4;j++){
				int nx=p.first+dx[j];
				int ny=p.second+dy[j];
				if(nx>=1 && nx<=w && ny>=1 && ny<=d && !used2[nx][ny]){
					cur[nx][ny]=cur[p.first][p.second]-1;
					used2[nx][ny]=true;
					que.push(P(nx,ny));
				}
			}
		}
		for(int j=1;j<=w;j++){
			for(int k=1;k<=d;k++){
				if(!used[j][k]){
					ans[j][k]=max(ans[j][k],cur[j][k]);
				}
			}
		}
	}
	int rec=0;
	bool flag=false;
	for(int i=1;i<=w;i++){
		for(int j=1;j<=d;j++){
			rec+=ans[i][j];
			for(int k=0;k<4;k++){
				int nx=i+dx[k];
				int ny=j+dy[k];
				if(nx>=1 && nx<=w && ny>=1 && ny<=d && abs(ans[i][j]-ans[nx][ny])>1){
					flag=true;
				}
			}
		}
	}
	if(flag){
		printf("No\n");
	}else{
		printf("%d\n",rec);
	}
	return 0;
}



Measured memory_bytes: 3316
N, M = map(int, input().split())
S = input()


# 後ろから貪欲
ans = []
position = N
while position > 0:
    for move in range(M, 0, -1):
        if position - move < 0:
            continue

        if S[position - move] == '1':
            continue

        ans.append(move)
        position -= move
        break
    else:
        print(-1)
        exit()

print(*ans[::-1])


Measured memory_bytes: 6372
#include <bits/stdc++.h>
using namespace std;
#define int long long int
map<int, int>m;
main() {
	int n, k;
	cin>>n>>k;
	int arr[n];
	for(int i=0; i<n; i++){
		cin>>arr[i];
	}
	int pre[n+1];
	pre[0]=0;
	for(int i=1; i<=n; i++){
		pre[i]=pre[i-1]+arr[i-1];
	}
	for(int i=0; i<=n; i++){
		pre[i]-=i;
	}
	int ans=0;
	int last=0;
	
	for(int i=0; i<=n; i++){
		m[(pre[i])%k]++;
		if(i-last==k){
			m[(pre[last]%k)]--;
			last++;
		}
		int val=(m[(pre[i])%k]-1);
		
		ans+=val;
	}
	cout<<ans;
	
	return 0;
}

Measured memory_bytes: 19196
#include<iostream>
using namespace std;
bool z,x;
int main(){
	string s;
	cin>>s;
	for(long i=0;i<s.length();i++){
		if(s[i]=='C'){
			z=1;
		}
		if(s[i]=='F'&&z==1){
			x=1;
		}		
	}
	if(x==1){
		cout<<"Yes";
		return 0;
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();

		int x = Integer.parseInt(a+b);

		for(int i=0; i<1000; i++){
			if(i*i == x){
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");

	}
}

Measured memory_bytes: 21844
import collections

a = []
for i in range(3):
    a += (list(map(int, input().split())))

c = collections.Counter(a)
ans = c.most_common()

flg = "NO"

if (ans[0][1]) == 2:
    if (ans[0][1]) == 2:
        if (ans[2][1]) == 1:
            if (ans[3][1]) == 1:
                flg = "YES"

print(flg)


Measured memory_bytes: 3444
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <map>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;


int main() {

    ll X;
    cin >> X;
    ll money = 100;
    for(int i=0;;i++){
        if(X<=money){
            cout << i << endl;
            return 0;
        }
        money = money * 1.01;
    }
    return 0;
}

Measured memory_bytes: 3596
package main

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

func main() {
	X := ReadInt()
	a := X / 500 * 1000
	b := (X % 500) / 5 * 5
	fmt.Println(a + b)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1840
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1e9

signed main()
{
    int n, k;
    cin >> n >> k;
    int flag[n];
    for (int i = 0; i < n; i++)
        flag[i] = 1;

    for (int i = 0; i < k; i++)
    {
        int d;
        cin >> d;
        int a;
        for (int j = 0; j < d; j++)
        {
            cin >> a;
            flag[a - 1] = 0;
        }
    }

    int ans = 0;
    for (int i = 0; i < n; i++)
        ans += flag[i];
    cout << ans << endl;
}

Measured memory_bytes: 3628
def gusu(N,A):
    t=0
    for i in range(0,N):
        if(int(A[i])%2==1):
            t=1

    if(t==1):
        return 0
    else:
        return 1

N=int(input())

A_input = input()
A = A_input.split()

flag=0
while(1):
    if(gusu(N,A)==1):
        flag+=1
        for j in range(0,N):
            A[j]=int(A[j])/2
    else:
        break

print(flag)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int flag[1000][1000];
int emb[2][2];
const int dx2[4] = { 0,0,1,1 };
const int dy2[4] = { 0,1,1,0 };
bool check(const int l, const int u) {
	for (int i = 0; i < 4; ++i) {
		if (flag[u + dy2[i]][l + dx2[i]] != emb[dy2[i]][dx2[i]])return false;
	}
	return true;
}
int main() {
	int M, N; cin >> M >> N;
	map<char, int>mp;
	mp['J'] = 0;
	mp['O'] = 1;
	mp['I'] = 2;
	for (int i = 0; i < M; ++i) {
		string st; cin >> st;
		for (int j = 0; j < N; ++j) {
			flag[i][j] = mp[st[j]];
		}
	}
	for (int i = 0; i < 2; ++i) {
		string st; cin >> st;
		for (int j = 0; j < 2; ++j) {
			emb[i][j] = mp[st[j]];
		}
	}
	int sum = 0;
	for (int u = 0; u < M - 1; ++u) {
		for (int l = 0; l < N - 1; ++l) {
			if (check(l, u))sum++;
		}
	}
	int ans = sum;
	for (int u = 0; u < M; ++u) {
		for (int l = 0; l < N; ++l) {
			int pre = flag[u][l];
			int precount = 0;
			for (int i = 0; i < 4; ++i) {
				const int nl = l + dx2[i]-1;
				const int nu = u + dy2[i]-1;
				if (nl >= 0 && nl < N - 1 && nu >= 0 && nu < M - 1) {
					if (check(nl, nu))precount++;
				}
			}
			for (int i = 0; i < 3; ++i) {
				flag[u][l] = i;
				int nextcount = 0;
				for (int i = 0; i < 4; ++i) {
					const int nl = l + dx2[i] - 1;
					const int nu = u + dy2[i] - 1;
					if (nl >= 0 && nl < N - 1 && nu >= 0 && nu < M - 1) {
						if (check(nl, nu))nextcount++;
					}
				}
				ans = max(ans, sum + nextcount - precount);
			}
			
			flag[u][l] = pre;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7120
#include<bits/stdc++.h>
#define chal ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
    int t=1;
    //cin>>t;
    while(t--)
    {
        ll d,ti,s,p;
        cin>>d>>ti>>s;
        p=ceil((float)d/s);
        if(p<=ti)
            cout<<"Yes\n";
        else
            cout<<"No\n";

    }
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  if(s == "AAA"){
    cout << "No" << endl;
  }
  else if(s == "BBB"){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
a = input()
a = int(a)
n= []
for i in range(a+1):
  if i%3 == 0 and i%5 ==0:
    continue
  elif i%3==0:
    continue
  elif i%5==0:
    continue
  else:
    n.append(i)
    
sum = 0
for i in n:
  sum+= i
print(sum)

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

const int MAX_N = 100010;
const int INF = 1145141919;
int N,K;
int h[MAX_N];
int dp[MAX_N];

int main(){
	scanf("%d %d",&N,&K);
	for(int i=0;i<N;i++){
		scanf("%d",&h[i]);
	}
	fill(dp,dp+N,INF);
	dp[0]=0;
	for(int i=1;i<N;i++){
		int k = max(0,i-K);
		for(int j=k;j<i;j++){
			dp[i] = min(dp[i],dp[j]+abs(h[j]-h[i]));
		}
	}
	printf("%d\n",dp[N-1]);
	return 0;

}

Measured memory_bytes: 1024
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
//#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

signed main (){
    int n;cin>>n;
    vector<int> v(n);
    rep(i,0,n){
        cin>>v[i];
        v[i]--;
    }

    int ans=0;
    rep(i,0,n){
        if(v[i]!=-1 && v[v[i]]==i){
            ans++;
            v[v[i]]=-1;
            v[i]=-1;
        }
    }
    cout<<ans<<endl;
    


    
}
/*
1-21-2
*/


Measured memory_bytes: 1024
import math
def inp():return map(int,input().split())
def linp():return list(map(int,input().split()))

n,d=inp()
distance=[]
coordinates=[]
for i in range(n):
    coordinates.append(linp())

ans=0
for i in range(n-1):
    for k in range(i+1,n):
        s=0
        for j in range(d):
            s+=abs((coordinates[i][j]-coordinates[k][j])**2)
        if math.sqrt(s)==int(math.sqrt(s)):ans+=1
print(ans)


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

int main() 
{
    int a , b ;
    scanf("%d%d", &a , &b);

    if (a <= 9 && b <= 9)
    {
        printf("%d\n", a *b);
    }
    else
    {
        printf("-1\n");
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int n,c1,c2,cnt=1;
  char s[100010];
  scanf("%d%s",&n,s);
  c2=s[0];
  for(int i=1;i<n;i++){
    c1=c2;
    c2=s[i];
    if(!(c1==c2)){
      cnt++;
    }
  }
  printf("%d",cnt);
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a_list = [int(i) for i in input().split()]
a_dict = {}
for a in a_list:
  if a in a_dict:
    a_dict[a] += 1
  else:
    a_dict[a] = 1
q = int(input())
si = 0
for a in a_dict:
  si += a * a_dict[a]
for _ in range(q):
  bi, ci = [int(i) for i in input().split()]
  if not bi in a_dict:
    print(si)
    continue
  if not ci in a_dict:
    a_dict[ci] = 0
  a_dict[ci] += a_dict[bi]
  si += (ci - bi) * a_dict[bi]
  a_dict[bi] = 0
  print(si)

Measured memory_bytes: 21036
x1,y1,x2,y2 = list(map(int,input().split()))
x4,y4 = [-(y2-y1)+x1,(x2-x1)+y1]
x3,y3 = [x1 + (x2-x1+x4-x1),y1 + (y2-y1+y4-y1)]
print(x3,y3,x4,y4)


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

using namespace std;

const int N = 3e3 + 10;
double f[2][N * 2];
int main() {
    int n;
    cin >> n;
    f[0][N] = 1;
    for(int i = 1; i <= n; i++) {
        double p;
        cin >> p;
        int cur = i & 1;
        fill(f[cur], f[cur] + N, .0);
        for(int j = 1; j < 2 * N - 1; j++)
            f[cur][j] = (f[cur ^ 1][j - 1] * p + f[cur ^ 1][j + 1] * (1 - p));
    }
    double ans = 0;
    for(int i = 1; i < N; i++) ans += f[n & 1][N + i];
    cout << fixed << setprecision(12) << ans;
}


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

int n;
vector<string> s;
vector<int> d;

void solve(int line){
	int to = -1;
	for(int i=line+1; i<n; i++){
		if(i == line+1 && d[i] == d[line]){
			return;
		}
		if(d[i] < d[line]){
			return;
		}
		if(d[i] == d[line]){
			to = i;
			break;
		}
	}
	if(to==-1) return;
	for(int i=line+1; i<to; i++){
		s[i][d[line]-1] = '|';
	}
}

int main(void) {
	while(1) {
		cin >> n;
		if(n == 0) break;
		
		s = vector<string>(n);
		for(int i=0; i<n; i++){
			cin >> s[i];
		}
		
		d = vector<int>(n);
		
		for(int i=0; i<n; i++){
			//cout <<  s[i] << endl;
			for(int ii=0; ii<s[i].size(); ii++){
				if(ii==0 && s[i][ii] != '.'){
					d[i] = ii;
					break;
				}
				if(ii<s[i].size()-1 && s[i][ii+1] != '.'){
					s[i][ii] = '+';
					d[i] = ii+1;
					break;
				}
			}
			//cout <<  s[i] << endl;
		}
		
		for(int i=0; i<n; i++){
			for(int ii=0; ii<s[i].size(); ii++){
				if(s[i][ii] == '.'){
					s[i][ii] = ' ';
				}
			}
		}
		
		
		for(int i=0; i<n; i++){
			solve(i);
			cout << s[i] << endl;
		}
		
	}
	return 0;
}

Measured memory_bytes: 3672
string = input()
N=int(input())
Que = []
for i in range(N):
	Que.append(input())

init = ""
end = ""
rev = 2
for Q in Que:	
	if int(Q[0]) == 1:
		if rev != 1:
			rev=1
		else:
			rev=2
	elif int(Q[0])==2:
		T,F,C = Q.split(' ')
		if rev == 1:
			if int(F) == 1:
				F =2
			else:
				F = 1
		if int(F) == 1:
			init = init+C
		elif int(F) == 2:
			end = end + C
final = init[-1::-1]+string+end
if rev == 1:
	print(final[-1::-1])
else:
	print(init[-1::-1]+string+end)


Measured memory_bytes: 17144
def flagcount(num):
    count = 0
    while num:
        count += num & 1
        num >>= 1
    return count
n=int(input())
g=[[-1]*n for _ in range(n)]
for i in range(n):
    a=int(input())
    for j in range(a):
        x,y=map(int,input().split())
        g[i][x-1]=y
ans=0
for bit in range(1<<n):
    d=[]#
    for x in range(n):
        if bit&1<<x:
            d.append(1)
        else:
            d.append(0)
    flag=1
    for i in range(n):
        if d[i]:
            for j in range(n):
                if g[i][j]==-1:
                    continue
                if g[i][j]!=d[j]:
                    flag=0
    if flag:
        ans=max(ans,flagcount(bit))     
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
constexpr auto MOD = 1000000007;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VLL;

string s;
long long n, m;

int main()
{
  ll a, b;
  cin >> n >> a >> b;
  if((b-a+1)%2LL){
    cout << (b-a) / 2 << endl;
    return 0;
  }
  cout << min(a+(b-a-1)/2,n-b+1+(b-a-1)/2);
  return 0;
}


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

int main(){

	ll n, k, arr[200005], vis[200005] = {0};
	queue<ll> path;
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
		cin >> arr[i];
	}
	ll cur = 1;
	path.push(1);
	vis[1] = 1;
	while(k > 0){
		cur = arr[cur];
		k--;
		// cout << cur << endl;
		if(vis[cur] == 0)
			vis[cur] = 1;
		else{
			break;
		}
		path.push(cur);
	}
	if(k == 0){
		cout << cur << endl;
		return 0;
	}
	while(path.front() != cur){
		path.pop();
	} 
	k = k%path.size();
	while(k > 0){
		path.pop();
		k--;
	}
	cout << path.front() << endl;




	return 0;
}

Measured memory_bytes: 8080
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

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

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

const size_t N = 2e5 + 5;
const size_t L = 60;

int n;
LL k, a[N], g[L][N];

int main() {
    n = read();
    k = read();
    generate_n(a, n, read);

    map<int, int> mp;
    for (int i = n - 1; ~i; --i) {
        mp[a[i]] = i + n;
    }
    for (int i = n - 1; ~i; --i) {
        g[0][i] = mp[a[i]] - i + 1;
        mp[a[i]] = i;
    }
    for (int i = 1; i < L; ++i) {
        for (int j = 0; j < n; ++j) {
            g[i][j] = g[i - 1][(j + g[i - 1][j]) % n] + g[i - 1][j];
            if (g[i][j] > 1e18) g[i][j] = 1e18;
        }
    }
    LL pos = 0;
    for (int i = L - 1; i >= 0; --i) {
        if ((pos + g[i][pos % n]) <= n * k) {
            pos += g[i][pos % n];
        }
    }

    deque<int> q;
    set<int> s;
    for (; pos < n * k; ++pos) {
        int val = a[pos % n];
        if (s.count(val)) {
            int t;
            do {
                t = q.back();
                s.erase(t);
                q.pop_back();
            } while (t != val);
        } else {
            s.emplace(val);
            q.push_back(val);
        }
    }

    while (q.size()) {
        printf("%d ", q.front());
        q.pop_front();
    }
    return 0;
}

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

#define double long double
#define vec vector
#define pb push_back
#define unset unordered_set
#define ii pair<int, int>
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORE(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define bitcount(n) __builtin_popcountll(n)
template <typename T,typename U>
std::pair<T,U> operator+(const std::pair<T,U> & l,const std::pair<T,U> & r) {
  return {l.first+r.first,l.second+r.second};
} 
const long long ZERO = 0LL;
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0L);
const double EPS = static_cast<double>(1e-9);
typedef long long ll;

int norm(int a) {
  return ((a % MOD) + MOD) % MOD;
}

int mul(int a, int b) {
  return int(a * 1LL * b % MOD);
}

int binPow(int a, int k) {
  int ans = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) {
      ans = mul(ans, a);
    }
    a = mul(a, a);
  }
  return ans;
}

// If I need to find (x / a) % MOD, I need to use this function:
//    (x / a) % MOD = (x * inv(a)) % MOD
int inv(int a) {
  int b = binPow(a, MOD - 2);
  assert(mul(a, b) == 1);
  return b;
}

// Init variables here
const int N = 1e6 + 7;

void input() {
  //freopen("??.in", "r", stdin);
  //freopen("??.out", "w", stdout);

}

void solve() {
  int a, b;
  cin >> a >> b;
  cout << max({a + b, a - b, a * b}) << "\n";
  // read the question correctly (is y a vowel?)
  // look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)
}

int main() {
  //ios_base::sync_with_stdio(false); cin.tie();
  //auto beginProgram = chrono::steady_clock::now();
  //int t; scanf("%d", &t); while (t--) 
  {
    input();
    solve();
  }
  //auto endProgram = chrono::steady_clock::now();

  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#define Max 10000

int sosuu(int);

int main(){
  int a,n,sum=0;
  int judge;
  int x[Max];

  scanf("%d",&n);

  for(a=0 ; a<n ; a++){
     scanf("%d",&x[a]);
  }

  for(a=0 ; a<n ; a++){
    judge = sosuu(x[a]);
    if(judge == 0)sum++;
  }
  printf("%d\n",sum);

  return 0;
}

int sosuu(int x){
  int m;
  int n;
  n = sqrt(x);
  
  if(x < 2)return -1;
  if(x == 2)return 0;
  if(x % 2 == 0)return -1;
  for(m=3 ; m<=n ; m+=2){
    if(x % m == 0) {
      return -1;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 632
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;
#define ll long long
const int maxn = 1e5+10;
int n,m;
int a[maxn];
int main()
{
	scanf("%d%d",&m,&n);
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	if(sum>=m) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin >> a;
  vector<int> b(a+1);
  for(int i = 0;i < a;i++){
    cin >> b.at(i);}
  b.at(a) = 1000000;
  sort(b.begin(),b.end());
  long long ans = 0;
  for(int i = 0;i < a-2;i++){
    for(int j = i+1;j < a-1;j++){
     int ok = j;
     int ng = a;
          while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;
        if (b.at(i)+b.at(j) > b.at(mid)) {ok = mid;}
        else {ng = mid;}
          }

      ans += ok-j;
    }
  }
  cout << ans << endl;
  }

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint x, y;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> x >> y;
	
	llint ans = 1;
	while(1){
		x *= 2;
		if(x > y) break;
		ans++;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
using namespace std;
int main(){
    int n, m, c;
    cin >> n >> m >> c;
    int b[30];
    int ans = 0;
    for(int i = 0; i < m; i++) cin >> b[i];
    vector<vector<int>> data(n, vector<int>(m));
    for(int i = 0; i < n; i++){
        int sum = 0;
        for(int j = 0; j < m; j++){
            cin >> data.at(i).at(j);
            sum += data.at(i).at(j)*b[j];
        }
        if(sum + c > 0) ans++;
    }
    cout << ans << endl;
}



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

int n, f, b, cnt;
set<int> a;
 
int main(){
    cin >> n;
    rep(i,n){
        cin >> b;
        if (b >= 3200)
            f++;
        else
            a.insert(b / 400);
    }
    cnt = a.size();
    cout << max(1, cnt) << " " << cnt + f << endl;
}

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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef complex<double> xy_t;
const lint mod = 1e9 + 7;

int main(){
    int n;
    scanf("%d", &n);
    char s[n];
    rep(i, n) scanf(" %c", &s[i]);
    lint dp[n+1][n+1];
    rep(i, n+1)rep(j, n+1) dp[i][j] = 0;
    dp[0][0] = 1;
    rep(i, n)rep(j, n+1)if(dp[i][j]){
        if(s[i] == '-') dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % mod;
        else if(s[i] == 'D'){
            dp[i+1][j] = (dp[i+1][j] + j*dp[i][j]) % mod;
            if(j > 0) dp[i+1][j-1] = (dp[i+1][j-1] + j*j*dp[i][j]) % mod;
        }
        else{
            dp[i+1][j] = (dp[i+1][j] + j*dp[i][j]) % mod;
            if(j < n) dp[i+1][j+1] = (dp[i+1][j+1] + dp[i][j]) % mod;
        }
    }
    printf("%lld\n", dp[n][0]);
}


Measured memory_bytes: 3484
#include "bits/stdc++.h"
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <random>
#include <stdio.h>
#include <bitset>
#define _USE_MATH_DEFINES
#include <math.h>

using namespace std;

typedef long long LL;
typedef long double LD;
typedef string ST;


#define REP(i,n) for(LL (i)=0;(i)<(n);(i)++)
#define ALL(v) v.begin(), v.end()
#define PRINTLN(v) {LL i=0; for(auto (a): v ){   cerr <<i << " : "<<  a << endl; i++;}}
#define PRINTSP(v) for(auto (a): v ) {cerr << a << " ";} cerr << endl

bool isPrime(LL N)
{
  if (N < 2) {
    return false;
  }
  else if (N == 2) {
    return true;
  }
  else if (N % 2 == 0) {
    return false;
  }

  LD sqrtNum = sqrt(N);
  for (LL i = 3; i <= sqrtNum; i += 2)
  {
    if (N % i == 0)
    {
      return false;
    }
  }
  return true;
}


void func() {
  LL N;
  cin >> N;
  vector<LL> L(N);
  vector<LL> R(N);
  
  REP(i, N) {
    cin >> L[i];
    cin >> R[i];
  }

  LL M = 1e5+1;

  vector<LL> P(M);
  for (LL i = 1; i <= M; i++) {
    if (isPrime(i)) {
      if (isPrime((i + 1) / 2)) {
        P[i] = 1;
      }
    }
  }
  //PRINTLN(P);

  for (LL i = 1; i <= M; i++) {
    P[i] += P[i - 1];
  }
  //PRINTLN(P);


  for (LL i = 0; i < N; i++) {
    LL r = R[i];
    LL l = L[i];

    
    LL a = P[r];
    if (l != 0) {
      a -= P[L[i] - 1];
    }
    cout << a << endl;
  }


}

#ifdef CALC_TIME 
#include <windows.h>
int main()
{
  LARGE_INTEGER freq;
  QueryPerformanceFrequency(&freq);
  LARGE_INTEGER start, end;
  QueryPerformanceCounter(&start);
  // 何かの処理
  func();
  QueryPerformanceCounter(&end);
  double time = static_cast<double>(end.QuadPart - start.QuadPart) * 1000.0 / freq.QuadPart;
  fprintf(stderr, "\n%lf[ms]\n", time);
  return 0;
}
#else 
int main()
{
  func();
  return 0;
}
#endif





Measured memory_bytes: 2944
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    bool f = true;
    REP(i,3){
        if(s[i]==s[i+1]){
            f=false;
        }
    }
    if(f){
        cout << "Good\n";
    }else{
        cout << "Bad\n";
    }

    return 0;
}

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

int main(int argc, char *argv[]){
  int n;
  while(cin >> n, n){
    string s[1001];
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      for (int j = 0; j < s[i].length(); j++) {
        if(s[i][j] == '.'){
          if(s[i][j + 1] != '.'){
           s[i][j] = '+';
           int t = i;
           while(s[--t][j] == ' ')s[t][j] = '|';
          }else s[i][j] = ' ';
        }
      }
    }
    for (int i = 0; i < n; i++) {
      std::cout << s[i] << std::endl;
    }
  }
  return 0;
}

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

int main()
{
    int N,p;
    cin>>N;
    int count = 0;

    for(int i=1;i<N;i++)
    {
        cin>>p;
        if(p!=i)
        {
            count++;
        }
    }
    if(count <=2){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main(void) {
	int N = 0, ans = 0;
	char s1[101] = "\0", s2[101] = "\0";

	scanf("%d", &N);
	scanf("%s", s1);
	scanf("%s", s2);

	for (int i = 0; i < N; i++) {
		bool tf = true;
		for (int j = 0; j <= i; j++) {
			if (s2[j] != s1[N - i - 1 + j]) {
				tf = false;
				break;
			}
		}
		if (tf)
			ans = i + 1;
	}
	printf("%d\n", N * 2 - ans);

	return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;
int main(){
    int n;
    int debt=100000;
    cin >> n;
    for(int i=0; i<n; i++){
        debt *= 1.05;
        if(debt%1000!=0){
           debt=debt-(debt%1000)+1000;
        }
    }
    cout << debt << endl;
    return 0;
}

Measured memory_bytes: 3072
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    x = kwargs["x"]
    n = 100
    res = 0

    while n < x:
        n = int(n * 1.01)
        res += 1

    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    kwargs["x"] = [int(i) for i in cin][0]
    #kwargs["n"], kwargs["k"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

Measured memory_bytes: 31192
t = int(input())
for i in range(t):
    n, k  = map(int, input().split()) # n = len(xlist)
    xlist = list(map(int, input().split()))
    if (n <= k):
        print(0)
    else:
        betweenx = [xlist[i+1] - xlist[i] for i in range(n-1)]
        betweenx.sort()
        print(sum(betweenx[:n-k]))
        


Measured memory_bytes: 21756
#include <stdio.h>

int main()
{
    int a,b, c;
    int x = 0 ;


    scanf("%d %d", &a , &b);


    while(a!=0)
    {
        c=a%b;
        a=a/b;
        x++ ;
    }
    printf("%d", x) ;
    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#include <queue>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;

int main(){
  int r, c, q;

  while(scanf("%d%d%d", &r, &c, &q), r + c + q){
    vector<int> a(q);
    vector<int> b(q);
    vector<int> o(q);

    vector<int> rs(r, -1);
    vector<int> cs(c, -1);

    REP(i,q) scanf("%d%d%d", &a[i], &b[i], &o[i]);

    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    reverse(o.begin(), o.end());

    int rr = 0;
    int cc = 0;
    int ans = 0;

    REP(i,q){
      if(a[i] == 0){
	if(rs[b[i]] == -1){
	  rs[b[i]] = o[i];
	  rr++;
	  if(o[i] == 1) ans += c - cc;
	}
      }else{
	if(cs[b[i]] == -1){
	  cs[b[i]] = o[i];
	  cc++;
	  if(o[i] == 1) ans += r - rr;
	}
      }
    }

    printf("%d\n", ans);
  }

  return 0;
}

Measured memory_bytes: 0
use std::io;
use std::io::{Read, BufReader};
use std::cmp;

macro_rules! read {
    ( $( $t:ty ),* ) => {
        {
            let mut buf = String::new();
            io::stdin().read_line(&mut buf);
            let mut sp = buf.trim().split(" ");
            ($(
                {
                    sp.next().unwrap().parse::<$t>().unwrap()
                },
            )*)
        }
    }
}
macro_rules! read_vec {
    ($t:ty) => {
        {
            let mut buf = String::new();
            io::stdin().read_line(&mut buf);
            let mut sp = buf.trim().split(" ");
            let mut ret = vec![];
            for s in sp {
                ret.push(s.parse::<$t>().unwrap());
            }
            ret
        }
    }
}

fn trunc((low, hi, app): (i64, i64, i64), x: i64) -> (i64, i64, i64) {
    let (mut low, mut hi, mut app) = (low, hi, app);

    hi = cmp::min(hi, x);
    low = cmp::max(low, 0);
    low = cmp::min(low, x);
    hi = cmp::max(hi, 0);

    (low, hi, app)
}
fn eval((low, hi, app): (i64, i64, i64), x: i64) -> i64 {
    cmp::min(hi, cmp::max(low, app + x))
}
fn main() {
    let (x,) = read!(i64);
    let (k,) = read!(usize);
    let rs = read_vec!(i64);
    let (q,) = read!(usize);
    
    let mut dir = 0; // 0: decl, 1: incl
    let (mut low, mut hi, mut app) = (0i64, x, 0i64);

    let mut pos = 0;
    let mut last_app = 0i64;

    for _ in 0..q {
        let (t, a) = read!(i64, i64);

        while pos < k && rs[pos] <= t {
            let df = if dir == 0 { -(rs[pos] - last_app) } else { rs[pos] - last_app };
            low += df;
            hi += df;
            app += df;
            let a = trunc((low, hi, app), x);
            low = a.0;
            hi = a.1;
            app = a.2;
            dir = 1 - dir;
            last_app = rs[pos];
            pos += 1;
        }

        let df = if dir == 0 { -(t - last_app) } else { t - last_app };
        let (low2, hi2, app2) = trunc((low + df, hi + df, app + df), x);

        let ans = eval((low2, hi2, app2), a);
        println!("{}", ans);
    }
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

int cnt[MAXN];

void solve(){
	int n, m;
	scanf("%d%d", &n, &m);
	REP(i, 0, 2 * m) {
		int a;
		scanf("%d", &a);
		cnt[a] ^= 1;
	}
	REPN(i, 1, n) {
		if (cnt[i]) {
			printf("NO\n");
			return;
		}
	}
	printf("YES\n");
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
//#define ull unsigned  long  long
#define int long long int
#define lld long double
#define endl "\n"
#define S second
#define F first
#define pir      pair<int,int>
#define vtr      vector<int>
#define mpp      map<int,int>
#define pb       push_back
#define popb     pop_back()
#define mk       make_pair
#define stc      set<char>
#define st       set<int>
#define stk      stack<int>
#define ctn      continue
#define MOD      1000000007
#define fr(i,a,b)   for(int i=a;i<b;i++)
#define rfr(i,a,b)  for(int i=a-1;i>=b;i--)
#define must        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int gcd(int a, int b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
int lcm(int a, int b)
 {
    return (a*b)/gcd(a, b);
 }

int myfun(int x,int y)
{
    return x*y;
}
void primeFactors(int n)
{
    while (n%2 == 0)
    {
        cout<<2<<endl;
        n = n/2;
    }
    for (int i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            cout<<i<<endl;
            n = n/i;
        }
    }
    if (n > 2)
        cout<<n<<endl;
}

void fillPrefixSum(int arr[], int N, int prefixSum[])
{
    prefixSum[0] = arr[0];

    for (int i = 1; i < N; i++)
        prefixSum[i] = prefixSum[i-1] + arr[i];
}

int factorial(int n)
{
    return (n==1 || n==0) ? 1: n * factorial(n - 1);
}

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;
}




void solve()
{
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<s.length();i++)
    {
        cnt+=(s[i]-'0');
    }
    if(cnt%9==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



signed main()
{
	must;
    int tt=1;
    //cin >> tt;
	while(tt--)solve();
	return 0;
}


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

using namespace std;

typedef long long ll;
#define pb push_back
#define dbg(x) cerr << #x << " " << x << "\n"


const int N = 500;

int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};
int hate[1 + N][1 + N];
int view[1 + N][1 + N];
int n;

inline bool inside (int &x, int &y) {
    return (1 <= x && x <= n && 1 <= y && y <= n);
}

inline void dfs (int x, int y) {
    for (int d = 0; d < 4; d++) {
        int xn = x + dx[d];
        int yn = y + dy[d];
        if (inside (xn, yn) && hate[x][y] + view[x][y] < hate[xn][yn]) {
            hate[xn][yn] = hate[x][y] + view[x][y];
            dfs (xn, yn);
        }
    }
}

void solveTest () {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            hate[i][j] = min (i - 1, min (j - 1, min (n - i, n - j)));
            view[i][j] = 1;
        }
    }

    ll ans = 0;
    for (int i = 1; i <= n * n; i++) {
        int p;
        cin >> p;
        pair <int, int> id = {(p - 1) / n + 1, (p - 1) % n + 1};
        ans += hate[id.first][id.second];
        view[id.first][id.second] = 0;
        dfs (id.first, id.second);
    }
    cout << ans << "\n";
}

int main() {
    int t = 1;
 ///   cin >> t;
    while (t--) solveTest ();
    return 0;
}


Measured memory_bytes: 21028
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

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

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N, H, W;
    cin >> N >> H >> W;

    ll diff_x = N - W + 1;
    ll diff_y = N - H + 1;

    p(diff_x * diff_y);

    return 0;
}

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

alias Edge = Tuple!(int, "from", int, "to", int, "s");
alias Pair = Tuple!(int, "sgn", int, "val");
enum inf = 2*10^^9 + 3;

void main() {
    int n, m;
    scan(n, m);

    auto adj = new Edge[][](n, 0);
    auto es = new Edge[](m);

    foreach (i ; 0 .. m) {
        int ui, vi, si;
        scan(ui, vi, si);
        ui--, vi--;
        adj[ui] ~= Edge(ui, vi, si);
        adj[vi] ~= Edge(vi, ui, si);
        es[i] = Edge(ui, vi, si);
    }

    auto t = new Pair[](n);
    t[] = Pair(0, 0);

    void dfs(int v, int s, int a) {
        t[v] = Pair(s, a);

        foreach (e ; adj[v]) {
            if (t[e.to].sgn == 0) {
                dfs(e.to, s*(-1), e.s - a);
            }
        }
    }

    dfs(0, 1, 0);

    int x = inf;
    long ans = inf;

    foreach (i ; 0 .. m) {
        int u = es[i].from, v = es[i].to;
        int s = es[i].s;
        if (t[u].sgn != t[v].sgn) {
            if (t[u].val + t[v].val != s) {
                writeln(0);
                return;
            }
        }
        else if (t[u].sgn == 1) {
            int df = s - (t[u].val + t[v].val);
            if (df % 2 == 1 || df < 0) {
                writeln(0);
                return;
            }
            if (x == inf || x == df) {
                x = df;
                ans = 1;
            }
            else {
                writeln(0);
                return;
            }
        }
        else if (t[u].sgn == -1) {
            int df = s - (t[u].val + t[v].val);
            if (df % 2 == 1 || df > 0) {
                writeln(0);
                return;
            }
            if (x == inf || x == -df) {
                x = -df;
                ans = 1;
            }
            else {
                writeln(0);
                return;
            }
        }
    }

    long lo = 1, hi = inf;

    foreach (i ; 0 .. n) {
        if (t[i].sgn == 1) {
            lo = max(lo, -t[i].val + 1);
        }
        else {
            hi = min(hi, t[i].val - 1);
        }
    }

    debug {
        writefln("%d %d", lo, hi);
    }

    ans = min(ans, max(0, hi - lo + 1));
    writeln(ans);
}



































void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 25340
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i,n) FOR(i,0,n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int main(void){
	ll dp[4][4001];
	fill_n(*dp, 4*4001, 0);
	//????????????
	rep(i, 1001)dp[0][i] = 1;

	for(int i = 1; i <= 3; i++){
		for(int j = 4000; j >= 0; j--){
			for(int k = 0; k <= 1000; k++){
				if(j-k < 0)break;
				dp[i][j] += dp[i - 1][j - k];
			}
		}
	}

	int n;
	while(cin >> n)FIN(dp[3][n]);

	return 0;
}

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

int gcd(int a, int b) {
    if(b == 0)
        return a;
    return gcd(b, a % b);
}

int main() {
    int n, k; cin >> n >> k;
    vector<int> v(n, 0);
    int g = 0;

    for(int i = 0; i < n; ++i) {
        cin >> v[i];
        g = gcd(g, v[i]);
    }

    sort(v.rbegin(), v.rend());

    if(k > v[0]) {
        cout << "IMPOSSIBLE\n";
        return 0;
    } 

    if(k % g == 0) {
        cout << "POSSIBLE\n";
    } else {
        cout << "IMPOSSIBLE\n";
    }
}

Measured memory_bytes: 640