akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

#define MAX 100005
typedef struct{
    char name[100];
    int a;
}PPP;

PPP queue[MAX];
int head;
int tail;

void push(PPP a){
    queue[tail] = a;
    tail =  (tail+1)% MAX;
}

PPP pop(){
    PPP a = queue[head];
    head = (head+1)% MAX;
    return a;
}

int main(){
    int Total, theNumber, n, j;
    Total = 0;
    PPP ppp;
    scanf("%d %d", &n, &theNumber);
    for(j=0; j<n; j++){
        scanf(" %s %d", ppp.name, &ppp.a);
        push(ppp);
    }
    while(head != tail){
       PPP tmp = pop();
       if(tmp.a <= theNumber){
            Total = Total + tmp.a;
            printf("%s %d\n", tmp.name, Total);
       }
       else{
            Total = Total + theNumber;
            tmp.a = tmp.a - theNumber;
            push(tmp);
       }
    }
    return 0;
}



Measured memory_bytes: 11884
#include<stdio.h>
#include<stdlib.h>
int cmp(const void *a, const void *b){
  return *(int *)a - *(int *)b;
}
int main(void){
  int *tree;
  int n, k, sub = 0, min = 1000000000;
  scanf("%d %d", &n, &k);
  tree = malloc(sizeof(int)*n);
  for(int i=0;i<n;i++){
    scanf("%d", (tree+i));
  }
  qsort(tree, n, sizeof(int), cmp);
  for(int i=0;i<n-k+1;i++){
    sub = *(tree+i+k-1) - *(tree+i);
    if(sub < min) min = sub;
  }
  printf("%d\n", min);
  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>

#define rep0(i, n) for (i = 0; i < n; i++)
#define rep(s, i, n) for (i = s; i < n; i++)
using namespace std;
int A[200005];
int a[200005];

int main()
{
    int N, i, j, m;
    cin >> N;
    rep0(i, N) cin >> A[i];

    sort(A, A + N, greater<int>());

    long long ans = A[0];
    int t;

    rep(1, i, N)
    {
        if (2 * i + 1 <= N-1)
            ans += A[i] * 2;
        else if (2 * i + 1 == N)
            ans += A[i];
        else
            break;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4420
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>
#include <valarray>
#include<stack>
#include<sstream>
#include<math.h>

using namespace std;

void Solution()
{
    int H, W;
    
    while(cin>>H>>W)
    {
        if (H == 0 || W == 0)
        {
            break;
        }
        
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                if (i > 0 && i < H - 1 && j > 0 && j < W - 1)
                {
                    cout<<".";
                }
                else
                {
                    cout<<"#";
                }
            }
            
            cout<<endl;
        }
        
        cout<<endl;
    }
    
    
}

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

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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

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

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n), tp(n, -1);
    rep(i, n) {
        cin >> a[i];
        a[i]--;
    }
    int now = 0;
    int loopsz = -1, offset = -1;
    rep(i, n * 2) {
        if(tp[now] != -1) {
            loopsz = i - tp[now];
            offset = tp[now];
            break;
        } else {
            tp[now] = i;
            if(i == k) {
                cout << now + 1 << endl;
                return 0;
            }
            now = a[now];
        }
    }

    //dbg
    // cout << offset << "\t" << loopsz << endl;

    ll key = (k - offset) % loopsz + offset;
    if(k < offset) key = k;

    //dbg
    // cout << key << endl;

    rep(i, n) {
        if(tp[i] == key) {
            cout << i + 1 << endl;
            return 0;
        }
    }
    /*
    set<int> st;
    int now = 0;
    int lpb = -1, lpe = -1;
    int from = -1;
    while(1) {
        if(st.count(now)) {
            // already exist => loop
            lpb = now;
            lpe = from;
            break;
        } else {
            // not exist:
            st.insert(now);
            from = now;
            now = a[now];
        }
    }
    */
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

template <class T>
inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}


Measured memory_bytes: 4844
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
# import numpy as np
# import scipy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]

def main():
    n=inp()
    for i in range(1,50001):
        if int(i*1.08)==n:
            print(i)
            return
    print(':(')
if __name__ == "__main__":
    main()

Measured memory_bytes: 41452
#include<bits/stdc++.h>
using namespace std;
int main()
{

		int h,n;
		cin>>n>>h;
		int a[n];
		for(int i=0;i<n;i++)
		cin>>a[i];
		sort(a,a+n);
		if(h>=n)
		{
			cout<<0;
			return 0;
		}
		unsigned long long int ans=0;
		for(int i=0;i<n-h;i++)
		{
			ans+=a[i];
		}
		cout<<ans;
}

