akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        try {
            while (true) {
                Student s = new Student(sc.nextInt(), sc.nextInt(), sc.nextInt());
                System.out.println(s.judge());
            }
        } catch(Exception e) {

        }



    }

}

class Student {
    int m;
    int f;
    int r;

    Student(int m, int f, int r) throws Exception {
        if (m == -1 && f == -1 && r == -1) {
            throw new Exception();
        }
        this.m = m;
        this.f = f;
        this.r = r;
    }

    char judge() {
        if (m == -1 || f == -1) {
            return 'F';
        } else if (m + f >= 80) {
            return 'A';
        } else if (m + f >= 65) {
            return 'B';
        } else if (m + f >= 50) {
            return 'C';
        } else if (m + f >= 30) {
            if (r >= 50) {
                return 'C';
            }
            return 'D';
        } else {
            return 'F';
        }
    }
}


Measured memory_bytes: 26480
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,l;
  char a,b;
  cin >> n >> a >> m >> b >> l;
  if (m<=4){
    cout << "Heisei" << endl;
  }
  else {
    cout << "TBD" << endl;
  }
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {

	static int[][] field;
	static String[][] dp;
	static int h,w;
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(true){
			w = cin.nextInt();
			h = cin.nextInt();
			if(w+h==0)break;
			field=new int[h][w];
			dp=new String[h][w];
			for(int i = 0;i<h;i++){
				String s = cin.next();
				for(int j = 0;j<w;j++){
					dp[i][j]="";
					if(Character.isDigit(s.charAt(j))){
						field[i][j]=s.charAt(j)-'0';
					}
					else{
						field[i][j]=-1;
					}
				}
			}
			for(int i = 0;i<w;i++){
				if(i==0){
					if(field[0][i]<=0){

					}
					else{
						dp[0][i]=""+field[0][i];
					}
				}
				else{
					if(field[0][i]==-1){

					}
					else{
						if(!dp[0][i-1].equals("0")&&!dp[0][i-1].equals("")){
							dp[0][i]=dp[0][i-1]+field[0][i];
						}
						else{
							dp[0][i]=""+field[0][i];
						}
					}
				}
			}
			for(int i = 0;i<h;i++){
				if(i==0){
					if(field[i][0]<=0){

					}
					else{
						dp[i][0]=""+field[i][0];
					}

				}
				else{
					if(field[i][0]==-1){

					}
					else{
						if(!dp[i-1][0].equals("0")&&!dp[i-1][0].equals("")){
							dp[i][0]=dp[i-1][0]+field[i][0];
						}
						else{
							dp[i][0]=""+field[i][0];
						}
					}
				}
			}
			String ans="0";
			for(int i = 1;i<h;i++){
				for(int j = 1;j<w;j++){
					if(field[i][j]==-1)continue;
					String s1=dp[i-1][j]+field[i][j];
					String s2=dp[i][j-1]+field[i][j];
					String s3=field[i][j]+"";
					if(big(s1,s2)>=0){
						if(big(s1,s3)>=0){
							dp[i][j]=s1;
						}
						else{
							dp[i][j]=s3;
						}
					}
					else{
						if(big(s2,s3)>=0){
							dp[i][j]=s2;
						}
						else{
							dp[i][j]=s3;
						}
					}
					while(dp[i][j].charAt(0)=='0'&&dp[i][j].length()>1){
						dp[i][j]=dp[i][j].substring(1,dp[i][j].length());
					}
					if(big(dp[i][j],ans)>0){
						ans=dp[i][j];
					}
				}
			}
			for(int i = 0;i<h;i++){
				for(int j = 0;j<w;j++){
					if(big(dp[i][j],ans)>0){
						ans=dp[i][j];
					}
				}
			}
			//output();
			System.out.println(ans);
		}

	}
	static int big(String s1,String s2){
		if(s1.length()==s2.length()){
			return s1.compareTo(s2);
		}
		return s1.length()-s2.length();
	}
	static void output(){
		for(int i = 0;i<h;i++){
			for(int j = 0;j<w;j++){
				System.out.print(dp[i][j]+" ");
			}
			System.out.println();
		}
		System.out.println();
	}
}

