akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) cout << "YES\n";
    else cout << "NO\n";
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
using namespace std;
const int MAXN=100005;

int N;
vector<int> adj[MAXN];
int sg[MAXN];

void dfs(int u,int fa=0)
{
	for(auto v:adj[u])
	{
		if(v==fa)
			continue;
		dfs(v,u);
		sg[u]^=(sg[v]+1);
	}
}

int main()
{
	scanf("%d",&N);
	for(int i=1;i<N;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	dfs(1);
	if(sg[1])
		puts("Alice");
	else
		puts("Bob");
	
	return 0;
}


Measured memory_bytes: 12288
#include <stdio.h>
#include <string.h>
int main(){
  char str[3];
  int sum,i;
  scanf("%s",str);
  
  for(i=0;i<strlen(str);i++){
    sum += (str[i]-'0');
  }
  
  printf("%d\n",sum);
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main(){
  int S,h,m,s,tmp,tmp1,tmp2;
  scanf("%d",&S);
  h = S / 3600;
  tmp1 = S - h * 3600;
  m = tmp1 / 60;
  tmp2 = tmp1 - m * 60;
  s = tmp2;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}
  
  

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

int main() {
  ll x;
  cin >> x;
  ll ans = x/11;
  x -= ans*11;
  ans *= 2;
  if(x == 0) cout << ans << endl;
  else if(x <= 6) cout << ans+1 << endl;
  else cout << ans+2 << endl; 
}

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

int main(){
int n;
  cin >> n;
int j=0;  
int a[100000];
  for(int i=0;i<n;i++) cin >> a[i];
sort(a,a+n);
  int res=0;
  int f;
  while(j<n){
   int cc=a[j];
   f=0;
    while(j<n && a[j]==cc){
      j++;
      f++;     
      }
    res+=f%2;
  
  }
  cout << res << endl;


}


Measured memory_bytes: 3992
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i,k) for(int i=0;i<k;i++)
ll n, m, i, j, k,o,p,l,z;
ll a[100005], b[100005],inf=1000000000000;

ll s[100005],t[100005], xx[100005];

ll tansaku(ll x,ll n,ll* s) {
	int max,min, mid ;
	min = 0; 	max = n + 1; 
	while (max - min > 1) {
		mid = (min + max) / 2;
		
		if (s[mid] > x) {
			max = mid;
		}
		else {
			min = mid;
		}
	//	cout << max << "\n";
	}	
	return max;

}

ll hikaku(ll* s, ll* t, ll o, ll p,ll k) {
	ll z = min((abs(s[o] - k) + abs(s[o] - t[p])), (abs(t[p] - k) + abs(s[o] - t[p])));
	ll zz = min((abs(s[o] - k) + abs(s[o] - t[p-1])), (abs(t[p-1] - k) + abs(s[o] - t[p-1])));
	ll za = min((abs(s[o - 1] - k) + abs(s[o - 1] - t[p])), (abs(t[p] - k) + abs(s[o - 1] - t[p])));
	ll zb = min((abs(s[o - 1] - k) + abs(s[o - 1] - t[p-1])), (abs(t[p-1] - k) + abs(s[o - 1] - t[p-1])));
	z = min(z, zz);
	return min(z, min(za, zb));
}


int main() {
	cin >> n >> m>>l;
	s[0] = -inf; s[n + 1] = inf;
	t[0] = -inf; t[m + 1] = inf;
	rep(i, n)cin >> s[i+1];
	rep(i, m)cin >> t[i+1];
	rep(i, l)cin >> xx[i];
	rep(i, l) {
		k = xx[i];
		o = tansaku(k, n, s);
		p = tansaku(k, m, t);
		z = inf;
		cout <<hikaku(s, t, o, p, k) << "\n";
	}

	return 0;
}

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


int main(){
	vector<int>a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin >>k;
	cout << a[k-1];
}

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

int main(){
    int a,b;
    cin >> a >> b;
    if(a==1){
        if(b==2){cout << 3 << endl;}
        if(b==3){cout << 2 << endl;}
    }
    if(a==2){
        if(b==1){cout << 3 << endl;}
        if(b==3){cout << 1 << endl;}
    }
    if(a==3){
        if(b==1){cout << 2 << endl;}
        if(b==2){cout << 1 << endl;}
    }
}

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


using namespace std;


const int MAXN = 100 * 1000 + 132;



int n, a[MAXN], dp[MAXN];




int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	dp[1] = abs(a[1] - a[0]);
	for (int i = 2; i < n; i++)
		dp[i] = min(abs(a[i] - a[i - 2]) + dp[i - 2], abs(a[i] - a[i - 1]) + dp[i - 1]);
	cout << dp[n - 1];
	return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace std;

int AscSort(const void* v1, const void* v2);

int main() {
    int num[4];
    
    cin >> num[0] >> num[1] >> num[2] ;
    qsort(num, 3, sizeof(num[0]), AscSort);
    printf("%d %d %d\n", num[0], num[1], num[2]);
    return 0;
}

int AscSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);

    if (_v1 > _v2) {
        return 1;
    }
    else if (_v1 < _v2) {
        return -1;
    }
    else {
        return 0;
    }
}

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i, n) cin >> p.at(i);
  int count = 0;
  int mini = INT_MAX;
  rep(i, n) {
    if(p.at(i) <= mini) {
      count++;
      mini = min(mini, p.at(i));
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

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

    const int NMAX = 1000;
    const int MMAX = 2000;
    int a[MMAX], b[MMAX];
    ll c[MMAX];

    for (int i = 0; i < M; i++) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
        c[i] = -c[i];
    }

    ll dist[NMAX];
    for (int i = 0; i < N; i++) {
        dist[i] = INF;
    }

    dist[0] = 0;

    for (int loop = 0; loop < N-1; loop++) {
        for (int i = 0; i < M; i++) {
            if (dist[a[i]] == INF) continue;
            if (dist[b[i]] > dist[a[i]]+c[i]) {
                dist[b[i]] = dist[a[i]]+c[i];
            }
        }
    }
    ll ans = dist[N-1];
    bool negative[NMAX];
    for (int i = 0; i < N; i++) {
        negative[i] = false;
    }
    for (int loop = 0; loop < N; loop++) {
        for (int i = 0; i < M; i++) {
            if (dist[a[i]] == INF) continue;
            if (dist[b[i]] > dist[a[i]]+c[i]) {
                dist[b[i]] = dist[a[i]]+c[i];
                negative[b[i]] = true;
            }
            if (negative[a[i]] == true) {
                negative[b[i]] = true;
            }
        }
    }

    if (negative[N-1] == true) {
        cout << "inf" << endl;
    } else {
        cout << -ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))