Measured memory_bytes: 4428
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007; 
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}






int main(){
    int N; std::cin >> N;
    std::string ans;
    int a(N % 10);
    if(a == 3){
        ans = "bon";
    }else if(a == 0 || a == 1 || a == 6 || a == 8){
        ans = "pon";
    }else{
        ans = "hon";
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
ll getPow(ll a,ll p){
  ll ret = 1,cp = a;
  while(p){
    if(p&1) ret = (ret*cp)%MOD;
    p >>= 1;
    cp = (cp*cp)%MOD;
  }
  return ret;
}
ll getInverse(ll a){
  return getPow(a,MOD-2)%MOD;
}
vector<ll> fact(5001,1),factinv(5001,1);
void init(ll l){
  for(ll i = 1; i < l; ++i){
    fact[i] = (fact[i-1]*i)%MOD;
    factinv[i] = (factinv[i-1]*getInverse(i))%MOD;
  }
}
ll C(ll a,ll b){
  ll ans = fact[a];
  ans = (ans*factinv[a-b])%MOD;
  ans = (ans*factinv[b])%MOD;
  return ans;
}
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,k;
  cin >> n >> k;
  init(5000);
  if(n == k){
    cout << 1 << '\n';
    for(ll i = 2; i <= k; ++i) cout << 0 << '\n';
    return 0;
  }
  for(ll i = 1; i <= k; ++i){
    ll ret = 0,Cki = C(k-1,i-1);
    if(i > 1 and i <= n-k+1) ret = (ret + C(n-k-1,i-2)*Cki)%MOD;
    if(i <= n-k) ret = (ret + 2*C(n-k-1,i-1)*Cki)%MOD;
    if(i <= n-k-1) ret = (ret + C(n-k-1,i)*Cki)%MOD;
    cout << ret%MOD << '\n';
  }
  return 0;
}

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

#define int long long

auto main() -> signed {
  string s;
  cin >> s;

  int ans = 700;
  for(int i=0; i<s.size(); ++i) {
    if(s[i]=='o') ans+=100;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;

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


Measured memory_bytes: 640
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    

s=int(input())
S=[s]
cnt=2

while s>0:
	if s%2==0:
		s=s//2
		if s in S:
			print(cnt)
			sys.exit()
		S.append(s)
	else:
		s=3*s+1
		if s in S:
			print(cnt)
			sys.exit()
		S.append(s)
	cnt+=1
		
	

Measured memory_bytes: 3060
#include<bits/stdc++.h> 
using namespace std; 
#define ll long long
#define mod (int)(1e9 + 7) 
int main() 
{ 
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n,a,b;
    cin>>n>>a>>b;
    cout<<min(n*a,b);
    return 0;
} 


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
using namespace std;
#define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  string ans;
  if(s1.size()>s2.size()) {
    ans = "GREATER";
    printf("GREATER\n");
  } else if (s1.size()<s2.size()) {
    ans = "LESS";
    printf("LESS\n");
  } else {
    int ss1 = s1.size();
    for (int i=0;i<ss1;i++) {
      if (s1[0] < s2[0]) {
        printf("LESS\n");
        return 0;
      } else if (s1[0] > s2[0]) {
        printf("GREATER\n");
        return 0;
      }
    }
    printf("EQUAL\n");
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
 
public class Main {
	final static long MOD = 1000000007L;
 
	public static void main(String[] args) {
		Reader in = new Reader();
		int n = in.nextInt();
		int w = in.nextInt();
		long[][] a = new long[n][2];
		for (int i = 0; i < n; i++) {
			a[i][0] = in.nextLong();
			a[i][1] = in.nextLong();
		}
		int v = 100000;
		long[] dp = new long[v+1];
		Arrays.fill(dp, -1);
		dp[0] = 0;
		long ans = 0;
		for(int i = 0; i<n; i++) {
			int add = (int) a[i][1];
			for(int j = v; j>=add; j--) {
				if(dp[j-add]==-1) continue;
				if(dp[j]==-1||dp[j]>dp[j-add]+a[i][0]) dp[j] = dp[j-add]+a[i][0];
				if(dp[j]<=w) ans = Math.max(j, ans);
			}
		}
		System.out.println(ans);
	}
 
	static class Reader {
		static BufferedReader br;
		static StringTokenizer st;
		private int charIdx = 0;
		private String s;
 
		public Reader() {
			this.br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		public int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
 
		public char nextChar() {
			if (s == null || charIdx >= s.length()) {
				if (st == null || !st.hasMoreTokens())
					try {
						readLine();
					} catch (Exception e) {
					}
				s = st.nextToken();
				charIdx = 0; 
			}
			return s.charAt(charIdx++);
		}
 
		public long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
 
		public char[] nca() {
			return next().toCharArray();
		}
 
		public String[] nS(int n) {
			String[] a = new String[n];
			for (int i = 0; i < n; i++)
				a[i] = next();
			return a;
		}
 
		public int nextInt() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return Integer.parseInt(st.nextToken());
		}
 
		public double nextDouble() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return Double.parseDouble(st.nextToken());
		}
 
		public Long nextLong() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return Long.parseLong(st.nextToken());
		}
 
		public String next() {
			if (st == null || !st.hasMoreTokens())
				try {
					readLine();
				} catch (Exception e) {
				}
			return st.nextToken();
		}
 
		public static void readLine() {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
			}
		}
	}
}

Measured memory_bytes: 22228
#include <iostream>
#include <cstdio>

using namespace std;

const int P=1000000007;
const int N=3005;

int f[N][N][2];
int n,m,ans;

inline void update(int &x,int y){(x+=y)%=P;}

int main()
{
	//freopen("piling.in","r",stdin),freopen("piling.out","w",stdout);
	scanf("%d%d",&n,&m);
	for (int i=0;i<=n;++i) update(f[0][i][i==0],1);
	for (int i=0,cur;i<m;++i)
		for (int j=0;j<=n;++j)
			for (int k=0;k<2;++k)
				if (cur=f[i][j][k])
				{
					if (j) update(f[i+1][j-1][k|(j==1)],cur),update(f[i+1][j][k|(j==1)],cur);
					if (n-j) update(f[i+1][j+1][k],cur),update(f[i+1][j][k],cur);
				}
	ans=0;
	for (int i=0;i<=n;++i) update(ans,f[m][i][1]);
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}

Measured memory_bytes: 70656
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int N, M;
vector<vector<bool>> adj;

int dfs(int now, vector<bool> visited) {
    bool all_visited = true;
    for (int i = 0; i < N; i++) {
        all_visited &= visited[i];
    }
    if (all_visited) return 1;

    int cnt = 0;
    for (int nxt = 0; nxt < N; nxt++) {
        if (!adj[now][nxt]) continue;
        if (visited[nxt]) continue;

        visited[nxt] = true;
        cnt += dfs(nxt, visited);
        visited[nxt] = false;
    }
    return cnt;
}

int main() {
    cin >> N >> M;
    adj = vector<vector<bool>>(N, vector<bool>(N, false));
    for (int i = 0; i < M; i++) {
        int u, v; cin >> u >> v;
        adj[u - 1][v - 1] = adj[v - 1][u - 1] = true;
    }
    vector<bool> visited(N, false);
    visited[0] = true;
    cout << dfs(0, visited) << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

x = A[0]
y = sum(A[1:])

c=x-y
ans=abs(c)

for i in range(1,N-1):
  c+=2*A[i]
  if abs(c)< abs(ans):
    ans = abs(c)

print(ans)

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

typedef long long ll;
typedef long double ld;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN

#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)

/////////////////////GCD//////////////////////
ll gcd(ll a, ll b)
{
	if(b==0) return a;
	return gcd(b, a%b);
}


////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k, x, d;
	cin>>n>>k;
	map<int, int> ct;
	for(int i = 0; i < k; i++)
	{
		cin>>d;
		for(int j = 0; j < d; j++)
		{
			cin>>x;
			ct[x]++;
		}
	}
	int count = 0;
	for(int i = 1; i <= n; i++)
	{
		if(ct.count(i)==0)
		{
			count++;
			// cout<<i<<" ";
		}
	}
	cout<<count<<endl;
}


Measured memory_bytes: 3688
n, m, v, p = map(int, input().split())
a = [int(x) for x in input().split()]

a.sort(reverse=True)

l, r = 0, n
while r-l>1:
  key = (r+l)//2
  if key < p:
    l = key
    continue
  if a[key]+m < a[p-1]:
    r = key
    continue
  
  count = 0
  for i in range(n):
    if i < p-1 or i >= key:
      count += m
    else:
      count += a[key]+m-a[i]
  if count >= m*v:
    l = key
  else:
    r = key

print(r)

Measured memory_bytes: 14964
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
	int k=sc.nextInt();
	String s=sc.next();
	String add = "...";

	if(s.length()>k) {
		System.out.println(s.substring(0, k)+add);
	}
	else {
		System.out.println(s);
	}
	}
}

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