Measured memory_bytes: 14000
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string str;
  cin>>str;
  int l=str.length();
  int c=0;
  if(l==6)
  {
    for(int i=0;i<6;i++)
    {
      if(str[i]>=97 && str[i]<=122)
      {
        c++;
      }
    }
      if(c==6)
      {
        if(str[2]==str[3] && str[4]==str[5])
        {
          cout<<"Yes"<<"\n";
        }
        else
          cout<<"No"<<"\n";
      }
      else
        cout<<"No"<<"\n";
  }
  return 0;
}
      
        


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


int main(){
  ll a,b; cin >> a >> b;
  
  if(a % 2 == 0 || b % 2 == 0) cout << "No" << endl;
  else cout << "Yes" << endl;
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<int,int> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
long myPow(long a,long b,int M) {
    long ret = 1;
    long tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
int nCk(int n,int k,int M) {
    long ret = 1;
    int mi = min(k, n-k);
    for(int i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(int i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (int)ret;
};

int numA(int a){
    if(a==1) return 2;
    else if(a==2) return 5;
    else if(a==3) return 5;
    else if(a==4) return 4;
    else if(a==5) return 5;
    else if(a==6) return 6;
    else if(a==7) return 3;
    else if(a==8) return 7;
    else return 6;
}

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

    vector<int> A(M);
    vector<int> A_NUMS(M);

    REP(i,M){
        cin >> A[i];
        A_NUMS[i] = numA(A[i]);
    }

    vector<int> dp(N+10,-inf);
    dp[0]=0;

    rep(i,0,N+1) REP(j,M) {
        if(dp[i]==-inf) continue;
        chmax(dp[i + A_NUMS[j]],dp[i]+1);
    }

    vector<int> ord(M);
    iota(all(ord),0);
    sort(all(ord),[&](int x,int y){
        return A[x]>A[y];
    });

    string ans="";
    int now = N;
    while(now>0){
        for(auto o:ord){
            int ni = now-A_NUMS[o];
            if(ni < 0) continue;
            if(dp[ni] == dp[now]-1){
                ans += to_string(A[o]);
                now = ni;
                break;
            }
        }
    }

    pl(ans)

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int N;
    cin >> N;
    int ans = 0;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        A[i]--;
    }
    vector<int> B(N);
    for (int i = 0; i < N; i++) {
        cin >> B[i];
        ans += B[i];
    }
    vector<int> C(N-1);
    for (int i = 0; i < N-1; i++) {
        cin >> C[i];
    }
    REP(i, N-1){
        if(A[i+1]-A[i]==1){
            ans += C[A[i]];
        }
    }
    pr(ans);
}

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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(auto i=(a);i<(b);++i)
#define RFOR(i,a,b) for(auto i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

int N;
int main() {
    std::cin >> N;
    int l2 = std::log2(N);
    std::cout << std::pow(2, l2) << std::endl;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
  val s = readLine()!!.toInt()
  var mlist = mutableListOf(s)
  var i = 0
  while(true) {
    val v = mlist.get(i)
    if(v%2==0) {
      val div = v/2
      if(mlist.contains(div)){
        println(i+2)
        break
      }
      mlist.add(div)
    } else{
      val mul = v*3 + 1
      if(mlist.contains(mul)){
        println(i+2)
        break
      }
      mlist.add(mul)
    }
    i++
  }
}

Measured memory_bytes: 31816
n = int(input())
a = [int(i) for i in input().split()]
b = [0 for i in range(n)]
b[0] = a[0];
for i in range(1, n) :
    b[i] = b[i-1]+a[i]
tot = b[n-1]
ans = 10000000000
for i in range(0, n-1) :
    x = b[i]
    y = tot - x
    if abs(x-y) < ans :
        ans = abs(x-y)
print(ans)


Measured memory_bytes: 24684
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String tex=sc.next();
		int mojisu=tex.length();
		int wake=sc.nextInt();
		String moto="";
		for(int i=0; i<mojisu; i+=wake) {
			moto=moto+tex.charAt(i)+"";
		}
		System.out.println(moto);
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

ll v, e;
vector<vector<pair<ll, ll>>> graph;

ll pos(ll node) {
  return 1 << node;
}

vector<vector<ll>> table;
#define DP table[node][visited]
ll dfs(ll node=0, ll visited=1) {
  if (DP != -1) return DP;

  if (__builtin_popcount(visited) == v) {
    for (auto v: graph[node]) {
      if (v.first == 0) return DP = v.second;
    }
    return DP = 1ll << 60;
  }
  ll minv = 1ll << 60;
  for(auto v: graph[node]) {
    if (!(visited & pos(v.first))) {
      minv = min(minv, dfs(v.first, visited | pos(v.first)) + v.second);
    }
  }
  return DP = minv;
}

int main() {
  cin >> v >> e;

  graph = vector<vector<pair<ll, ll>>>(v);
  REP(i, e) {
    ll input(s, t, d);
    graph[s].push_back({t, d});
  }

  table = vector<vector<ll>>(v, vector<ll>(1 << v, -1));

  ll cost = dfs();
  if (cost < 1ll << 60) {
    cout << cost << endl;
  } else {
    cout << -1 << endl;
  }
}



Measured memory_bytes: 7032
N, K = map(int, input().split())
D = list(map(int, input().split()))

#lst =[]
k = N
"""while k > 0:
    lst.append(k % 10)
    k //= 10
#lst.reverse()"""
#print(lst)


while 1:
    flg = True
    lst = []
    N = k
    while k > 0:
        lst.append(k % 10)
        k //= 10
    lst.reverse()
    #print(lst)
    for i in range(len(lst)):
        if lst[i] in D:
            flg = False
            #print("asd")
            break
    if flg == False:
        k = N
        k += 1
    else:
        break


print(N)

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

int main(){
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  printf("%d", (a == b ? a == c ? 1 : 2 : a == c ? 2 : b == c ? 2 : 3));
}


Measured memory_bytes: 256
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)
    def get_size(self, x):
        x = self.find(x)
        return self.size[x]
    
n,m=map(int,input().split())
uf1=UnionFind(n)
ab=[]
res=[]
for i in range(m):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    ab.append((a,b))
for a,b in ab[::-1]:
    aa=uf1.find(a)
    bb=uf1.find(b)
    if aa==bb:
        res.append(0)
    else:
        res.append(uf1.get_size(aa)*uf1.get_size(bb))
        uf1.union(aa,bb)
ans=0
for i in range(m):
    ans+=res[m-1-i]
    print(ans)

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

int GCD(int a, int b) {
    while (b != 0) {
        int t = a % b;
        a = b;
        b = t;
    }
    return a;
}

int main() {
    int n, x;
    cin >> n;
    int res;
    cin >> res;
    for (int i = 1; i < n; i++) {
        cin >> x;
        res = GCD(res, x);
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
typedef long long ll;

int n;
ll a[110000];
ll b[110000];
ll c[110000];

int main() {
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n) cin >> c[i];
	sort(a, a + n);
	sort(b, b + n);
	sort(c, c + n);
	ll ans = 0;
	rep(i, n) {
		ll A = (lower_bound(a, a + n, b[i]) - a);
		ll C = n - (upper_bound(c, c + n, b[i]) - c);
		ans += A * C;
	}
	cout << ans << endl;
	return 0;
}


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

static const int N = 100 + 1;

void trace(int* a, int n);
int bubbleSort(int* a, int n);
void swapInt(int& t1, int& t2);

int main() {
  int a[N], n;
  
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }

  int c = bubbleSort(a, n);
  trace(a, n);
  cout << c << endl;
}

void trace(int* a, int n) {
  for (int i = 0; i < n; ++i) {
    if (i) { printf(" "); }
    printf("%d", a[i]);
  }
  printf("\n");
}

int bubbleSort(int* a, int n) {
  int count = 0;
  bool flag = 1;
  for (int i = 0; flag; ++i) {
    flag = 0;
    for (int j = n - 1; j >= i + 1; --j) {
      if (a[j] < a[j - 1]) {
        swap(a[j], a[j - 1]);
        flag = 1;
        count++;
      }
    }
  }
  return count;
}

void swapInt(int& t1, int& t2) {
  int temp = t1;
  t1 = t2;
  t2 = temp;
}

Measured memory_bytes: 1196
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def main():
    N = int(input())
    l = make_divisors(N)
    root = math.ceil(N ** 0.5)
    # print(N)
    # print(l)
    # print(root)
    for i in l:
        if i >= root:
            print(len(str(i)))
            break


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, M: int, a: "List[int]", b: "List[int]"):
    ans = [0]*N
    for aa, bb in zip(a, b):
        ans[aa-1] += 1
        ans[bb-1] += 1
    print(*ans, sep="\n")

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [int()] * (M)  # type: "List[int]"
    b = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, M, a, b)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef std::vector<vector<int> > vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<vector<double> > vvd;