inferior = [0] * N
count = 0

for i in range(M):
    A, B = map(int, input().split())
    if H[A - 1] > H[B - 1]:
        inferior[B - 1] = 1
    elif H[A - 1] == H[B - 1]:
        inferior[A - 1] = 1
        inferior[B - 1] = 1
    else:
        inferior[A - 1] = 1

for i in range(N):
    if inferior[i] == 0:
        count += 1

print(count)


Measured memory_bytes: 20128
/*
Author : Devil088
*/
#include<bits/stdc++.h>
using namespace std;
#define MOD 1e+7 
typedef long long ll;
typedef long l;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<l> vl;

int main(){
	long n;
	cin>>n;
	long m = n;
	long ans = 0;
	while(n>0){
		ans+=n%10;
		n/=10;
	}
	
	
	if(m%ans == 0)cout<<"Yes\n";
	else cout<<"No\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int x,a,b;cin>>x>>a>>b;
  if(abs(x-a)>abs(x-b)){
    P('B');
  }else{
    P('A');
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int a, b, c, arr[10001];

int main(void) {
    int i, is_first = 1;
    
    scanf("%d%d%d", &a, &b, &c);
    ++arr[a];
    ++arr[b];
    ++arr[c];
    
    for (i = 1; i <= 10000; ++i) {
        while (arr[i]--) {
            if (is_first) {
                is_first = 0;
            } else {
                printf(" ");
            }
            printf("%d", i);
        }
    }
    
    printf("\n");
    return 0;
}

Measured memory_bytes: 636
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << 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; }

int N,cnt=0;
string A,B,C;

int main(){
    cin>>N>>A>>B>>C;
    rep(i,N){
        if(A[i]==B[i] && B[i]==C[i])continue;
        if(A[i]!=B[i]&&B[i]!=C[i]&&C[i]!=A[i]){
            cnt+=2;
        }
        else{
            cnt++;
        }
    }
    out(cnt);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, X;
		N = sc.nextInt();
		X = sc.nextInt();
		int L[] = new int[N + 1];

		for (int i = 0; i < N; i++) {
			L[i] = sc.nextInt();
		}
		sc.close();

		int a = 0;
		int b = 0;
		for (int i = 0; i < N + 1; i++) {
			if (a <= X) {
				a += L[i];
				b++;
			}

		}
		System.out.println(b);
	}

}


Measured memory_bytes: 23636
P,Q,R = map(int,input().split())
 
#print(P,Q,R)
 
X=[P,Q,R]
Y=[]
for i in range(0,2):
    for j in range(i+1,3):
       # print(i,j)
        Y.append(X[i]+X[j])
#for j in range(2,3):
 #   print("j",j)
 
#print(range(2,2))
print(min(Y))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(T x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
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;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main(){
    int k,s;
    cin>>k>>s;
    ll res=0;
    rep(i,k+1){
        rep(j,k+1){
            if(s-(i+j)>=0&&s-(i+j)<=k)res++;
        }
    }
    cout<<res<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <stdio.h>
int n, q, a[16][16], b[16][16], com, r, c, s, z;
void rec(int r_, int c_) {
	a[r_][c_] ^= 1;
	for (int i = -1; i <= 1; i++) {
		for (int j = -1; j <= 1; j++) {
			if (i * j == 0 && i + j && 0 <= r_ + i && r_ + i < n && 0 <= c_ + j && c_ + j < n && a[r_ + i][c_ + j] != a[r_][c_]) rec(r_ + i, c_ + j);
		}
	}
}
int main() {
	scanf("%d%d", &n, &q);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) scanf("%d", &a[i][j]);
	}
	for (int i = 0; i < q; i++) {
		scanf("%d%d", &com, &r), r--;
		switch (com) {
		case 0:
			scanf("%d%d%d", &c, &s, &z), c--;
			for (int i = 0; i < z / 90; i++) {
				for (int j = r; j < r + s; j++) {
					for (int k = c; k < c + s; k++) b[j][k] = a[s + c + r - k - 1][j + c - r];
				}
				for (int j = r; j < r + s; j++) {
					for (int k = c; k < c + s; k++) a[j][k] = b[j][k];
				}
			}
			break;
		case 1:
			scanf("%d%d", &c, &s), c--;
			for (int i = r; i < r + s; i++) {
				for (int j = c; j < c + s; j++) a[i][j] ^= 1;
			}
			break;
		case 2:
			for (int i = 0; i < n; i++) b[r][i] = a[r][(i + 1) % n];
			for (int i = 0; i < n; i++) a[r][i] = b[r][i];
			break;
		case 3:
			for (int i = 0; i < n; i++) b[r][(i + 1) % n] = a[r][i];
			for (int i = 0; i < n; i++) a[r][i] = b[r][i];
			break;
		case 4:
			scanf("%d", &c), c--; rec(r, c);
			break;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) printf(j ? " %d" : "%d", a[i][j]);
		printf("\n");
	}
}