using namespace std;

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

int main() {
  int n = read();
  vector<pair<int, int> > e;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (n & 1) {
        if (i + j == n) continue;
      } else {
        if (i + j == n + 1) continue;
      }
      e.emplace_back(i, j); 
    }
  }   
  cout << e.size() << endl;
  for (auto p : e) cout << p.first << " " << p.second << endl;
  return 0;
}



Measured memory_bytes: 384
#include<cstdio>
using namespace std;
int main(){
    #ifdef LOCAL
    freopen("a", "r", stdin);
    #endif // LOCAL
    int n;
    while(~scanf("%d", &n)){
        if(n&1){
            printf("%d\n", n/2*(n/2+1));
        }
        else{
            printf("%d\n", n/2*(n/2));
        }
    }
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void){
    int N, A[100005], B[100005], i;
    scanf("%d", &N);
    for (i=1; i<=N; i++) scanf("%d", &A[i]);
    for (i=1; i<=N; i++) B[A[i]]=i;
    for (i=1; i<=N; i++) {
        printf("%d", B[i]);
        if (i!=N) printf(" ");
    }
    return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main(){
 int s,m=0;
  cin >> s;
  vector<int> a(1000000);
  a.at(0)=s;
  for(int i=0;i<1000000;i++){
    if(a.at(i)%2==0){
      a.at(i+1)=a.at(i)/2;
    }
    else{
      a.at(i+1)=3*a.at(i)+1;
    }
    for(int j=0;j<i+1;j++){
      if(a.at(j)==a.at(i+1)){
        m=i+1;
        break;
      }
    }
    if(m!=0){
      break;
    }
  }
  cout << m+1 <<endl;
}

Measured memory_bytes: 4096
#include <stdio.h>
int main(void){
  int a,b,c;
  int five=0,seven=0;
  scanf("%d %d %d",&a,&b,&c);
  if(a==5){five++;}
    if(b==5){five++;}
    if(c==5){five++;}
    if(a==7){seven++;}
    if(b==7){seven++;}
    if(c==7){seven++;}
  if(five==2&&seven==1){printf("YES\n");}
  else{printf("NO\n");}
  return 0;
}

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

using namespace std;

int main() {
    long long A, B, N;
    cin >> A >> B >> N;
    long long ans;
    if( N >= B-1 ){
        ans = A * (B-1) / B;
    }else{
        ans = A * N / B;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3612
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define MAPFOR(it,m) for( auto it = (m).begin(); it != (m).end() ; ++it )
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main(void){
    int n;
    cin >> n;
    ll x;
    x = 1;
    ll limit = 1;
    REP(i, 18) limit *= 10;
    
    vll a(n);
    REP(i, n) {
        cin >> a[i];
        if(a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    
    REP(i, n) {
        ll old_x = x;
        ll ai = a[i];
        x *= ai;
        if(x > limit) {
            cout << -1 << endl;
            return 0;
        }
        if(x < old_x) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << x << endl;
    return 0;
}

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

#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
const ll N = 5e5 +9;

ll a, b[N], c, n, mn=9999999, mx=-999999;
string s,t;
vector <int> v;
int main(){
    cin >> s >> t;
    s += s;
    for(int i = 0; i < s.size()- t.size(); ++i){
        if(s.substr(i,t.size()) == t){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No";
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> X(N), Y(N);
    bool flag = false;
    int eo = 0;
    for(int i=0; i<N; ++i) {
        cin >> X[i] >> Y[i];
        if(i == 0) eo = abs((X[0] + Y[0] + 2) % 2);
        else if(eo != abs((X[i] + Y[i]) % 2)) flag = true;
    }
    if(flag) {
        cout << -1 << endl;
        return 0;
    }

    if(eo == 1) {
        cout << 31 << endl;
        for(int i=0; i<31; ++i) cout << (1LL << i) << (i!=30 ? ' ' : '\n');
        for(int i=0; i<N; ++i) {
            long long tmp1 = (X[i] + Y[i] + (1LL<<31) - 1) / 2;
            long long tmp2 = (X[i] - Y[i] + (1LL<<31) - 1) / 2;
            for(int d=0; d<31; ++d) {
                int fx = (tmp1 >> d) & 1;
                int fy = (tmp2 >> d) & 1;
                if(fx && fy) cout << 'R';
                else if(fx) cout << 'U';
                else if(fy) cout << 'D';
                else cout << 'L';
            }
            cout << endl;
        }
    } else {
        cout << 32 << endl << "1 ";
        for(int i=0; i<31; ++i) cout << (1LL << i) << (i!=30 ? ' ' : '\n');
        for(int i=0; i<N; ++i) {
            cout << 'L';
            long long tmp1 = (X[i] + 1 + Y[i] + (1LL<<31)) / 2;
            long long tmp2 = (X[i] + 1 - Y[i] + (1LL<<31)) / 2;
            for(int d=0; d<31; ++d) {
                int fx = (tmp1 >> d) & 1;
                int fy = (tmp2 >> d) & 1;
                if(fx && fy) cout << 'R';
                else if(fx) cout << 'U';
                else if(fy) cout << 'D';
                else cout << 'L';
            }
            cout << endl;
        }
    }    
}

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

#define MOD 1000000007LL

int N;
vector<vector<int>> graph(111111);

long long dp[111111][2];

void DFS(int x,int from){
	long long w=1,b=1;
	for(auto t:graph[x]){
		if(t==from)continue;
		DFS(t,x);
		w*=dp[t][0]+dp[t][1];
		w%=MOD;
		b*=dp[t][0];
		b%=MOD;
	}
	dp[x][0]=w;
	dp[x][1]=b;
}

int main(){
	cin >> N;
	for(int i=0;i<N-1;i++){
		int x,y;
		cin >> x >> y;
		x--;
		y--;
		graph[x].push_back(y);
		graph[y].push_back(x);
	}
	
	DFS(0,-1);
	
	cout << (dp[0][0]+dp[0][1])%MOD << endl;
	
	return 0;
}

Measured memory_bytes: 14464
#include<stdio.h>
int main(){

  int A[100],sum=0,n,i,min=100000,max=-100,ave;

  while(1){
    min=100000;
    max=-100;
    sum=0;
    scanf("%d",&n);
    if(n==0)break;

    for(i=0;i<n;i++){
      scanf("%d",&A[i]);
      if(A[i]>max){
	max=A[i];
    }
      if(A[i]<min){
	min=A[i];
      }
    }

    for(i=0;i<n;i++){
      if(A[i]==max){
	A[i]=0;
	max=-1;
      }
      if(A[i]==min){
      A[i]=0;
      min=-1;
      }
    }
    for(i=0;i<n;i++){
      sum+=A[i];
    }
    ave=sum/(n-2);
    printf("%d\n",ave);
  }
  return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

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

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, m;
  cin >> n >> m;
  if (n == 1) {
    cout << (m + 1) % mod << "\n";
    return 0;
  }
  ll tot = (m + 1) % mod;
  ll lim = (m + 1) / (n - 1);
  tot *= (2 * lim + 1) % mod;
  tot %= mod;
  ll tmp = (n - 1) % mod;
  tmp *= lim % mod;
  tmp %= mod;
  tmp *= (lim + 1) % mod;
  tmp %= mod;
  tot = (tot + mod - tmp) % mod;
  cout << tot << "\n";
}

Measured memory_bytes: 3152
#include<cstdio>
int n,m,l;void solve(int p,int d){if(p==m){printf("%d\n",p);return;}printf("%d ",p);if(p==9)solve(5,0);else if(!p||d)solve(p+1,1);else solve(p-1,0);}main(){scanf("%d",&l);while(l--){scanf("%d%d",&n,&m);if(n==9||(n<6&&n>m))solve(n,0);else solve(n,1);}}

Measured memory_bytes: 1028
#include<stdio.h>
int main()
{
	long long tc,sum = 1;
	int flagO = 1,flag = 1;
	scanf("%lld",&tc);
	long long input[tc+1];
	for(int i = 0;i<tc;i++)
	{
		scanf("%lld",&input[i]);
		if(input[i] == 0) flagO =0;
	}
	for(int i = 0;i<tc;i++)
	{
		if(input[i] <= 1000000000000000000 / sum)
		{
			sum *= input[i];
		}
		else{
			flag = 0;
			break;
		}
	}
	if(flagO == 0) printf("0\n");
	else if(flag == 0) printf("-1\n");
	else printf("%lld\n",sum);
	
}

Measured memory_bytes: 2868
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int a[200000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n = gi();
    for (int i = 0; i < n; i++)
        a[i] = gi();
    sort(a, a+n);
    for (int i = 1; i < n; i++)
        if (a[i] == a[i-1]) {
            printf("NO\n");
            return 0;
        }
    printf("YES\n");

    return 0;
}


Measured memory_bytes: 1024
using System;
using System.Linq;

namespace _0587
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int m = int.Parse(Console.ReadLine());
            bool error = false; int max = m;
            for (int i = 0; i < n; i++)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                m += x[0] - x[1]; if (m < 0) error = true;
                max = Math.Max(max,m);
            }
            Console.WriteLine(error ? 0 : max);
        }
    }
}


Measured memory_bytes: 9576
macro_rules! get {
    (Vec<$t:ty>) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let MOD = 1000000007;

    let (N, K) = get!(usize, usize);

    // i - 1 > N - K ならばちょうどi回する操作は存在しない
    // そうでなければ (K - 1)C(i - 1) * (N - K + 1)C(N - K - i + 1)
    let mut dp: Vec<Vec<i64>> = vec!(vec!(0; N + 1); N + 1);
    dp[0][0] = 1;
    for i in 1..(N + 1) {
        dp[i][0] = 1;
        for j in 1..(i + 1) {
            dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % MOD
        }
    }
    for i in 1..(K + 1) {
        let ans = if i - 1 <= N - K {
            (dp[K - 1][i - 1] * dp[N - K + 1][N + 1 - K - i]) % MOD
        } else {
            0
        };
        println!("{}", ans);
    }
}

Measured memory_bytes: 45308
'use strict'

function query(segmentTree, index, ss, se, qs, qe) {
  // if segment tree range is inside query range
  if (ss >= qs && se <= qe) {
    return segmentTree[index]
  }
  // complete outside
  if (qs > se || qe < ss) {
    return 0
  }
  // overlap
  var mid = Math.floor((se - ss) / 2) + ss
  return Math.max(query(segmentTree, 2*index+1, ss, mid, qs, qe), query(segmentTree, 2*index+2, mid+1, se, qs, qe))
}

function update(segmentTree, index, ss, se, qi, val) {
  if (ss === se) {
    segmentTree[index] = val
    return
  }
  var mid = Math.floor((se - ss) / 2) + ss
  if (qi <= mid) {
    update(segmentTree, 2*index+1, ss, mid, qi, val)
  } else {
    update(segmentTree, 2*index+2, mid+1, se, qi, val)
  }
  segmentTree[index] = Math.max(segmentTree[2*index+1], segmentTree[2*index+2])
}

function solve(N, H, A, segmentTree) {
  var maxBeauty = 0
  for (var i = 0; i < N; i++) {
      var maxVal = query(segmentTree, 0, 0, N, 0, H[i]-1) + A[i]
      maxBeauty = Math.max(maxBeauty, maxVal)
      update(segmentTree, 0, 0, N, H[i], maxVal)
  }
  return maxBeauty
}

function main(input) {
  var lines = input.split("\n")
  var N = parseInt(lines[0])
  var H = lines[1].split(' ').map(l => parseInt(l))
  var A = lines[2].split(' ').map(l => parseInt(l))

  // build segment tree
  var treeSize = 2 * Math.pow(2, Math.ceil(Math.log2(N+1))) - 1 
  var segmentTree = new Array(treeSize).fill(0)
  var ans = solve(N, H, A, segmentTree)
  console.log(ans)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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

int main(){

    char c; cin>>c;

    if( c == 'A') cout<<'T'<<endl;

    else if( c == 'T') cout<<'A'<<endl;

    else if( c == 'G') cout<<'C'<<endl;

    else if( c == 'C') cout<<'G'<<endl;

    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000)
n, m = map(int, input().split())
edges = [[] for _ in range(n)]
rev_edges = [[] for _ in range(n)]
for _ in range(m):
  x, y = map(int, input().split())
  x -= 1
  y -= 1
  edges[x].append(y)
  rev_edges[y].append(x)


dist = [0] * n
checked = [False] * n
def check(x):
  if checked[x]:return dist[x]
  ret = 0
  for fr in rev_edges[x]:
    ret = max(ret, check(fr) + 1)
  dist[x] = ret
  checked[x] = True
  return ret

for i in range(n):
  check(i)
print(max(dist))

Measured memory_bytes: 184112
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n,m;
  cin >> n >> m;
  if((n+1)/2>=m) pr("YES");
  else pr("NO");
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

int main()
{
	int a, b;
	cin >> a >> b;
	int sum = a + b;
	cout << (sum + 1) / 2 << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
using namespace std;
int main(void){
 	int N = 0;
  	vector<int> X;
  	int xMin = 100;
  	int xMax = 0;
  	
  	cin >> N;
  	for (int i = 0; i < N; ++i) {
  	    int temp = 0;
  	    cin >> temp;
  	    X.push_back(temp);
  	    xMin = min(temp, xMin);
  	    xMax = max(temp, xMax);
  	}
  	
  	int result = 10000000;
    for (int i = xMin; i <= xMax; ++i) {
        int cost = 0;
        for (int j = 0; j < N; ++j) {
            cost += ((X.at(j) - i) * (X.at(j) - i));
        }
        result = min(result, cost);
    }
    
    cout << result << endl;
  	
  	return 0;   
}


Measured memory_bytes: 256
program bbb
implicit none

integer :: n,m,i,j,res
integer,dimension(30) :: a, b
integer,allocatable, dimension(:) :: k

read*, n,m
allocate(k(n))

res=0
b=0

do i=1,n
a=0
read*, k(i), a(1:k(i))
 do j=1,k(i)
 b(a(j))=b(a(j))+1
 end do
end do

do i=1,m
if(b(i)==n) res=res+1
end do
write(*,'(i0)') res

end program

Measured memory_bytes: 256
#n=int(input())
n,m,x=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

right=len([a for a in al if a <=x])
left=len([a for a in al if a>=x])

print(min(right,left))



Measured memory_bytes: 9100
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#define log(args...)
#else
#define log(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); logf(_it, args); }
void logf(istream_iterator<string> it) {
}
template<typename T, typename ... Args>
void logf(istream_iterator<string> it, T a, Args ... args) {
	cout << *it << " = " << a << endl;
	logf(++it, args...);
}
#endif

#define forn(i,k,n) for(ll i=(k); i<(n); i++)

const double PI = acos(-1);
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

void solve() {
	vi a = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	cini(k);
	k--;
	cout << a[k] << endl;
}

int main() {
	cin.tie(nullptr);
	std::ios::sync_with_stdio(false);
	solve();
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int s[1010];
int top = -1;
void push(int x) {
    ++top;
    s[top] = x;
}
int pop() {
    --top;
    return s[top+1];
}

int main() {
    string  x;
    while(cin >> x) {
        if (x == "+") {
            push(pop() + pop());
        } else if (x == "-") {
            int a = pop();
            int b = pop();
            push(b - a);
        } else if (x == "*") {
            push(pop() * pop());
        } else push(atoi(x.c_str()));
    }
    cout << pop() << endl;
}


Measured memory_bytes: 3172
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;//for StringBuilder
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var list = new string[n];
        for (int i = 0; i < n; i++)
        {
            list[i] = string.Join("", Console.ReadLine().OrderBy(f => f));
        }
        Array.Sort(list, StringComparer.Ordinal);
        list = list.Reverse().ToArray();
        long ans = 0;
        long cnt = 1;
        for (int i = 1; i < n; i++)
        {
            if (list[i] == list[i - 1]) cnt++;
            else
            {
                ans += cnt * (cnt - 1) / 2;
                cnt = 1;
            }
        }
        Console.WriteLine(ans + cnt * (cnt - 1) / 2);
    }
}


Measured memory_bytes: 26384
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = [deque(input().replace('a', '0').replace('b', '1').replace('c', '2')) for _ in range(3)]

next = '0'
while True:
    tmp = S[int(next)]
    if len(tmp) == 0:
        ans = next
        break
    else:
        next = tmp.popleft()

if ans == '0':
    print('A')
elif ans == '1':
    print('B')
else:
    print('C')


Measured memory_bytes: 10436
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> p(N);
  for(int i=0;i<N;i++) cin >> p.at(i);
  sort(p.begin(),p.end());
  int ans=0;
  for(int i=0;i<K;i++) ans+=p.at(i);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3628
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def main():
    N = input()
    print("Yes" if N == N[::-1] else "No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

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

	vector<int> a(26);

	for (int i = 0; i < s.length(); i++)
	{
		for (int j = 0; j < 26; j++)
		{
			if (s.at(i) == 'a' + j)
			{
				a.at(j)++;
				break;
			}
		}
	}

	for (int i = 0; i < 26; i++)
	{
		if (a.at(i) == 0)
		{
			cout << (char)('a' + i) << endl;
			return 0;
		}
	}

	cout << "None" << endl;
}

Measured memory_bytes: 512
n=int(input())
w=list(map(int,input().split()))
s=sum(w)
a=[w[0]]
b=[s-w[0]]
c=[]
for i in range(1,n-1):
  a.append(a[i-1]+w[i])
  b.append(s-a[i])
  c.append(abs(a[i]-b[i]))
print(min(c))

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int[] cnt = new int[N+10];
		for(int i=0;i<M;i++){
			cnt[A[i]]++;
			cnt[B[i]]++;
		}
		
		bool chk = true;
		for(int i=0;i<N+1;i++){
			chk &= cnt[i] % 2 == 0;
		}
		Console.WriteLine(chk ? "YES" : "NO" );
		
		
	}
	int N,M;
	int[] A,B;
	public Sol(){
		var d = ria();
		N = d[0]; M = d[1];
		A = new int[M];
		B = new int[M];
		for(int i=0;i<M;i++){
			d = ria();
			if(d[0] > d[1]){ var t = d[0]; d[0] = d[1]; d[1] = t;}
			A[i] = d[0]; B[i] = d[1];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 18244
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		System.out.println(c+" "+a+" "+b);
	}

}


Measured memory_bytes: 21844
n = int(input())
B = [0]+list(map(int,input().split()))

ans_li = []
for i in range(n):
    for j in range(len(B)-1,0,-1):
        if j==B[j]:
            ans_li.append(B.pop(j))
            break
    else:
        print(-1);exit()
print('\n'.join(map(str,ans_li[::-1])))

Measured memory_bytes: 3064
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    K=int(readline())

    N=50
    M=K//N
    L=K%N
    A=range(N)
    A=list(map(lambda x:x+M,A))
    for i in range(L):
        A[i]+=N+1
        A=list(map(lambda x:x-1,A))

    print(N)
    print(*A)

if __name__=="__main__":
    main()

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

Measured memory_bytes: 596
input_=[]
for i in range(2):
    input_.append(input())
    
K,N = list(map(int,input_[0].split()))
L = list(map(int,input_[1].split()))

dist=[0]*N

d = -1    
dist[d]=K + L[d+1]-L[d]
d_max = dist[d]

for d in range(N-1):
    dist[d] = L[d+1]-L[d]
    if d_max < dist[d]:
        d_max = dist[d]

ans=sum(dist)-d_max
print(ans)

Measured memory_bytes: 26444
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long total = 0;
		ArrayList<Integer> list = new ArrayList<Integer>();
		
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}
		//????????§???????????????
		Collections.sort(list);
		for (int i = 0; i < list.size(); i++) {
			total += list.get(i);
		}
		//????°????????????§??????????¨???????????????????
		System.out.println(list.get(0) +" "+ list.get(list.size()-1) +" "+ total);
	}
}

Measured memory_bytes: 39820
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int N,K;
    cin >> N >> K;
    int now = 1;
    rep(i,N){
        if(now <= K) now*=2;
        else now+=K;
    }
    cout << now << endl;
}

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

