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

int main(void)
{
	int m, d;
	
	while (scanf("%d %d", &m, &d), m != 0 || d != 0){
		if (m == 1 || m == 4 || m == 7){
			if (d % 7 == 0){
				printf("Wednesday\n");
			}
			else if (d % 7 == 1){
				printf("Thursday\n");
			}
			else if (d % 7 == 2){
				printf("Friday\n");
			}
			else if (d % 7 == 3){
				printf("Saturday\n");
			}
			else if (d % 7 == 4){
				printf("Sunday\n");
			}
			else if (d % 7 == 5){
				printf("Monday\n");
			}
			else if (d % 7 == 6){
				printf("Tuesday\n");
			}
		}
		else if (m == 2 || m == 8){
			if (d % 7 == 0){
				printf("Saturday\n");
			}
			else if (d % 7 == 1){
				printf("Sunday\n");
			}
			else if (d % 7 == 2){
				printf("Monday\n");
			}
			else if (d % 7 == 3){
				printf("Tuesday\n");
			}
			else if (d % 7 == 4){
				printf("Wednesday\n");
			}
			else if (d % 7 == 5){
				printf("Thursday\n");
			}
			else if (d % 7 == 6){
				printf("Friday\n");
			}
		}
		else if (m == 3 || m == 11){
			if (d % 7 == 0){
				printf("Sunday\n");
			}
			else if (d % 7 == 1){
				printf("Monday\n");
			}
			else if (d % 7 == 2){
				printf("Tuesday\n");
			}
			else if (d % 7 == 3){
				printf("Wednesday\n");
			}
			else if (d % 7 == 4){
				printf("Thursday\n");
			}
			else if (d % 7 == 5){
				printf("Friday\n");
			}
			else if (d % 7 == 6){
				printf("Saturday\n");
			}
		}
		else if (m == 9 || m == 12){
			if (d % 7 == 0){
				printf("Tuesday\n");
			}
			else if (d % 7 == 1){
				printf("Wednesday\n");
			}
			else if (d % 7 == 2){
				printf("Thursday\n");
			}
			else if (d % 7 == 3){
				printf("Friday\n");
			}
			else if (d % 7 == 4){
				printf("Saturday\n");
			}
			else if (d % 7 == 5){
				printf("Sunday\n");
			}
			else if (d % 7 == 6){
				printf("Monday\n");
			}
		}
		else if (m == 5){
			if (d % 7 == 0){
				printf("Friday\n");
			}
			else if (d % 7 == 1){
				printf("Saturday\n");
			}
			else if (d % 7 == 2){
				printf("Sunday\n");
			}
			else if (d % 7 == 3){
				printf("Monday\n");
			}
			else if (d % 7 == 4){
				printf("Tuesday\n");
			}
			else if (d % 7 == 5){
				printf("Wednesday\n");
			}
			else if (d % 7 == 6){
				printf("Thursday\n");
			}
		}
		else if (m == 6){
			if (d % 7 == 0){
				printf("Monday\n");
			}
			else if (d % 7 == 1){
				printf("Tuesday\n");
			}
			else if (d % 7 == 2){
				printf("Wednesday\n");
			}
			else if (d % 7 == 3){
				printf("Thursday\n");
			}
			else if (d % 7 == 4){
				printf("Friday\n");
			}
			else if (d % 7 == 5){
				printf("Saturday\n");
			}
			else if (d % 7 == 6){
				printf("Sunday\n");
			}
		}
		else if (m == 10){
			if (d % 7 == 0){
				printf("Thursday\n");
			}
			else if (d % 7 == 1){
				printf("Friday\n");
			}
			else if (d % 7 == 2){
				printf("Saturday\n");
			}
			else if (d % 7 == 3){
				printf("Sunday\n");
			}
			else if (d % 7 == 4){
				printf("Monday\n");
			}
			else if (d % 7 == 5){
				printf("Tuesday\n");
			}
			else if (d % 7 == 6){
				printf("Wednesday\n");
			}
		}
	}
	return (0);
}

Measured memory_bytes: 584
import java.util.Scanner;

public class Main {


		public static void main(String args[])
		{
			Scanner scan=new Scanner(System.in);
			int n=scan.nextInt();
			int k=scan.nextInt();
			double ans=0;
			for(int i=1;i<=n;i++)
			{
			int t=i;
			double l=1.0/n;
			while(t<k)
			{
				t*=2;
				l/=2;
			}
			ans+=l;
				
			}
			System.out.printf("%.15f",ans);
			
		}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  int n,m,x;
  cin >> n >> m >>x;
  int a[110];
  int cr=0,cl=0;
  
  for(int i=0; i<m; i++){
    cin >> a[i];
    if(a[i]>x) cr++;
    else cl++;
  }
  
  cout << min(cr,cl) << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <list>
#include <stack>
#include <set>
#include <cctype>
#include <cmath>

using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;

#define ll long long
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)