Measured memory_bytes: 2720
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), l, r, ans = 0;

		for (int i = 0; i < n; i++) {
			l = sc.nextInt();
			r = sc.nextInt();
			ans += r - l + 1;
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 25936
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  while(true){
    C=C-B;
    if(C<=0){
      cout<<"Yes"<<endl;
      return 0;
    }
    A=A-D;
    if(A<=0){
      cout<<"No"<<endl;
      return 0;
    }
  }

  
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, k, n) for (int i = k; i < (int)(n); i++)
#define RRep(i, k, n) for (int i = k; i > (int)(n); i--)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define ALL(a)  (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
const double PI = acos(-1); //3.14~
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    int a, b; cin >> a >> b;
    if (a != b) cout << max(a, b) + max(a - 1, b - 1) << endl;
    else cout << a + b << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Apolloliu
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

//#define pt(s)      cerr << s << endl
//#define pt(a, b)      cerr << a << " "  << b << endl
#define MEM(a,b)    memset(a, b, sizeof(a))
#define UN(a)       sort(all(a)), a.erase(unique(all(a)), a.end())
#define REV(a)      reverse(all(a))
#define MP(a, b)    make_pair(a, b)
#define PAIR(a, b)  pair<int, int>(a, b)

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int maxn = 1;
const double EPS = 1e-8;

int g[700][700];
int n, m;
vector< tuple<int, int, int, int>> v;

class DMakeThemEven {
public:
	void solve(std::istream& in, std::ostream& out) {
		in>>n>>m;
		memset(g, 0, sizeof(g));
		v.clear();
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < m; ++j) {
				in >> g[i][j];
			}
		}

		int tmp = 0;
		for (int i = 0; i < n; ++i) {
			if(i % 2 == 0){
				for (int j = 0; j < m; ++j) {
					if(g[i][j] % 2 == 1){
						g[i][j]--;
						if(j == m - 1){
							if(i < n - 1)
								v.emplace_back(i, j, i+1, j), g[i+1][j]++;
						}
						else {v.emplace_back(i, j, i, j+1); g[i][j+1]++;}
					}
				}
			} else {
				for (int j = m - 1; j >= 0; --j) {
					if(g[i][j] % 2 == 1){
						g[i][j]--;
						if(j == 0){
							if(i < n - 1)
								v.emplace_back(i, j, i+1, j), g[i+1][j]++;
						}
						else v.emplace_back(i, j, i, j-1), g[i][j-1]++;
					}
				}
			}
		}
		out << v.size() << "\n";
		int a, b, c, d;
		for (auto &x : v) {
			tie(a, b, c, d) = x;
			a++, b++, c++, d++;
			out << a << " " << b << " " << c << " " << d << "\n";
		}
	}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	DMakeThemEven solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int ans = max<int>({
    10*a+b+c,
    a+10*b+c,
    a+b+10*c,
  });
  cout << ans << endl;
}


Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main() {
    let v1 = read_vec::<u64>();
    let _n = v1[0];
    let m = v1[1];

    let mut v2 = read_vec::<u64>();
    let vlen = v2.len();
    v2.sort();

    let mut v3 = Vec::new();
    for _ in 0..m {
        let v4 = read_vec::<u64>();
        let bj = v4[0];
        let cj = v4[1];
        v3.push((bj, cj));
    }

    v3.sort_by_key(|&(_, c)| c);
    v3.reverse();

    let mut len: usize = 0;
    for (b, c) in v3 {
        //let b = v[0];
        //let c = v[1];

        if v2[len] < c {
            for j in 0..(b as usize) {
                let lj = len + j;
                if lj < vlen && v2[lj] < c {
                    v2[lj] = c;
                } else {
                    break;
                }
            }
        } else {
            break;
        }

        len += b as usize;
        if len > vlen - 1 {
            break;
        }
    }

    let s = v2.iter().sum::<u64>();
    println!("{}", s);
}


Measured memory_bytes: 11512
#include <iostream>
#include <cmath>
using namespace std;
int main(){
	int n;
	cin >> n;
	int arr[n];
	for (int i = 0; i < n; i++) cin >> arr[i];
	if (n == 1) {
		cout << 0;
	} else if (n == 2){
		cout << abs(arr[0] - arr[1]);
	} else {
		int DP[n];
		DP[0] = 0; DP[1] = abs(arr[1] - arr[0]);
		for (int i = 2; i < n; i++){
			DP[i] = min(DP[i-2] + abs(arr[i-2] - arr[i]),
						DP[i-1] + abs(arr[i-1] - arr[i]));
		}
		cout << DP[n-1];
	}
}

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