typedef vector<double> vd;

#define debugone(x) cerr << #x << " " << x << "\n"; cerr.flush();
#define debugtwo(x) cerr << #x << "-------------" << "\n";for(auto &it: x) cerr << it << " ";cerr << "\n"; cerr.flush();
#define debugthree(x_, i_, j_) cerr << #x_ << "------------" << "\n";cerr << "from " << i_ << " to " << j_ << "\n";for(ll k_=i_; k_<=j_; k_++) cerr << x_[k_] << " ";cerr << "\n"; cerr.flush();
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#define all(x) x.begin(), x.end()
#define INF 1000000009
#define MOD 1000000007

void give_suf(vll &a, vll &pre) {
	int n = a.size();
	for (int i = 1; i <= n; i++) {
		pre[i] = pre[i - 1] + a[i - 1];
	}
}

struct cmp {
	bool operator()(ll a, ll b) {
		return a > b;
	}
};

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

	ll x, y, a, b, c;
	cin >> x >> y >> a >> b >> c;
	vll p(a), q(b), r(c);
	for (int i = 0; i < a; i++) cin >> p[i];
	for (int i = 0; i < b; i++) cin >> q[i];
	for (int i = 0; i < c; i++) cin >> r[i];
	sort(all(p)); reverse(all(p));
	sort(all(q)); reverse(all(q));
	sort(all(r)); reverse(all(r));
	vll max_suf_green(c + 1, 0);
	ll sum = 0;
	priority_queue<ll, vll, cmp> Q;
	for (int i = 0; i < y; i++) {
		sum += q[i];
		Q.push(q[i]);
	}
	max_suf_green[c] = sum;
	for (int i = c - 1; i >= 0; i--) {
		ll smallest = Q.top();
		if (smallest < r[i]) {
			Q.pop();
			Q.push(r[i]);
			sum += r[i] - smallest;
		}
		max_suf_green[i] = sum;
	}
	ll best = 0;
	vll suf_red(a + 1), suf_green(b + 1), suf_less(c + 1); //1 based
	give_suf(p, suf_red);
	give_suf(q, suf_green);
	give_suf(r, suf_less);
	for (int take_red = 0; take_red <= x; take_red++) {
		ll cur = 0;
		ll make_red = x - take_red;
		if (make_red > c) continue;
		cur += suf_red[take_red] + suf_less[make_red];
		cur += max_suf_green[make_red];
		best = max(best, cur);
	}
	cout << best << "\n";
}