int main() {

	int N;
	cin >> N;
	vector<int> b(N), ans(N);
	for (int i = 0; i<N; i++) cin >> b[i];
	while (b.size() > 0) {
		int er = -1;
		for (int i = 0; i < b.size(); i++) {
			if (b[i] == i + 1)  er = i;
		}
		if (er != -1) {
			ans[b.size() - 1] = b[er];
			b.erase(b.begin() + er);
		}
		else {
			break;
		}
	}

	if (b.size() > 0) {
		cout << -1 << endl;
	}
	else {
		for (int i = 0; i<N; i++) cout << ans[i] << endl;
	}
	

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N;
ll A[100009], csum[100009];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N;
    rep(i,N) cin>>A[i];
    
    sort(A,A+N);
    rep(i,N){
        if(i) csum[i]+=csum[i-1]+A[i];
        else csum[i]=A[i];
    }
    
    int st=0;
    rep(i,N){
        if(csum[i]*2<A[i+1]) st=i+1;
    }
    
    cout1(N-st);
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main(void){
  int H, W;
  cin >> H >> W;
  int total = H * W;
  vector<vector<int> > A(H+2, vector<int>(W+2, -1));
  queue<pair<int, int> > q;
  H++;
  W++;
  for(int h = 1; h < H; ++h){
    for(int w = 1; w < W; ++w){
      char a;
      cin >> a;
      if(a == '#'){
        A[h][w] = 0;
        pair<int, int> tmp = make_pair(h, w);
        q.push(tmp);
        --total;
      }
    }
  }
  int count = 1;
  while(q.size() != 0){
    pair<int, int> tmp = q.front();
    q.pop();
    int h = tmp.first;
    int w = tmp.second;
    if(A[h-1][w]==-1) {
      A[h-1][w] = A[h][w] + 1;
      if(h!=1){
        pair<int, int> hoge = make_pair(h-1, w);
        q.push(hoge);
      }
    }
    if(A[h][w-1]==-1) {
      A[h][w - 1] = A[h][w] + 1;
      if(w!=1){
        pair<int, int> hoge = make_pair(h, w-1);
        q.push(hoge);
      }
    }
    if(A[h+1][w]==-1) { 
      A[h+1][w] = A[h][w] + 1;
      if(h!=H-1){
        pair<int, int> hoge = make_pair(h+1, w);
        q.push(hoge);
      } 
    }
    if(A[h][w+1]==-1) { 
      A[h][w + 1] = A[h][w] + 1;
      if(w!=W-1){
        pair<int, int> hoge = make_pair(h, w+1);
        q.push(hoge);
      }
    }
    count = A[h][w];
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 12432
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int T[12]={31,29,31,30,31,30,31,31,30,31,30,31};
	string S[7]={"Thursday","Friday","Saturday","Sunday","Monday","Tuesday","Wednesday"};
	while(true){
		int M=in(),D=in();
		if(M==0) break;
		int H=0;
		REP(i,M-1){
			H += T[i];
		}
		H+=D-1;
		H%=7;
		out(S[H]);
	}
	return 0;
}


Measured memory_bytes: 3148
import java.util.*;
 
public class Main
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    char[] c=sc.next().toCharArray();
    int sum=0;
    for(int i=0;i<4;i++)
    {
      if(c[i]=='+')
      {
        sum++;
      }
      else
      {
        sum--;
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 22868
#include <iostream>
#include <functional>
#include <vector>
#include <algorithm>

int main()
{
    int n, k;
    std::cin >> n >> k;

    std::vector<int> p(n);
    for (int i = 0; i < n; i++) {
        std::cin >> p[i];
    }

    std::sort(p.begin(), p.end());

    int ans = 0;
    for (int g = 0; g < k;g++) {
        ans = ans + p[g];
    }

    std::cout << ans;
}

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

int main() {
    string a;
    cin >> a;
    bool ans = false;
    rep(i,a.size()-1){
        if(a.substr(i,1)!=a.substr(i+1,1)){
            ans = true;
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T> ostream& operator << (ostream& os, const set<T>& s) { for (auto e : s) os << e; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { (a += b % mod) %= mod; if (a < 0) a += mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12); // debuged
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int n;
  cin >> n;
  rep3(i, 1, 10) rep3(j, 1, 10) {
    if (i * j == n) {
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store")  
#pragma GCC optimize ("-fno-defer-pop")
#define all(a) a.begin(),a.end()
#define bs binary_search
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m); t=(t*t)%m; if(b&1)t=(t*a)%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ipr pair<ll,ll>
#define ps push_back
#define fs first
#define sc second
#define mkp make_pair
#define mod 1000000007
ll tr[100001];
ll size[100001];
void initt(ll n){
	ll i;
	for(i=0;i<=n;i++){
		tr[i]=i;
		size[i]=1;
	}
}
ll root(ll a){
	while(a!=tr[a]){
		a=root(tr[a]);
	}
	return a;
}
void dunion(ll a,ll b){
	ll an=0;
	ll root_a=root(a);
	ll root_b=root(b);
	//if(a==1&&b==4) cout<<"# "<<root_a<<" "<<root_b<<" "<<size[root_a]<<" "<<size[root_b]<<endl;
	if(size[root_a]<=size[root_b]){
		tr[root_a]=root_b;
		size[root_b]+=size[root_a];
	}
	else {
		tr[root_b]=root_a;
		size[root_a]+=size[root_b];
	}
	//if(a==1&&b==4) cout<<"# "<<root_a<<" "<<root_b<<" "<<size[root_a]<<" "<<size[root_b]<<endl;
}
bool find(ll a,ll b){
	if(root(a)==root(b)){
		return true;
	}
	else return false;
}
int main(){

  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  
  ll i,j,k,l,n,m;
  cin>>n>>m;
  
  initt(n);
  ll ar[m][2];
  for(i=0;i<m;i++){
  	cin>>ar[i][0]>>ar[i][1];
  }
  vector<ll> an;
  //cout<<n<<endl;
  //an.ps((n*(n-1)));
  l=(n*(n-1));
  an.ps(l); 
  for(i=m-1;i>0;i--){
  	  ll x=root(ar[i][0]),y=root(ar[i][1]);
  	  if(x!=y){
  	  	ll g=size[x],h=size[y];
	  	dunion(ar[i][0],ar[i][1]);
	  	ll f;
	  	if(g>h){
	  		f=size[root(ar[i][0])];
	  	}
	  	else f=size[root(ar[i][1])];
	  	l=l-(g*(n-g))-(h*(n-h))+(f*(n-f));
	  	//cout<<i<<" "<<x<<" "<<y<<" "<<g<<" "<<h<<" "<<f<<" "<<l<<endl;
  	  	an.ps(l);
  	  }
  	  else an.ps(max((ll)0,l));
  }
  
  reverse(all(an));
  for(i=0;i<m;i++){
  	an[i]=an[i]/2;
  	cout<<(an[i])<<endl;
  }
  return 0;
}

Measured memory_bytes: 5364
#include<bits/stdc++.h>
using namespace std;
int main ( ) {
  int a,b;
  cin >> a;
  cin>> b;

  //cout << a << b << endl;
  int ans;
  ans = 0;
  ans = a - 2*b;
  if(ans < 0){
    ans = 0;
  }
  cout << ans << endl;
}


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

int main()
{
	int cnt0 = 0, cnt1 = 0;
	int ans = 0;
	string S;

	cin >> S;

	for ( size_t i = 0; i < S.size(); i++ ) {
		if ( S[i] == '1' ) {
			if ( cnt0 == 0 ) {
				cnt1++;
			} else {
				cnt0--;
				ans += 2;
			}
		} else {
			if ( cnt1 == 0 ) {
				cnt0++;
			} else {
				cnt1--;
				ans += 2;
			}
		}
	}
	
	cout << ans << endl;

	return ( 0 );
}


Measured memory_bytes: 512
#fin=open('in','r')
#input=lambda:fin.readline().strip()

p=int(input())
fact=[0]*p
inv=[0]*p
def f(x,m=p-2):
	ans=1
	while m:
		if m&1:ans=ans*x%p
		x=x*x%p
		m>>=1
	return ans
fact[0]=inv[0]=1
for i in range(1,p):
	fact[i]=fact[i-1]*i%p
	inv[i]=inv[i-1]*f(i)%p
r=list(map(int,input().split()))
c=[i for i in range(p) if r[i] == 1]
#sum of -((x-j)^(p-1)-1)
# (-j + x)^(p-1) = sum((-j)^i * x^(p-1-i) * binom(p-1,i))
coeff=[0]*p
for j in c:
	for i in range(p-1,-1,-1):
		if i&1:coeff[p-1-i]+=fact[p-1]*inv[i]*inv[p-1-i]*f(j,i)%p
		else:coeff[p-1-i]-=fact[p-1]*inv[i]*inv[p-1-i]*f(j,i)%p
	coeff[0]+=1
coeff=[(t%p+p)%p for t in coeff]
print(*coeff)

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

int main()
{
	int n;
	cin >> n;
	long long a = 0;
	vector<vector<long long>> v(n, vector<long long>(3));
	vector<int> b(n);
	for (int i = 0; i < n; i++) {
		cin >> v[i][0] >> v[i][1] >> v[i][2];
		b[i] = v[i][2];
	}
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			bool f = true;
			int r;
			for (int p = 0; p < n; p++) {
				if (b[p] != 0) {
					r = p;
					break;
				}
			}
			long long h = v[r][2] + abs(i - v[r][0]) + abs(j - v[r][1]);
			for (int k = 0; k < n; k++) {
				if (v[k][2] != max(h - abs(i - v[k][0]) - abs(j - v[k][1]), a)) {
					f = false;
					break;
				}
			}
			if (f) {
				cout << i << " " << j << " " << h << endl;
			}
		}
	}
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
#include <numeric>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double PI = 3.14159265359;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };




signed main() {
	int n;
	vector<int>list;

	cin >> n;

	int ki, cnt = 1, maxn = 0;

	for (int i = 0; i < n; i++) {
		int num;
		cin >> num;
		if (i == 0) {
			ki = num;
			maxn = ki;
		}
		else {
			if (num >= ki && num >= maxn) {
				cnt++;
				maxn = max(num, maxn);
			}
		}
	}

	cout << cnt << endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  
  for (int i = M/N; i >= 1; i--) {
    if (M % i == 0){
      cout << i << endl;
      return 0;
    }
  }
}
    

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

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> II;
typedef vector<II> VII;

#define REP(x, n) for (int x = 0; x < (n); ++x)
#define INF (1e9 + 1)
#define EPS 1e-9
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main() {
    /*
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    */
    int a;
    string s;
    cin >> a >> s;
    if (a >= 3200) {
        cout << s << '\n';
    }
    else {
        cout << "red\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;

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

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


const int MAX = 2 * 1e5;
vector<int> g[MAX];
int N;

vector<int> calc(int node) {
    vector<int> d(N, -1);
    d[node] = 0;

    queue<int> q;
    q.push(node);
    while ( !q.empty() ) {
        int x = q.front();
        q.pop();
        for ( int y: g[x] ) {
            if ( d[y] == -1 ) {
                d[y] = d[x] + 1;
                q.push(y);
            }
        }
    }
    return d;
}


int main() {

    int INF = 1e9;
    cin >> N;


    for (int i = 0; i < N-1; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<int> d(N);
    d = calc(0);
    int m = distance( d.begin(), max_element(d.begin(), d.end()) );
    d = calc(m);

    int dist = *max_element(d.begin(), d.end());

    string ans = "First";
    if ( dist % 3 == 1 ) {
        ans = "Second";
    }

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

Measured memory_bytes: 14324
#include <bits/stdc++.h> 
using namespace std; 
#define N 100 

int n =2, m; 

int a[N][N]; 
vector<vector<int> > dp(N, vector<int>(N)), 
	visited(N, vector<int>(N)); 
int current_sum = 0; 
int total_sum = 0; 

void inputMatrix() 
{ 
	cin>>m;
  for(int i = 0 ; i < n ; i++)
      for(int j = 0 ; j < m ; j++)
           cin>>a[i][j];

} 

int maximum_sum_path(int i, int j) 
{ 
	if (i == n - 1 && j == m - 1) 
		return a[i][j]; 
	if (visited[i][j]) 
		return dp[i][j]; 
	visited[i][j] = 1; 
	int& total_sum = dp[i][j]; 
	if (i < n - 1 & j < m - 1) { 
		int current_sum = max(maximum_sum_path(i, j + 1), 
								maximum_sum_path(i + 1, j)); 
		total_sum = a[i][j] + current_sum; 
	} 
	else if (i == n - 1) 
		total_sum = a[i][j] 
					+ maximum_sum_path(i, j + 1); 

	else
		total_sum = a[i][j] 
					+ maximum_sum_path(i + 1, j); 
	return total_sum; 
} 
int main() 
{ 
	inputMatrix(); 
	int maximum_sum = maximum_sum_path(0, 0); 

	cout << maximum_sum; 
	return 0; 
} 


Measured memory_bytes: 384
/*
本番ではACできなかった.
この問題は言い換えると数列を出来るだけ少ないLISに
分割するという問題となる.
解説では最終的な答えが結局は数列における
広義単調減少列の長さになるとあるので
その通り実装したらACできた.
自分がずっと考えていたことで, 
もし同じ色として塗ることができるものがこれまでに
存在する場合は新しく色を作るよりぬれるものと
同じ色で塗るのが最適らしい.（わからん）
他の人の解法を見てみると普通に前から
LISを作っていって, もし追加できるLISの候補が
複数あったらその中で最大のものに追加するという
貪欲な方法で良いらしい.（わからん）
多くの人が行なっていた後者の貪欲法だが,
ここでは各色で塗られている最大値を保持し, かつ
高速に取り出せる必要があるためmultisetを使用していた.
multisetはsetとは異なり複数要素を管理できるため
同じ要素を管理しなければならない場面でも使用できる.
multisetはlower_boundを使用できるため,
自身以上の値を対数時間で参照することができる.
注意点として, multisetのメンバ関数にあるlower_boundを
使用しないと計算量が線形になるのでmultisetの
メンバ関数を使用する.
*/
#include<iostream>
#include<set>
using namespace std;

const int MAX_N = 1e5 + 1;
const int INF = 1 << 30;

int A[MAX_N];
int dp[MAX_N];

/* 
// 解説にあるLDSで求める解法
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];
    for (int i = 0; i < N; ++i) dp[i] = -INF;
    for (int i = 0; i < N; ++i) {
        int l = -1, r = N - 1;
        while (r - l > 1) {
            int mid = (l + r) / 2;
            if (dp[mid] < A[i]) r = mid;
            else l = mid;
        }
        dp[r] = A[i];
    }
    for (int i = N - 1; i >= 0; --i) {
        if (dp[i] == -INF) continue;
        cout << i + 1 << endl;
        return 0;
    }
    return 0;
}
*/

// multisetを用いて貪欲に見つける方法
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];
    multiset<int> S;
    for (int i = 0; i < N; i++) {
        auto itr = S.lower_bound(A[i]);
        if (itr != S.begin()) S.erase(--itr);
        S.insert(A[i]);
    }
    cout << S.size() << endl;
    return 0;
}

Measured memory_bytes: 5376
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

constexpr static ll MOD = 1000000007ll;
constexpr static int INF = 1 << 28; // for x <= 10^9
constexpr static ll INFL = 1ll << 60; // for x <= 10^19
constexpr static double EPS = 1e-10;

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

    unordered_map<string, ll> numsMap;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        numsMap[s]++;
    }

    ll ans = 0;
    for (const auto& value : numsMap) {
        ans += (value.second * (value.second - 1)) / 2;
    }

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


Measured memory_bytes: 7328
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;

void solve();

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

void solve(){
    ll n;cin>>n;
    vl a(n);rep(i,n)cin>>a[i];
    sort(all(a));

    ll ot=a[n-1];
    rep(i,n-1){
        if(a[i]==a[n-1])continue;
        if(min(a[n-1]-a[i],a[i])>=min(a[n-1]-ot,ot))ot=a[i];
    }

    cout<<a[n-1]<<' '<<ot<<endl;
}

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

public class Solution
{
    public static long GCD(long m, long n)
    {
        if (m < n)
        {
            return GCD(n, m);
        }

        while (n != 0)
        {
            var t = n;
            n = m % n;
            m = t;
        }
        return m;
    }

    public static long LCM(long m, long n)
    {
        return m * n / (GCD(m, n));
    }

    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var a = vals[0];
        var b = vals[1];

        Console.WriteLine(LCM(a,b));
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = (ll)(1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int mp[300][300];
int h, w;
ll calc() {
	ll res = 0;
	int cnt[600][301] = {};
	rep(s, h+w) {
		rep(x, h) {
			int y = s - x;
			int num = 0;
			if (0 <= y && y < w&&mp[x][y])num = 1;
			cnt[s][x + 1] = cnt[s][x] + num;
			//cout << cnt[s][x + 1] << endl;
		}
	}
	rep(s, h + w) {
		rep(x1, h) {
			int y1 = s - x1;
			if (y1 < 0 || y1 >= w || !mp[x1][y1])continue;
			Rep(x2, x1 + 1, h) {
				int y2 = s - x2;
				if (y2 < 0 || y2 >= w || !mp[x2][y2])continue;
				int dif = (x2 - x1) * 2;
				int nes = s - dif;
				if (nes >= 0) {
					int sta = max(0, x2 - dif + 1);
					int las = x1;
					res += 2 * (cnt[nes][las] - cnt[nes][sta]);
					if (0 <= x2 - dif && mp[x2 - dif][y2])res++;
					if (0 <= y1 - dif && mp[x1][y1 - dif])res++;
				}
				nes = s + dif;
				if (nes < h+w) {
					int sta = x2 + 1;
					int las = min(x1 + dif, h);
					res += 2 * (cnt[nes][las] - cnt[nes][sta]);
					if (h > x1 + dif && mp[x1 + dif][y1])res++;
					if (w > y2 + dif && mp[x2][y2 + dif])res++;
				}
			}
		}
	}
	return res;
}
int main() {
	cin >> h >> w;
	rep(i, h) {
		rep(j, w) {
			char t; cin >> t;
			if (t == '#')mp[i][j] = 1;
			else mp[i][j] = 0;
		}
	}
	ll out = calc();
	int cop[300][300];
	rep(i, w) {
		rep(j, h) {
			cop[i][j] = mp[j][w - 1 - i];
		}
	}
	swap(h, w);
	rep(i, h) {
		rep(j, w) {
			mp[i][j] = cop[i][j];
			//cout << mp[i][j];
		}
		//cout << endl;
	}
	//cout << out << endl;
	out += calc();
	//cout << out << endl;
	cout << out / 2 << endl;
	return 0;
}


Measured memory_bytes: 1664
from heapq import heappop,heappush 
from collections import deque
k=int(input())
inf=float("inf")
data=[[] for i in range(k)]
for i in range(1,k):
    if i%10==9:
        data[i]=[[i*10%k,0]]
    else:
        data[i]=[[i*10%k,0],[(i+1)%k,1]]

que=deque([[1,1]])
ans=[inf]*k
while que:
    c,u=que.popleft()
    ans[u]=c
    for v,d in data[u]:
        if ans[v]==inf:
            if d==0:
                que.appendleft([c,v])
            else:
                que.append([c+1,v])
    if ans[0]!=inf:
        break
print(ans[0])

Measured memory_bytes: 94112
package main

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

func main(){
	var n int
	fmt.Scan(&n)
	sc := bufio.NewScanner(os.Stdin)
	dic := make(map[string]bool, n)
	for i:=0; i<n; i++{
		sc.Scan()
		arr := strings.Split(sc.Text(), " ")
		is_find := false
		switch arr[0]{
		case "insert":
			dic[arr[1]] = true
		case "find":
			is_find = dic[arr[1]]
			if is_find{
				fmt.Println("yes")
			} else {
				fmt.Println("no")
			}
		}
	}
}


Measured memory_bytes: 75040
N = int(input())
S = []
for i in range(N) :
    s = input()
    S.append(s)
M = int(input())
T = []
for j in range(M) :
    t = input()
    T.append(t)
candidate = []
for k in range(len(S)) :
    counter1 = S.count(S[k])
    counter2 = T.count(S[k])
    counter = counter1 - counter2
    candidate.append(counter)
print(max(max(candidate),0))



Measured memory_bytes: 3064
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
typedef long long LL;

int main() {
  std::string s; std::cin >> s;
  int cnt = 0;
  for (int i = 1; i < s.length(); ++i) {
    if (s[i-1] == s[i]) {
      ++cnt;
      if (s[i] == '0') s[i] = '1';
      else             s[i] = '0';
    }
  }

  std::cout << cnt << std::endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;



int main(){
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  int ans;
  if(n <= k) ans = n*x;
  else ans = k * x + (n - k) * y;

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


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> houses(N);
    for(int i = 0;i<N;i++){
        cin >> houses.at(i);
    }

    sort(houses.begin(),houses.end());
    reverse(houses.begin(),houses.end());

    cout << houses.at(0) - houses.at(N-1) << endl;
}

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

#define rep(i, N) for(int i = 0; i < (int)N; i++)

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

    long long w[N + 10], v[N + 10];
    rep(i, N)   cin >> w[i] >> v[i];

    //DPテーブル
    vector<vector<long long>> dp(N + 10, vector<long long>(W + 100, 0));

    rep(i, N)
    {
        for(int sum_w = 0; sum_w <= W; sum_w++)
        {
            //i番目の品物を選ぶ
            if(sum_w - w[i] >= 0)
            {
                dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - w[i]] + v[i]);
            }

            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w]);
        }
    }

    cout << dp[N][W] << endl;
}

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

using namespace std;
#define int long long
typedef pair <int, int> ii;
#define all(x) x.begin(), x.end()
 
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	vector<int> x(n), y(n);
	vector<ii> ball(n);
	for (int i = 0; i < n; ++i) {
		cin >> x[i] >> y[i];
		if(x[i] < y[i]) swap(x[i], y[i]);
		ball[i] = {x[i], y[i]};
	}
	sort(all(x)); sort(all(y));
	int ans = (x[n - 1] - x[0]) * (y[n - 1] - y[0]);
	sort(all(ball));
	int rrange = x[n - 1] - y[0];
	priority_queue<int , vector<int>, greater<int>> pque;
	priority_queue<int> pque2;
	pque.push(ball[n - 1].second);
	pque2.push(ball[n - 1].second);
	for(int i = n - 2; i >= 0; --i) {
		int bmax = max(ball[i].first, pque2.top());
		int bmin = min(ball[0].first, pque.top());
		ans = min(ans, rrange * (bmax - bmin));
		pque.push(ball[i].second);
		pque2.push(ball[i].second);
	}
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9836
#include<bits/stdc++.h>
 
using namespace std;
typedef long long ll;
vector<ll> v;
 
void dfs(ll d,ll s,ll u){
  if(d==18)return;
  if(s&&u!=d)v.push_back(s);
  dfs(d+1,s*10+2,u);
  dfs(d+1,s*10+8,u+1);
}
 
 
ll dfs1(ll s,ll d,ll id){
  if(s==1)return d;
  if(s<v[id]||id==v.size())return -1;
   
  ll res=-1;
   
  if(s%v[id]==0)res=max(res,dfs1(s/v[id],d+1,id));
   
  res=max(res,dfs1(s,d,id+1));
 
  return res;
}
 
int main(){
   
  dfs(0,0,0);
  sort(v.begin(),v.end());
  ll n;
  cin>>n;
  if(n==1){cout<<-1<<endl;return 0;}
  cout<<dfs1(n,0,0)<<endl; 
 
  return 0;
}

Measured memory_bytes: 17332
h,w,m=map(int,input().split())
lh=[0]*h
lw=[0]*w
l=set()
for i in range(m):
  h1,w1=input().split()
  l.add(h1+"_"+w1)
  lh[int(h1)-1]+=1
  lw[int(w1)-1]+=1

hmax=max(lh)
wmax=max(lw)
lh2=[]
lw2=[]
for i in range(h):
  if lh[i]==hmax:
    lh2.append(i)
for i in range(w):
  if lw[i]==wmax:
    for m in lh2:
      if str(m+1)+"_"+str(i+1) not in l:
        print(hmax+wmax)
        exit()      
print(hmax+wmax-1)

Measured memory_bytes: 134320
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f[100009],dp[100009];
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a;
	for(b=1; b<=a; b++) cin>>f[b];
	dp[a]=0;
	for(b=a-1; b>=1; b--){
		dp[b]=1000000000;
		if(dp[b]>dp[b+1]+abs(f[b]-f[b+1])) dp[b]=dp[b+1]+abs(f[b]-f[b+1]);
		if(b+2<=a&&dp[b]>dp[b+2]+abs(f[b]-f[b+2])) dp[b]=dp[b+2]+abs(f[b]-f[b+2]);
	}
	cout<<dp[1];
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

const int maxn = 100 + 5;

int top = 0;
int S[1000];

void push(int key){
  S[++top] = key;
  return;
}

int pop(){
  top--;
  return S[top+1];
}

int main(){
  int a,b;
  top = 0;
  char s[maxn];
  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      a = pop();
      b = pop();
      push(a+b);
    }
    else if(s[0] == '-'){
      b = pop();
      a = pop();
      push(a-b);
    }
    else if(s[0] == '*'){
      a = pop();
      b = pop();
      push(a*b);
    }
    else{
      push(atoi(s));
    }
  }
  printf("%d\n",pop());
}

Measured memory_bytes: 3208
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll n,res=0;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		ll A;
		cin>>A;
		res+=A-1;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <map>
#include<cmath>
#include <queue>
#include <numeric>
#include <cassert>

using lli = long long int;
lli inf = 1000000007;
using namespace std;

void solve()
{
	int N;
	cin >> N;
	vector<lli> a(N);
	for (int i = 0; i < N; i++)cin >> a[i];
	//平均値+1
	double ave = accumulate(a.begin(), a.end(), 0.0) / (N + .0);
	int costA = 0;
	int costB = 0;
	for (int i = 0; i < N; i++) {
		costA += (ceil(ave) - a[i]) * (ceil(ave) - a[i]);
		costB += (floor(ave) - a[i]) * (floor(ave) - a[i]);
	}
	cout << min(costA, costB) << endl;
}

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

Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define f first
#define s second
#define sz(x) int(x.size())
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define SIZE 26     
#define watch(x) cout << (#x) << " is " << (x) << endl
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
 
const ll mod = 1e9 + 7;
const int inf = 1e9 + 5;
const int N = 1e5 + 5;

int h[N];
vector<int> dp(N,inf);

signed main(){
    fastio;
    ll i,j,n,k;
    cin>>n>>k;
    for(i=1;i<=n;i++){
        cin>>h[i];
    }
    dp[1]=0;
    for(i=2;i<=n;i++){
        for(j=1;j<=k;j++){
            if(i-j>=1){
                dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
            }
        }
    }
    cout<<dp[n];
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	int a[5];
	int sum1=0, sum2=0;
	for(int i = 0; i < 3; i++){
		scanf("%d", &a[i]);
		if(a[i] == 5) sum1++;
		else if(a[i] == 7) sum2++;
	}
	if(sum1 == 2 && sum2 == 1) {
		printf("YES\n");
	}
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
using System;

class Solver {
  public void solve() {
    var buf = Console.ReadLine().Split();
    int na = int.Parse(buf[0]);
    int nb = int.Parse(buf[1]);
    int[,] d = new int[na, nb];
    for (int i = 0; i < na; i++) {
      buf = Console.ReadLine().Split();
      for (int j = 0; j < nb; j++) {
        d[i, j] = int.Parse(buf[j]);
      }
    }
    int m = 100;
    int n = 2 + m + m;
    int[,] c = new int[m + 1, m + 1];
    for (int i = 0; i <= m; i++) {
      for (int j = 0; j <= m; j++) {
        int cost = 0;
        for (int a = 1; a <= na; a++) {
          for (int b = 1; b <= nb; b++) {
            int nd = d[a - 1, b - 1];
            int bs = a * i + b * j;
            cost = Math.Max(cost, nd - bs);
          }
        }
        c[i, j] = cost;
      }
    }
    for (int a = 1; a <= na; a++) {
      for (int b = 1; b <= nb; b++) {
        int nd = d[a - 1, b - 1];
        bool ok = false;
        for (int i = 0; i <= m; i++) {
          for (int j = 0; j <= m; j++) {
            int cur = a * i + b * j + c[i, j];
            if (cur == nd) ok = true;
          }
        }
        if (!ok) {
          Console.WriteLine("Impossible");
          return;
        }
      }
    }
    Console.WriteLine("Possible");
    int es = m * 2 + (m + 1) * (m + 1);
    Console.WriteLine(n + " " + es);
    {
      int pv = 1;
      for (int i = 0; i < m; i++) {
        int nv = i + 2;
        Console.WriteLine(pv + " " + nv + " X");
        pv = nv;
      }
    }
    {
      int pv = n;
      for (int i = 0; i < m; i++) {
        int nv = n - i - 1;
        Console.WriteLine(nv + " " + pv + " Y");
        pv = nv;
      }
    }
    for (int i = 0; i <= m; i++) {
      for (int j = 0; j <= m; j++) {
        int u = i+1, v = n-j;
        Console.WriteLine(u + " " + v + " " + c[i, j]);
      }
    }
    Console.WriteLine(1 + " " + n);
  }
}

/* Main */
class ReSha {
  static void Main() {
    new Solver().solve();
  }
}

Measured memory_bytes: 13348
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
inline void read(int &x){
    x=0;char ch;bool flag = false;
    while(ch=getchar(),ch<'!');if(ch == '-') ch=getchar(),flag = true;
    while(x=10*x+ch-'0',ch=getchar(),ch>'!');if(flag) x=-x;
}
#define rg register int
#define rep(i,a,b) for(rg i=(a);i<=(b);++i)
#define per(i,a,b) for(rg i=(a);i>=(b);--i)
const int maxn = 2048;
struct Edge{
    int to,next;
}G[maxn<<1];
int head[maxn],cnt;
void add(int u,int v){
    G[++cnt].to = v;
    G[cnt].next = head[u];
    head[u] = cnt;
}
#define v G[i].to
int dep[maxn];
void dfs(int u,int f){
    for(rg i = head[u];i;i=G[i].next){
        if(v == f) continue;
        dep[v] = dep[u] + 1;
        dfs(v,u);
    }
}
#undef v
struct Node{
    int u,v;
}e[maxn];
int main(){
    int n,K;read(n);read(K);
    int u,v;
    rep(i,2,n){
        read(u);read(v);
        e[i].u = u;e[i].v = v;
        add(u,v);add(v,u);
    }
    int ans = 0x3f3f3f3f;
    if((K&1) == 0){
        int res = 0;
        rep(i,1,n){
            res = dep[i] = 0;dfs(i,i);
            rep(j,1,n) if(dep[j] > (K >> 1)) ++ res;
            ans = min(ans,res);
        }
    }else{
        int res = 0;
        rep(i,2,n){
            dep[e[i].u] = dep[e[i].v] = res = 0;
            dfs(e[i].u,e[i].v);dfs(e[i].v,e[i].u);
            rep(j,1,n){
                if(dep[j] > (K >> 1)) ++ res;
            }ans = min(ans,res);
        }
    }printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {

		String[] in=br.readLine().split(" ");
		int num=Integer.parseInt(in[0]);
		int piece=Integer.parseInt(in[1]);


		int re=(3*num+piece)/2;



		System.out.println(re);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}


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

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

    if (S == "Sunny")
    {
        cout << "Cloudy" << endl;
    }
    else if (S == "Cloudy")
    {
        cout << "Rainy" << endl;
    }
    else if (S == "Rainy")
    {
        cout << "Sunny" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))
 
 #define ab(a) ((a)>=0?(a):-(a))
 
int main(void){
	int x, y; cin >> x >> y;
	
	int X = ab(x), Y = ab(y);
	
	if(X==Y){
		cout << 1 << endl;
		return 0;
	}
	
	if(y == 0){
		cout << X + (x<0?0:1) << endl;
		return 0;
	}
	
	if(x == 0){
		cout << Y + (y<0?1:0) << endl;
		return 0;
	}
	
	if((x<0)^(y<0)){
		cout << ab(Y - X) + 1 << endl;
		return 0;
	}
		
	if(((X<Y)&&(x>0)&&(y>0)) || ((Y<X)&&(x<0)&&(y<0))){
		cout << ab(Y - X) << endl;
		return 0;
	}
		
	cout << ab(Y - X) + 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
 
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
 
lli offset=10100;
lli score[16];
lli tmpScore[16];
lli xs[(1LL<<16)][16];
lli ys[(1LL<<16)][16];
 
void func(long long N, std::vector<long long> X, std::vector<long long> Y, std::vector<long long> P){
 
    REP(i,0,16)score[i]=INF;

    REP(i,0,(1LL<<N)){
        REP(j,0,N)tmpScore[j] = abs(X[j]);

        REP(j,0,N){
            if(!(i&(1LL<<j)))continue;
            REP(k,0,N){
                chmin(tmpScore[k],abs(X[j]-X[k]));
            }
        }
        REP(k,0,N){
            xs[i][k]=tmpScore[k];
        }
    }    
    REP(i,0,(1LL<<N)){
        REP(j,0,N)tmpScore[j] = abs(Y[j]);

        REP(j,0,N){
            if(!(i&(1LL<<j)))continue;
            REP(k,0,N){
                chmin(tmpScore[k],abs(Y[j]-Y[k]));
            }
        }
        REP(k,0,N){
            ys[i][k]=tmpScore[k];
        }
    }

    lli maxCnt=1;
    REP(i,0,N)maxCnt*=3;

    for(lli i=0;i<maxCnt;i++){
        lli xState=0,yState=0;
        lli cnt=0;
        lli nowScore = 0;
        lli bitCount=0;
        lli tmp=i;
        while(tmp>0){
            if(tmp%3==1){
                xState|=(1LL<<cnt);
                bitCount++;
            }
            else if(tmp%3==2){
                yState|=(1LL<<cnt);
                bitCount++;
            }
            cnt++;
            tmp/=3;
        }
        lli sumScore=0;
        REP(j,0,N){
            sumScore +=  P[j]*min(xs[xState][j],ys[yState][j]);
        }
        chmin(score[bitCount],sumScore);
    }
    REP(i,0,N+1){
        cout<<score[i]<<endl;
    }
 
}
 
int main(){
    // cout << fixed << setprecision(5);
 
    long long N;
    scanf("%lld",&N);
    std::vector<long long> X(N);
    std::vector<long long> Y(N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
        scanf("%lld",&Y[i]);
        scanf("%lld",&P[i]);
    }
    func(N, std::move(X), std::move(Y), std::move(P));
    return 0;
}

Measured memory_bytes: 11884
N = int(input())

DIV = 26

mojiretsu = ''

NUM = 97

i = 1

minus = 0

while(True):
    minus += DIV ** (i - 1)
    mod = (N - minus) % (DIV ** i)
    new_sho = mod // DIV ** (i - 1)
    mojiretsu = chr(NUM + new_sho) + mojiretsu
    sho = (N - minus) // (DIV ** i)
    if sho == 0:
        print(mojiretsu)
        break
    i += 1

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
 ll A,B;
  cin>>A>>B;
  set<ll> S;
  S.insert(A);
  S.insert(B);
  for(ll i=1;i<=3;i++) {
if(!S.count(i)) {
cout<<i<<endl;
  return 0;
}
  }
}

Measured memory_bytes: 3556
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
	double x1, y1, x2, y2, dis;
	cin>>x1>>y1>>x2>>y2;

	dis = sqrt(pow(x2-x1, 2) + pow(y2-y1, 2));

	printf("%.8lf\n", dis);

	return 0;
}

Measured memory_bytes: 1236
def ABC_80_B():
    N=input()
    N1=list(N)
    x=0
    for i in range(len(N1)):
        x+=int(N1[i])

    if int(N)%x==0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':

    ABC_80_B()

Measured memory_bytes: 2940
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H;
long long int ans;


int main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> N >> s;
	for (auto i : s) {
		if (i == 'I')M++;
		else M--;
		ans = max(ans, M);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		int A = reader.nextInt();
		int B = reader.nextInt();
		int ans = Math.min(N * A, B);

		System.out.println(ans);
		reader.close();
	}


}





Measured memory_bytes: 22228