#define  pf                  printf
#define  sc                  scanf
#define  PI                  2*acos(0.0)
#define  fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define  mem(a,b)            memset(a, b, sizeof(a) )
#define  gcd(a,b)            __gcd(a,b)
#define  lcm(a,b)            (a*(b/gcd(a,b)))
#define  MAX                 1234567899
#define  mod                 1000000007
#define  all(v)              (v).begin(),(v).end()
#define  vSort(v)            sort(all(v))
#define  maxSort(v)          sort(all(v),greater<int>())
#define  Unique(v)           v.erase(unique(all(v)),v.end())
#define  sqr(x)              ((x)*(x))
#define  qube(x)             ((x)*(x)*(x))
#define  deci(n)             cout<<fixed<<setprecision(n)
#define  sci(n)              sc("%d",&(n))
#define  scii(x,y)           sc("%d %d",&(x),&(y))
#define  scl(x)              sc("%lld",&(x))
#define  scll(x,y)           sc("%lld %lld",&(x),&(y))
#define  vi                  vector<int>
#define  hi                  pf(" HI \n")
#define  pp                  pair<int,int>
#define  pb(x)               push_back(x)
#define  mp(x,y)             make_pair(x,y)
#define  F                   first
#define  S                   second
#define  check(n,pos)        (n & (1<<(pos)))
#define  biton(n,pos)        (n  (1<<(pos)))
#define  bitoff(n,pos)       (n & ~(1<<(pos)))
typedef  long long int       lli;
typedef  unsigned long long int ulli;
int dx4[] = { 0 , 0 , -1 , 1 } ;
int dy4[] = { -1 , 1 , 0 , 0 } ;
bool valid( int r , int c , int x , int y ){
    if( x >= 1 && x <= r && y >= 1 && y <= c ) return 1 ; return 0 ;}

using namespace std;

int main ()
{
    int n;
    cin >> n;
    int a[n];
    int sum=0;
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
        sum+=a[i];
    }
    sort(a,a+n);
    int p=a[n-1];
    int ans=sum-p;
    if(ans>p)
        cout <<"Yes"<<endl;
    else
        cout << "No"<<endl;
    return 0;
}



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

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

int BMI(double weight, double height) {
	return weight / pow(height, 2);
}

int main() {
	double weight, height; string str, buf;
	vector<string> vec;
	while (cin >> str) {
		vec.resize(0);
		stringstream ss{ str };
		while (getline(ss, buf, ',')) 
			if(!str.empty()) vec.push_back(buf);
		weight = stod(vec[1]);
		height = stod(vec[2]);
		if (BMI(weight, height) >= 25) cout << vec[0] << endl;
		rep(i, 3) vec.pop_back();
	}
	return 0;
}