using namespace std;

string S, T;

bool fos(int idx)
{
  for (int i = 0; i < T.size(); i++) {
    if (S[i + idx] == '?') continue;
    else if (S[i + idx] != T[i]) return false;
  }
  return true;
}

int main()
{
  cin >> S >> T;
  int N = S.size();
  int K = T.size();

  bool flag = false;
  int i;
  for (i = N - K + 1; i >= 0; i--) {
    if (fos(i)) {
      for (int j = 0; j < T.size(); j++) {
        S[i + j] = T[j];
      }
      for (int j = 0; j < S.size(); j++) {
        if (S[j] == '?') cout << 'a';
        else cout << S[j];
      }
      return 0;
    }
  }
  cout << "UNRESTORABLE" << endl;
  return 0;
}


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

int main() {
#ifndef ONLINE_JUDGE
   freopen("inp.txt", "r", stdin);      freopen("outp.txt", "w", stdout);
#endif
   ios::sync_with_stdio(false);   cin.tie(NULL);   cout.tie(NULL);

   ll n, x, k;
   cin >> n >> k;
   vector <ll> a(n);
   for (auto &i: a)
      cin >> i;

   auto binary_search = [&](ll x) {
      int res = 0;
      for (auto &i: a) {
         if (i <= x)
            continue;
         res += ((i + x - 1) / x) - 1;
      }
      return res;
   };

   ll lo = 1, hi = 1e9 + 10, mid = 0;
   while (lo < hi) {
      mid = (hi + lo) / 2;
      int x = binary_search(mid);
      if (x <= k)
         hi = mid;
      else
         lo = mid + 1;
   }
   cout << lo << '\n';

   return 0;
}

Measured memory_bytes: 4732