Measured memory_bytes: 6644
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define endl '\n'
int main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    ll dp[n];
    dp[0]=0;
    for(ll i=1;i<n;i++){
        dp[i]=1e9;
        dp[i]=min(dp[i],dp[i-1]+abs(a[i]-a[i-1]));
        if(i-2>=0)dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]));
    }
    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <cmath>
using namespace std;
long long gcd(long long a, long long b) {
	if (a < b) gcd(b, a);
	long long  r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}
long long lcm(long long a, long long b) {
	return a / gcd(a, b) * b;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

long long modinv(long long a, long long mod) {
	long long b = mod, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t*b; swap(a, b);
		u -= t*v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}
inline long long mod(long long a, long long m) {
	return (a % m + m) % m;
}

// 拡張 Euclid の互除法
// ap + bq = gcd(a, b) となる (p, q) を求め、d = gcd(a, b) をリターンします
long long extGcd(long long a, long long b, long long &p, long long &q) {
	if (b == 0) { p = 1; q = 0; return a; }
	long long d = extGcd(b, a%b, q, p);
	q -= a / b * p;
	return d;
}

// 中国剰余定理
// リターン値を (r, m) とすると解は x ≡ r (mod. m)
// 解なしの場合は (0, -1) をリターン
//amari,mod,amari,mod
pair<long long, long long> ChineseRem(long long b1, long long m1, long long b2, long long m2) {
	long long p, q;
	long long d = extGcd(m1, m2, p, q); // p is inv of m1/d (mod. m2/d)
	if ((b2 - b1) % d != 0) return make_pair(0, -1);
	long long m = m1 * (m2 / d); // lcm of (m1, m2)
	long long tmp = (b2 - b1) / d * p % (m2 / d);
	long long r = mod(b1 + m1 * tmp, m);
	return make_pair(r, m);
}
typedef pair<int, int>p;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(15);
	int n;
	cin >> n;
	double x;
	string s;
	double ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> x >> s;
		if (s == "JPY")ans += x;
		else ans += x * 380000;
	}
	cout << ans;
}