Measured memory_bytes: 3236
/*
Author : N_o_o_B
Created : January 21 2020 12:59:24 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n,m;
    cin >> n >> m;
    cout << ((n == m) ? "Yes" : "No") << endl;



    time_taken();
    return 0;
}

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

using namespace std;

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

int main()
{
    int N,a[3][3],b[10];
    bool isBingo[3][3];
    bool ans = false;
    rep(i,3) rep(j,3)
        cin >> a[i][j];
    
    cin >> N;

    rep(i,N)
        cin >> b[i];
    
    rep(i,3) rep(j,3){
        isBingo[i][j] = false;
        rep(k,N) if (a[i][j] == b[k]) isBingo[i][j] = true;
    }
    rep (i,3) if (isBingo[i][0] && isBingo[i][1] && isBingo[i][2]) ans = true;
    rep (i,3) if (isBingo[0][i] && isBingo[1][i] && isBingo[2][i]) ans = true;
    if (isBingo[0][0] && isBingo[1][1] && isBingo[2][2]) ans = true;
    if (isBingo[0][2] && isBingo[1][1] && isBingo[2][0]) ans = true;

    if (ans){
        cout << "Yes" << endl;
    }else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    long long int a , b , n , ans = 0 , x ;
    cin >> a >> b >> n ;
    x = b-1 ;
    if(x > n)
    {
        x = n ;
    }
    ans = a*x ;
    ans /= b ;
    cout << ans << endl ;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<utility>
#include<set>
#include<stack>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int>PA;
using namespace std;
#define MAX  999999
int main(){
	double  x,y,s;
	while(cin >> x>> y >> s,x+y+s){
		int big= -INF;
		for(int i = 1; i<1000;i++){
			for(int j = 1; j <1000;j++){
				if((int(i*(x+100)/100))+int((j*(x+100)/100)) == s){
					big = max(big,int(i*(y+100)/100)+int(j*(y+100)/100));
				}
			}
		}
		cout << big << endl;
	}
}

Measured memory_bytes: 3028
#include <iostream>

using namespace std;

int main(){
int N, m, M, t;
	long int s; 
	cin >> N;
	m = 1000000;
	M = -1000000;
	s = 0;
	for(int i = 0; i < N; i++){
		cin >> t;
		m = min(m,t);
		M = max(M,t);
		s += t;
	}
	cout << m << " " << M << " " << s << endl;
    return 0;
}


Measured memory_bytes: 3084
use std::io::BufRead;

fn run() {
    let stdin = std::io::stdin();
    let mut stdin = stdin.lock();
    let mut s = String::new();
    stdin.read_line(&mut s).unwrap();
    let n: usize = s.trim().parse().ok().unwrap();
    let mut ans: u64 = 0;
    let mut map = std::collections::HashMap::new();
    for _ in 0..n {
        s.clear();
        stdin.read_line(&mut s).unwrap();
        let mut s: Vec<char> = s.trim().to_owned().chars().collect();
        s.sort();
        let po = map.entry(s).or_insert(0);
        ans += *po;
        *po += 1;
    }
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 16636
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
	while(kbd.hasNext()){
	    int n = kbd.nextInt();
	    if(n!=0){
		solve(n);
	    }
	}
    }

    static void solve(int n){
	int[][] s = new int[n+1][n+1];
	int i, j;
	for(i=0; i<n; i++){
	    for(j=0; j<n; j++){
		s[i][j] = kbd.nextInt();
		s[n][j] += s[i][j];
		s[i][n] += s[i][j];
		s[n][n] += s[i][j];
	    }
	}

	for(i=0; i<n+1; i++){
	    for(j=0; j<n+1; j++){
		System.out.printf("%5d", s[i][j]);
	    }
	    System.out.println();
	}
    }
}

Measured memory_bytes: 23772
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long[] jyogai=new long[1000];

		for(int i=0; i<1000; i++) {
			jyogai[i]=(i+2)*(i+1)/2;
		}

		for(int i=1; i<1000; i++) {
			jyogai[i]=jyogai[i]+jyogai[i-1];
		}

		for(int i=0; i<1000; i++) {
			jyogai[i]*=4;
		}
		while(sc.hasNext()) {
			long Sigma=sc.nextLong();

			if(Sigma>2000) {
				Sigma=4000-Sigma;
			}

			long answer=(Sigma+3)*(Sigma+2)*(Sigma+1)/6;
			if(Sigma>1000) {
				answer-=jyogai[(int) (Sigma-1001)];
			}
			System.out.println(answer);

		}
	}
}


Measured memory_bytes: 26524
#include<bits/stdc++.h>
using namespace std;
#define bs ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define pb push_back
// #define LOCAL_DEFINE
// #define LOCAL
#define deb(a) cout << #a << " = " << a << '\n'
#define deb2(a, b) cout << #a << " = " << a << ", " << #b << " = " << b << '\n'
#define rep(var,start,end) for(int var=start;var<end;var++)
#define erep(var,start,end) for(int var=start;var<=end;var++)
#define rrep(var,start,end) for(int var=start;var>=end;var--)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pci pair<char,int>
#define pll pair<ll,ll>
#define test int t;cin>>t;while(t--)

ll expo(ll n, ll p, ll M){
	ll res = 1;
	while(p){
		if(p&1)
			res = (res * n)%M;
		n = (n*n)%M;
		p >>= 1;
	}
	return res;
}

void solve(){
	int n;
	cin >> n;
	double x;
	map<pii,int> cnt;
	rep(i,0,n){
		cin >> x;
		ll val = llround(x * 1e9);
		int c2 = 0, c5 = 0;// power of 2 and 5 in x*1e9;
		while(val % 2 == 0){
			c2++;
			val/=2;
		}
		while(val % 5 == 0){
			c5++;
			val/=5;
		}
		++cnt[{c2, c5}];
	}
	ll ans = 0;
	for(auto p1: cnt){
		for(auto p2: cnt){

			// checking power of 2(and 5) on mul is greater than 0-> 18 is added as a result of mul 10^9;
			if(p1.first.first + p2.first.first >= 18 and p1.first.second + p2.first.second >= 18){
				// do nC2
				if(p1 < p2){
					ans += (ll) p1.second * p2.second; 
				}
				if(p1 == p2)
					ans += (ll) p1.second * (p1.second - 1)/2;
			}
		}
	}
	cout << ans;
}

int main()
{
	bs;
	#ifdef LOCAL
	freopen("Contest/input.txt","r",stdin);
	freopen("Contest/output.txt","w",stdout);
	#endif
	solve();
	// test{
	//    solve(); 
	// }
	#ifdef LOCAL_DEFINE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	#endif
}

Measured memory_bytes: 3776
INF=1000000000+7

s=int(input())
dp=[0]*(2000+1);
	
dp[0]=dp[1]=dp[2]=0
dp[3]=1


for i in range(4,s+1):
	temp=1
	for j in range(3,i-2):
		temp+=dp[j]%INF;
	temp%=INF;
	dp[i]=temp
print(dp[s])


Measured memory_bytes: 9156
N,Y=map(int,input().split())
for i in range(N+1) :
  for j in range(N+1) :
    if N-i-j>=0 and 10000*i+5000*j+1000*(N-i-j)==Y :
      print(i,j,N-i-j)
      exit()
print(-1,-1,-1)

Measured memory_bytes: 9128
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <limits.h>
#include <float.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int n;
    int ans;

    scanf("%d", &n);

    ans = 180 * (n - 2);

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

    return 0;
}

Measured memory_bytes: 128
/*
    author: Salam_35
    problem name: The Knapsack Problem
*/

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

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define load(array,size)  for(int i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(int i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF	1LL<<19
#define pll pair<ll,ll>

ll s,n;
ll price[2005],weight[2005];

ll dp[150][100050];

ll solve(ll i, ll w)
{
    int profit1=0,profit2=0;
    if(i==(n+1))
        return 0;

    if(dp[i][w]!=-1) return dp[i][w];
    if(w+weight[i]<=s)
       return dp[i][w] =max( solve(i+1,w), price[i]+solve(i+1,w+weight[i]));
    else
        return dp[i][w]=solve(i+1,w);
}

int main()
{
    memset(dp, -1, sizeof dp);
    cin >> n >> s;
    for(ll i=0;i<n;i++)
    {
        ll a,b;
        cin >> weight[i] >> price[i];
    }
    cout<<solve(0,0)<<endl;
}


Measured memory_bytes: 117504
#include<iostream>    
#include<cstdio>  
#include<stdio.h>  
#include<cstring>    
#include<cstdio>    
#include<climits>    
#include<cmath>   
#include<vector>  
#include <bitset>  
#include<algorithm>    
#include <queue>  
#include<map> 
#define inf 9999999; 
using namespace std;


int n,x,y,z;
int main()
{
	cin>>x>>y>>z;
	n=x*100+y*10+z;
	if(n%4==0)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
}

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


    class Progrm
{
   static void Main(string[] args)
    {
        while(true){
            int t=int.Parse(Console.ReadLine());
            if(t==0)break;
            int n=int.Parse(Console.ReadLine());
            int sum=0;
            for(int i=0;i<n;++i){
               	
                string[] input = Console.ReadLine().Split(' ');
                int s=int.Parse(input[0]);
                int f=int.Parse(input[1]);
                sum+=f-s;
            }
            if(sum>=t){
                Console.WriteLine("OK");
            }else{
                Console.WriteLine(t-sum);
            }
        }
    }

}

Measured memory_bytes: 9276
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, a;
    long long k;
    scanf("%d%lld", &n, &k);

    vector<int> neg, pos, zero;
    for(int i=1;i<=n;i++){
        scanf("%d", &a);
        if(a == 0) zero.emplace_back(a);
        else if(a < 0) neg.emplace_back(-a);
        else pos.emplace_back(a);
    } 
    sort(zero.begin(), zero.end());
    sort(neg.begin(), neg.end());
    sort(pos.begin(), pos.end());
    if(pos.size()*1ll*neg.size() < k){
        k -= pos.size()*1ll*neg.size();
        if((neg.size()+pos.size())*1ll*zero.size() + zero.size()*1ll*(zero.size()-1)/2 < k){
            k -= (neg.size()+pos.size())*1ll*zero.size() + zero.size()*1ll*(zero.size()-1)/2;

            long long lo = 1, hi = 1e18, ans;
            while(lo <= hi){
                long long mid = (lo+hi)/2;

                long long sum = 0;
                for(int i=0;i<neg.size();i++){
                    int lo2 = i+1, hi2 = neg.size()-1, r = i;
                    while(lo2 <= hi2){
                        int mid2 = (lo2+hi2)/2;
                        if(neg[i]*1ll*neg[mid2] <= mid) r = mid2, lo2 = mid2+1;
                        else hi2 = mid2-1;
                    }
                    sum += r-i;
                }

                for(int i=0;i<pos.size();i++){
                    int lo2 = i+1, hi2 = pos.size()-1, r = i;
                    while(lo2 <= hi2){
                        int mid2 = (lo2+hi2)/2;
                        if(pos[i]*1ll*pos[mid2] <= mid) r = mid2, lo2 = mid2+1;
                        else hi2 = mid2-1;
                    }
                    sum += r-i;
                }

                if(sum >= k) ans = mid, hi = mid-1;
                else lo = mid+1;
            }
            printf("%lld\n", ans);
        }
        else printf("0\n");
    }
    else{
        long long lo = 1, hi = 1e18, ans;
        while(lo <= hi){
            long long mid = (lo+hi)/2;

            long long sum = 0;
            for(int i=0;i<neg.size();i++){
                int lo2 = 0, hi2 = pos.size()-1, r = pos.size();
                while(lo2 <= hi2){
                    int mid2 = (lo2+hi2)/2;
                    if(pos[mid2]*1ll*neg[i] >= mid) r = mid2, hi2 = mid2-1;
                    else lo2 = mid2+1;
                }
                sum += pos.size()-1-r+1;
            }
            if(sum >= k) ans = mid, lo = mid+1;
            else hi = mid-1;
        }
        printf("%lld\n", -ans);
    }
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
#define rep(i,n) for(int i=0;i<n;++i)
typedef long long int ll;
typedef unsigned long long ull;
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 pair<ll,ll> P;

int main()
{
    int n,k;
    cin>>n>>k;
    vector<P> a(n);
    double sum=1;
    rep(i,n){
        int c;
        cin>>c;
        int cnt=0;
        int b=c;
        while(b>0){
            cnt++;
            b/=10;
        }
        //cout<<cnt<<endl;
        a[i]=P(c,cnt);
    }
    rep(i,k)sum*=(double)a[i].first;
    double before = sum;
    int i=0;
    for(int t=k;t<n;t++){   
        
        if(a[i]<a[t])cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        
        i++;
    }
    return 0;
}


Measured memory_bytes: 6420
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        if(B % A == 0) {
            System.out.println(A + B);
            return;
        }
        System.out.println(B - A);

    }
}

Measured memory_bytes: 23252
#include<stdio.h>

int now[30];
int index=0;
int a;
void solve(int sum,int t){
	//printf("%d %d\n",sum,t);
	if(sum==a){
		printf("%d",now[0]);
		for(int i=1;i<index;i++){
			printf(" %d",now[i]);
		}
		printf("\n");
		return;
	}
	for(int i=t;i>=1;i--){
		if(sum+i<=a){
			now[index++]=i;
			solve(sum+i,i);
			index--;
		}
	}
	return ;
}
int main(){
	while(scanf("%d",&a),a){
		solve(0,a);
	}
}

Measured memory_bytes: 0
#include <stdio.h>
//#include <string.h>

int main() {
    int w, h, i, j;

    while (1) {
        scanf("%d %d", &h, &w);

        if (w == 0 && h == 0)
            break;

        for (i = 0; i < h; ++i) {
            for (j = 0; j < w; ++j) {
                if (j == 0 || j == w-1 || i == 0 || i == h-1)
                    printf("#");
                else
                    printf(".");
            }
            printf("\n");
        }
        printf("\n");
    }

    return 0;
}


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

void solve()
{
    char a; cin >> a;
    if (a-'a' >= 0) cout << "a" << endl;
    else cout << "A" << endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    // int ti = clock();
    // input();
    solve();
    // printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
    return 0;
}

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