Measured memory_bytes: 256
// I am Nothing, You Are Nothing!
// Krishna is Everything ...
// Jai Shree Krishna

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 + 5, mod = 1e9 + 7;

vector<int> graph[N];
int dp[N];

int solve(int curr) {
	if (dp[curr] != -1)
		return dp[curr];
	int ans = -1;
	for (auto child : graph[curr]) {
		ans = max(ans, solve(child));
	}
	return dp[curr] = 1 + ans;
}

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

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n, m;
	cin >> n >> m;

	int u, v;
	for (int i = 0; i < m; i++) {
		cin >> u >> v;
		graph[u].push_back(v);
	}

	memset(dp, -1, sizeof dp);
	int ans = INT_MIN;

	for (int i = 1; i <= n; i++) {
		if (dp[i] == -1) {
			ans = max(ans, solve(i));
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 11852
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
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;}

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ　ceil(a)
// コンパイル　g++ -std=c++17 a.cpp


int main() {
    ll n;
    cin >> n;
    set<int> st;
    rep(i,n){
        ll tmp;
        cin >> tmp;
        st.insert(tmp);
    }

    cout << st.size() << endl; 

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		long n = scanner.nextLong();
		int max = (int) Math.sqrt(n);
		for (int i = max; true; i--) {
			if (n % i == 0) {
				System.out.println(n / i + i - 2);
				return;
			}
		}
	}
}

Measured memory_bytes: 23764
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


sys.setrecursionlimit(1000000)
MOD = int(1e09) + 7
INF = int(1e30)