int main()
{
  char c;
  cin >> c;
  if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o' ) {
    cout << "vowel" << endl;
  } else {
    cout << "consonant" << endl;
  }
  return(0);
}

Measured memory_bytes: 3640
use proconio::input;

#[allow(non_snake_case)]
fn main() {
    input! {
        mut N: u64,
    }

    let mut ans = 0;

    for i in 2..=N {
        if N == 1 {
            break;
        }

        if i * i > N {
            if N != 1 {
                ans += 1;
            }
            break;
        }

        if N % i == 0 {
            //
            let mut c = 0;
            while N % i == 0 {
                N /= i;
                c += 1;
            }
            ans += ((c as f64 * 2.0 + 0.25).sqrt() - 0.5) as u64;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){

  int mountain[10];

  for( int i = 0 ; i < 10 ; i++ ){
    cin >> mountain[i];
  }

  sort( mountain , mountain + 10 );

  cout << mountain[9] << endl << mountain[8] << endl <<mountain[7] << endl;

  return 0;
}

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

list_num = list(map(int, input().split()))

max_no = 0
cnt_break = 0

for i in list_num:
  if i == max_no + 1:
    max_no = i
    continue
  cnt_break = cnt_break + 1


if max_no == 0:
  print(-1)
else:
  print(cnt_break)

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

using namespace std;
using llong = long long int;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.rbegin(); itr != x.rend(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int MOD = 1000000007;
const static int IINF = INT_MAX;
const static llong LINF = LLONG_MAX;
const static int dx[4] = {1, 0, -1, 0};
const static int dy[4] = {0, 1, 0, -1};

/* --------------- template start --------------- */
template <typename T> 
struct BinaryIndexTree { // [1, n]
    vector<T> array;
    int n;

    BinaryIndexTree(int _n) {
        array.resize(_n + 1, 0);
        n = _n;
    }

    T cumsum(int i) {
        T s = 0;
        while(i > 0) {
            s += array[i];
            i -= i & -i;
        }

        return s;
    }

    T sum(int i, int j) {
        T ret_i = cumsum(i - 1);
        T ret_j = cumsum(j);

        return ret_j - ret_i;
    }

    void add(int i, T x) {
        while (i <= n) {
            array[i] += x;
            i += i & -i;
        }
    }
};

template<typename T>
struct UnionFind {
    vector<int> par;
    vector<T> sz;

    UnionFind(int n) {
        par.resize(n);
        sz.resize(n);
        for (int i = 0; i < n; ++i) {
            par[i] = i;
            sz[i] = 1;
        }
    }

    int find_root(int x) {
        return par[x] == x ? x : par[x] = find_root(par[x]);
    }

    bool same(int x, int y) {
        return find_root(x) == find_root(y);
    }

    void unite(int x, int y) {
        x = find_root(x);
        y = find_root(y);
        if (x == y) return;
        
        if (sz[x] < sz[y]) swap(x, y);
        sz[x] += sz[y];
        par[y] = x;
    }

    T size_of_tree(int x) {
        return sz[find_root(x)];
    }
};
/* --------------- template end --------------- */

/* --------------- function start --------------- */
llong my_gcd(llong a, llong b) {
    return (a ? my_gcd(b % a, a) : b);
}
llong my_lcm(llong a, llong b) {
    return a * b / my_gcd(a, b);    
}

llong facmod(llong n) {
    if (n == 0) return 1;

    llong res = n;
    for (int i = n - 1; i > 0; --i) {
        res = (res * i) % MOD;
    }

    return res;
}
llong powmod(llong a, llong n) {
    llong res = 1;
    while (n > 0) {
        if (n & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        n >>= 1;
    }

    return res;
}
llong modinv(llong n) {
    return powmod(n, MOD - 2);
}
llong combmod(llong n, llong k) {
    llong res = 1;
    for (int i = 0; i < k; ++i) {
        res = (res * (n - i)) % MOD;
    }
    res = (res * modinv(facmod(k))) % MOD;

    return res;
}
/* --------------- function end --------------- */

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int A[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int k;
    cin >> k;
    cout << A[k - 1] << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;

public class Program
{
	public static void Main(string[] args)
	{
		var ss = new StreamScanner();
		//---------------------------------
		//var x = ss.Next<int>();
		//var y = ss.Next<int>();

			int x = ss.Next<int>();
			int y = ss.Next<int>();
			int z = ss.Next<int>();
			int c = 0;
			for (int i = x; i <= y; i++)
			{
			if(z%i==0){
				c += 1;
			}
			}
		Console.WriteLine(c);







		/*
		//????????????int, double, string?????????????????£????????????
		int i = ss.Next<int>();
		double d = ss.Next<double>();
		string s = ss.Next<string>();

		//?????°???????????????????????¨?????????????????????????????????????????????????´???????
		int[] array = ss.Next<int>(10);
		*/
		//---------------------------------
	}
}



public class StreamScanner
{
	private readonly char[] _c = { ' ' };
	private int _index = -1;
	private string[] _input = new string[0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

	public T Next<T>()
	{
		if (_index == _input.Length - 1)
		{
			_index = -1;
			while (true)
			{
				string rl = _sr.ReadLine();
				if (rl == null)
				{
					if (typeof(T).IsClass) return default(T);
					return (T)typeof(T).GetField("MinValue").GetValue(null);
				}
				if (rl != "")
				{
					_input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T[] Next<T>(int x)
	{
		var ret = new T[x];
		for (var i = 0; i < x; ++i) ret[i] = Next<T>();
		return ret;
	}

	public T[][] Next<T>(int x, int y)
	{
		var ret = new T[y][];
		for (var i = 0; i < y; ++i) ret[i] = Next<T>(x);
		return ret;
	}
}

Measured memory_bytes: 9916
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long N, A, B;
	cin >> N >> A >> B;
	long long ans = 0;
	long long AB = A + B;
	ans += (N / AB) * A;
	N %= AB;
	if(N < A)ans += N;
	else ans += A;
	if(A == 0)ans = 0;
	cout << ans << endl;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define N (200009)
#define LL long long
using namespace std;

LL n,ans,x,y;
pair<LL,LL>a[N];
multiset<LL>r,b;

int main()
{
	cin>>n;
	for (int i=1; i<=n; ++i)
	{
		cin>>x>>y;
		if (x>y) swap(x,y);
		b.insert(x); r.insert(y);
		a[i]=make_pair(x,y);
	}
	sort(a+1,a+n+1);
	ans=(*b.rbegin()-*b.begin())*(*r.rbegin()-*r.begin());
	for (int i=1; i<=n; ++i)
	{
		b.erase(b.find(a[i].first)); r.insert(a[i].first);
		r.erase(r.find(a[i].second)); b.insert(a[i].second);
		ans=min(ans,(*b.rbegin()-*b.begin())*(*r.rbegin()-*r.begin()));
	}
	cout<<ans<<endl;
}

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//infinity
#define INTINF 2000000000
#define LONGINF 2000000000

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define MAX_N 1000000
int par[MAX_N];

void init(int n){
	REP(i, n) par[i] = i;
}

int root(int x){
	if(par[x] == x){
		return x;
	}else{
		return par[x] = root(par[x]);
	}
}

bool same(int x, int y){
	return root(x) == root(y);
}

void unite(int x, int y){
	x = root(x);
	y = root(y);
	if(x==y) return;
	par[x] = y;
}

int main(){
	int n, m; cin >> n >> m;
	int p[n];
	REP(i, n){
		int t;
		cin >> t;
		p[i] = t - 1;
	}
	init(n);
	REP(i, m){
		int x, y; cin >> x >> y;
		unite(x-1, y-1);
	}

	int ans = 0;
	REP(i, n){
		if(same(p[i], p[p[i]])) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int a, b;
int main() 
{
    cin >> a >> b;
    if (a > 0 && b > 0) 
	{
        cout << "Positive" << endl;
    } else if (max(a, b) >= 0 && min(a, b) <= 0 || a == 0 || b == 0) 
	{

        cout << "Zero" << endl;
    } else
        if ((abs(min(a, b)) - abs(max(a, b))) % 2 == 0)
            cout << "Negative" << endl; 
		else 
        	cout << "Positive" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int N, K;

int main(void){
    
    scanf("%d %d", &N, &K);
    vector<ll> a, b;
    for(int i = 0; i < N; ++i){
        ll x; scanf("%lld", &x);
        if(x >= 0) a.push_back(x);
        else b.push_back(abs(x));
    }
    reverse(b.begin(), b.end());
    
    int kk = K;
    ll ans = LLONG_MAX;
    while(kk >= 0){
        int l = kk, r = K - kk; --kk;
        if(b.size() < l || a.size() < r) continue;
        
        if(l == 0) ans = min(ans, a[r - 1]);
        else if(r == 0) ans = min(ans, b[l - 1]);
        else ans = min(ans, min(a[r - 1], b[l - 1]) * 2 + max(a[r - 1], b[l - 1]));
    }
    printf("%lld\n", ans);
    
    return 0;
}

Measured memory_bytes: 1656
package main

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

var sc = bufio.NewScanner(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
    defer w.Flush()

    sc.Split(bufio.ScanWords)
    k := nextInt()
    a := nextInt()
    b := nextInt()

    f := false
    for i := a; i <= b; i++ {
        if i%k == 0 {
            f = true
        }
    }

    if f {
        fmt.Fprintln(w, "OK")
    } else {
        fmt.Fprintln(w, "NG")
    }
}


Measured memory_bytes: 1760
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			}
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					System.out.printf("#");
				}
				System.out.printf("\n");
			}
			System.out.printf("\n");
		}
	}
}



Measured memory_bytes: 65108
package main

import (
	"fmt"
//	"strconv"
//	"sort"
//	"math"
//	"regexp"
)


var a,b,c string

func main(){
	fmt.Scan(&a,&b,&c)

	fmt.Println(string(a[0])+string(b[0])+string(c[0]))
}

Measured memory_bytes: 512