def main():
    # sys.stdin = open("Sample.txt")
    N = Scanner.int()
    A = [[-1 for _ in range(N)]for _ in range(N)]
    for i in range(N):
        a = Scanner.int()
        for _ in range(a):
            x, y = Scanner.map_int()
            x -= 1
            A[i][x] = y
    ans = 0
    for i in range(1 << N):
        v = [0] * N
        for j in range(N):
            v[j] = (i >> j) & 1
        isOK = True
        for j in range(N):
            for k in range(N):
                if v[k] == 0:
                    continue
                if A[k][j] == -1:
                    continue
                if A[k][j] != v[j]:
                    isOK = False
        if isOK:
            ans = max(ans, v.count(1))
    print(ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 42472
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>



int main(){
	long double L;
	cin >> L;
	cout << fixed << setprecision(6) << L*L*L/27;

}


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

int main()
{
  int a; cin >> a;
  int b; cin >> b;
  rep(i, 10001) {
    int aa = (int)(1.08*i-i);
    int bb = (int)(1.10*i-i);
    if (aa == a && bb == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)

readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

isLegal n a b =
  if n == 1
  then a == b
  else a <= b

main = do
  [n, a, b] <- readInts
  if isLegal n a b 
    then print $ (n - 2) * (b - a) + 1
    else print 0


Measured memory_bytes: 380
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define all(x) (x).begin(), (x).end() 

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

long long INF=numeric_limits<long long>::max();

ld x[11][11];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
    int n,d; cin >> n >> d;
    int ans = 0;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < d; j++){
			cin >> x[i][j];
		}
	}
	for(int i = 0; i < n; i++){
		for(int j = i+1; j < n; j++){
			int curr = 0;
			for(int k = 0; k < d; k++){
				int cur = x[i][k]-x[j][k];
				cur *= cur;
				curr += cur;
			}
			ld c = sqrt(curr);
			int cc = sqrt(curr);
			if(c-cc==0)ans++;
		}
	}
	cout << ans << endl;
}


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

using namespace std;
long long MOD=1000000007;
long long MOD2=998244353;


int main(){
  int N; cin>>N;
  int ans=0;
  for(int i=0;i<N;i++){
    int A; cin>>A;
    if(A==ans+1) ans++;
  }
  if(ans==0) cout<<-1;
  else cout<<N-ans;
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>

using namespace std;

int n, k;
int h[100005];
int dp[100005];

int main(void)
{
	cin >> n >> k;
	for(int i = 1; i <= n; i++) cin >> h[i];
	
	for(int i = 1; i <= n; i++) dp[i] = 1e9+5;
	dp[1] = 0;
	for(int i = 1; i < n; i++){
		for(int j = 1; j <= k; j++){
			if(i+j <= n) dp[i+j] = min(dp[i+j], dp[i] + abs(h[i]-h[i+j]));
		}
	}
	cout << dp[n] << endl;
	
	return 0;
}

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


Measured memory_bytes: 2516
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): { N: number, v: number[] } => {
  const N = +lines[0]
  const v = lines[1].split(' ').map(line => +line)
  const obj = { N, v }
  debug(obj)
  return obj
}
// solver
export const solve = (lines: string[]): string => {
  const { N, v } = parseLines(lines)
  v.sort((a, b) => a - b)
  const first = v.shift() || 0
  const result = v.reduce((prev, current) => (prev + current) / 2, first)
  return `${result}`
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}


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

#define int long long

using namespace std;

const int N = 305;
int dp[N][N], pref[N][N], C[N][N], n, k, m;

signed main(){
    scanf("%lld %lld %lld", &n, &k, &m);

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= i; j++) {
            if (i == 0 || j == 0 || i == j) C[i][j] = 1;
            else C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % m;
        }
    }

    memset(dp, 0, sizeof(dp));

    for (int i = 1; i <= k + 1; i++) {
        dp[1][i] = 1;
        if (i == 1) pref[1][i] = dp[1][i];
        else pref[1][i] = (pref[1][i - 1] + dp[1][i]) % m;
    }

    for (int i = 2; i <= n + 1; i++) {
        for (int j = 1; j <= k + 1; j++) {
            for (int p = 1; p <= i - 1; p++) {
                int res = C[i - 2][p - 1];
                res *= dp[p][j]; res %= m;
                res *= pref[i - p][j - 1]; res %= m;

                dp[i][j] = (dp[i][j] + res) % m;
            }

            if (j == 1) pref[i][j] = dp[i][j];
            else pref[i][j] = (pref[i][j - 1] + dp[i][j]) % m;
        }
    }

    printf("%lld", dp[n + 1][k + 1]);
    return 0;
}


Measured memory_bytes: 2432
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    let w = std::io::BufWriter::new(out.lock());
    f(w);
}

#[allow(unused_macros)]
macro_rules! debug {
    ($var:expr) => {
        match &$var { v => eprintln!(concat!(stringify!($var), "={:?}"), v) }
    };
    ($var:expr, $($vars:expr),*) => {
        match &$var { v => eprint!(concat!(stringify!($var), "={:?} "), v) }
        debug!($($vars),*);
    };
}

fn main() {
    let n: usize = input();
    let m: usize = input();
    let a: Vec<usize> = (0..m).map(|_| input()).collect();
    const INF: i32 = 1001001001;

    let nums = [10, 2, 5, 5, 4, 5, 6, 3, 7, 6];
    let mut dp = vec![-INF; n + 1];
    dp[0] = 0;
    for i in 1..n + 1 {
        for &a in &a {
            if nums[a] <= i {
                dp[i] = std::cmp::max(dp[i], dp[i - nums[a]] + 1);
            }
        }
    }
    let mx = dp[n] as usize;

    let mut rem = n;
    let mut ans = vec![0; mx];
    for i in 0..mx {
        for &a in &a {
            if rem >= nums[a] && dp[rem - nums[a]] == dp[rem] - 1 {
                ans[i] = std::cmp::max(ans[i], a);
            }
        }
        rem -= nums[ans[i]];
    }
    ans.sort_by_key(|&a| -(a as i32));

    with_stdout_lock(|mut w| {
        for a in ans {
            write!(w, "{}", a).unwrap();
        }
        writeln!(w, "").unwrap();
    });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}

int main() {
    long long n;
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '+') {
            ans++;
        } else {
            ans--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

typedef long long int ll;



int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k % 2 == 0) {
        cout << a-b << endl;
    }
    else {
        cout << b-a << endl;
    }
}


Measured memory_bytes: 256
n=int(input())

list=[i for i in range(1,n+1)]
#print(list)

c_list=[]
for i in range(n):
    count=0
    num=list[i]
    while True:
        if num%2==0:
            num//=2
            count+=1
        else:
            break
    c_list.append(count)
    
print(list[c_list.index(max(c_list))])
    


Measured memory_bytes: 9168
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//幅優先探索のテンプレ.デフォルトではstartからの距離を返す.
//graphは隣接リスト.startは探索開始地点
vector<int> bfs(vector<vector<int>> &graph, int start){
	queue<int> todo;
	vector<int> dist(graph.size(),-1);
	dist[start] = 0;
	todo.push(start);
	while(!todo.empty()){
		int now = todo.front();
		todo.pop();
		for (int i=0;i<graph[now].size();i++){
			int nxt = graph[now][i];
			if (dist[nxt] != -1) continue;
			dist[nxt] = dist[now] + 1;
			todo.push(nxt);
		}
	}
	return dist;
}

int dif(vector<string> s,vector<string> t){
	int n = s.size();
	int res = 0;
	rep(i, n)
	{
		rep(j,n){
			if(s[i][j] != t[i][j])
				res++;
		}
	}
	return res;
}

vector<string> r(vector<string> s){
	int n = s.size();
	vector<string> temp(n, string(n, '0'));
	rep(i, n)
	{
		rep(j,n){
			temp[j][n - i - 1] = s[i][j];
		}
	}
	return temp;
}
vector<string> l(vector<string> s){
	int n = s.size();
	vector<string> temp(n, string(n, '0'));
	rep(i, n)
	{
		rep(j,n){
			temp[n-j-1][i] = s[i][j];
		}
	}
	return temp;
}

int main(){
	int n;
	cin >> n;
	vector<int> a(n), b(n), c(n - 1);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n - 1) cin >> c[i];
	int ans = 0;
	rep(i, n)
	{
		ans += b[a[i] - 1];
		if(i){
			if(a[i-1] + 1 == a[i]){
				ans += c[a[i - 1] - 1];
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int n,m,deg[N];
int main()
{
scanf("%d%d",&n,&m);
for (int i=1;i<=m;i++){
int u,v;
scanf("%d%d",&u,&v);
deg[v]++;deg[u]++;
}
for (int i=1;i<=n;i++)
if (deg[i]&1) return puts("NO"),0;
puts("YES");
return 0;
}

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

int main(){
    int A,B,C,X,ans=0;
    cin >> A >> B >> C >> X;
    for(int i=0;i<A+1;i++){
        for(int j=0;j<B+1;j++){
            for(int k=0;k<C+1;k++){
                if(i*500+j*100+k*50==X){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
program prob3
    implicit none
    character(len=1), dimension(:, :), allocatable :: S
    integer :: H, W, i, j, k, tmp, x, y
    integer, dimension(8) :: dx, dy
    dx = (/1, 1, 1, 0, 0,-1,-1,-1/)
    dy = (/1, 0,-1, 1,-1, 1, 0,-1/)
    
    read(*,*) H, W
    allocate(S(H, W))
    do i = 1, H
        do j = 1, W
            read(*,'(a)',advance='no') S(i, j)
        end do
        read(*,*) 
    end do

    do i = 1, H
        do j = 1, W
            if(S(i, j) == '.') then
                tmp = 0

                do k = 1, 8
                    y = i + dy(k)
                    x = j + dx(k)
                    if(y > H .or. y < 1) then
                        cycle
                    end if
                    if(x > W .or. x < 1) then
                        cycle
                    end if

                    if(S(y, x) == '#')then
                        tmp = tmp + 1
                    end if

                end do
                S(i, j) = char(ichar('0') + tmp)
            end if
        end do
    end do
    
    do i = 1, H
        write(*,*) S(i, :)
    end do

    stop
contains
end program prob3

Measured memory_bytes: 2832
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);


int main() {
  int n,k;
  cin >> n >> k;
  
  repo(i,1000)
  if(i-1<=log(n)/log(k) && log(n)/log(k)<i) {
  cout << i << endl;
  return 0;
  }
}


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

using namespace std;
using ll = long long;
using ld = long double;

const ll INF = 1e18;
int main () {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	ll sol = -INF;

	sol = max (sol, a * 1LL * c);
	sol = max (sol, b * 1LL * d);
	sol = max (sol, b * 1LL * c);
	sol = max (sol, a * 1LL * d);

	cout << sol << '\n';
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N,K,X,Y,A,B;
    cin >> N >> K >> X >> Y;
    A = N - K;
   if (N>=K){
       B = K * X + A * Y;
   }
   else if (N<K){
       B = N * X;
   }
    cout << B << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j]
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
const int MAX = 100100;
const int MOD = 1000000007;

ll fac[MAX],finv[MAX],inv[MAX];
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i % MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i) % MOD;
        finv[i]=finv[i-1]*inv[i] % MOD;
    }
}
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;
}

int main(){
    int n,k; cin >> n >> k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    COMinit();
    ll ans=0;
    rep(i,n){
        ans+=(COM(i,k-1)*a[i])%MOD;
        ans%=MOD;
        ans-=(COM(n-i-1,k-1)*a[i])%MOD;
        ans%=MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3072
n = int(input())
a = list(map(int,input().split()))
m = max(a)
flag = [True]*(m+1)
c = [0]*(m+1)
b = list(sorted(a))
for i in b:
    x = i + i
    while x <= m:
        flag[x] = False
        x += i
    c[i] += 1
ans = 0
x = 0
l = []
ans = 0
for i in a:
    if flag[i] and c[i] <= 1:
        ans += 1
print(ans)

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

typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    int num = x/100;
    int m = num * 100;
    int diff = x - m;
    while (diff >= 0 && num >= 0) {
        if (diff == 0) {
            cout << 1 << endl;
            return 0;
        }
        if (diff >= 5) {
            diff -= 5;
            num--;
        } else if (diff >= 4) {
            diff -= 4;
            num--;
        } else if (diff >= 3) {
            diff -= 3;
            num--;
        } else if (diff >= 2) {
            diff -= 2;
            num--;
        } else if (diff >= 1) {
            diff -= 1;
            num--;
        }
    }
    cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 256
fn main(){
	fn f(n: Vec<i32>) -> bool {
		n[0] < n[1] && n[1] < n[2] 
	}
    
    println!("{}", if f(read_vec::<i32>()) { "Yes" } else { "No" } );
}
  
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


Measured memory_bytes: 5028