akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)

int main(int argc, char const *argv[])
{
	int p, q, r; cin >> p >> q >> r;
	printf("%d\n", p + q + r - max({p, q, r}));
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <algorithm>

typedef long long ll;
#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

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



#define MOD 998244353

ll mypow(ll a, ll b) {
	a %= MOD;
	ll res = 1;
	while (b > 0) {
		if (b % 2 == 1)res = res * a % MOD;
		a = a * a % MOD;
		b /= 2;
	}
	return res;
}

ll f[210000];

void cominit() {
	f[0] = 1;
	REP(i, 200000)f[i + 1] = f[i] * (i + 1) % MOD;
}

ll nCr(ll n, ll r) {
	if (n < r)return 0;
	if (n < 0 or r < 0)return 0;
	return f[n] * mypow(f[r] * f[n - r], MOD - 2) % MOD;
}

int main()
{
	cominit();

	ll n, m, k;
	cin >> n >> m >> k;
	long long int sum = 0;

	rep(i, k+1) {
		ll res = mypow(m - 1, n - i - 1);
		res = (m * res) % MOD;
		res = res * nCr(n - 1, i) % MOD;
		sum = (res + sum) % MOD;
	}

	cout << sum << endl;
}



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

using namespace std;

int main(){

    int N; cin >> N;
    string S; cin >> S;
    int res = 1;
    for(int i=1; i<N; i++){
        if(S[i]!=S[i-1]){
            res += 1;
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod=1e9+7;
ll n, m, a, b, s;
ll f[1000005];
pair<ll,ll> exgcd(ll a, ll b){
	if(b==0) return {1, 0};
	auto p=exgcd(b, a%b);
	return {p.second, p.first-a/b*p.second};
}
ll inv(ll x){
	auto p=exgcd(x, mod);
	return (p.first%mod+mod)%mod;
}
ll C(ll p, ll q){
	return f[p]*inv(f[q])%mod*inv(f[p-q])%mod;
}
int main(){
	cin>>n>>m>>a>>b;
	f[0]=1;
	for(int i=1;i<=m+n;i++) f[i]=(f[i-1]*i)%mod;
	for(ll i=0;i<=n-a-1;i++){
		s+=C(i+b-1, b-1)*C(m+n-b-i-2, m-b-1)%mod;
		s=s%mod;
	}
	cout<<s;
	//i, b
	//i+b-1, b-1
	//n-i-1, m-b
	//m+n-b-i-2, m-b-1
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)
#define clrg(i, l, r) for(int i=(int)(l);i<(int)(r);i++)vis[i]=0,v[i].clear();
int power(int x, unsigned int y){int res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
int powermod(int x, unsigned int y, int p){int res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<< endl;}}
#define clr(a,x) memset(a,x,sizeof(a))
#define rr(v) for(auto &val:v)
#define print(v) for (const auto itr : v){cout<<itr<<' ';}cout<<"\n";
#define ln length()
#define sz size()
#define mod 1000000007
#define elif else if
int32_t main(){
  int n; cin>>n;
  cout<<(n?0:1)<<"\n";
   return 0;
}
/*
Edge cases? n=1? a[i]<=0?
long vs int? 1LL? 64bits?
Re-read problem. Is it as easy as it seems?
KEEP CORRECTING AND SUBMITTING!
*/


Measured memory_bytes: 3620
/*
	Author: Luis Manuel D?az Bar?n (LUISMO)
	Problem: S - DigitSum
	Online Judge: AtCoder
	Idea: Digit DP. dp[i][j] - the amount of number-strings of lenght i such that the digSum of its digits leaves remainder rem with D.
	Numbers with leading zeros are managed as if such zeroes were "trimmed" eg. 00023 would mean
	23
*/
#include<bits/stdc++.h>
// Types
#define ll long long
#define ull unsigned long long
// IO
#define sf scanf
#define pf printf
#define mkp make_pair
#define fi first
#define se second
#define endl "\n"

using namespace std;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll inf = 1e16 + 3;
const int mod = 1e9 + 7;
const int lim = 2e4 + 2;


string str;
ll D;


// dp[i][j] - the amount of number-strings of lenght i such that the digSum of its digits leaves remainder rem with D
ll dp[lim][102];
bool mark[lim][102];

ll DynamicProgramming(int len, int rem)
{	
	if(len == 1)
	{		
		int cnt = 0;		
		for(int i = 0; i <= 9; i++)
			if(i % D == rem)
				cnt++;
		return cnt;
	}

	if(mark[len][rem])
		return dp[len][rem];

	// for each possible ending digit
	for(int dig = 0; dig <= 9; dig++)
	{
		int r = dig % D;
		int rr = (rem - r + D) % D; 
		ll k = DynamicProgramming(len - 1, rr);

		dp[len][rem] = (dp[len][rem] + k) % mod;
	}

	mark[len][rem] = true;
	return dp[len][rem];
}


void BruteForce()
{
	if(str.size() > 4)
		return;
	ll N = 0;
	ll ten = 1;
	for(int i = 0; i < str.size(); i++)
	{
		int idx = str.size() - 1 - i;
		N += ten * (str[idx] - '0');
		ten*= 10;
	}
	// BRUTE FORCE
	ll sansw = 0;
	for(int i = 1; i <= N; i++)
	{
		ll digSum = 0;
		int k = i;
		while(k > 0)
		{
			digSum += k % 10;
			k /= 10;
		}

		if(digSum % D == 0)
			sansw++;

		sansw %= mod;
	}

	cout << sansw << endl;
}

void solve()
{
	cin >> str >> D;
	// lenght of the number
	int sz = str.size();

	ll answ = 0;
		
	int digSum = 0; // keeps the sum of the first digits from left to right
	for(int i = 0; i < sz - 1; i++)
	{
		// current digit
		int d = str[i]-'0';
		// for each possible value (from 0 to d - 1)
		for(int j = 0; j < d; j++)
		{
			// remainder to search
			int r = (digSum + j) % D;

			ll k = DynamicProgramming(sz - 1 - i, (D - r)%D);			
			// update answer
			answ = (answ + k) % mod;
		}
		// add the current digit to the sum
		digSum = (digSum + d) % mod;
	}
	// checking the sum with the last digit
	for(int i = 0; i <= str[sz-1]-'0'; i++)
		if((digSum + i) % D == 0)
			answ++;
	// removing case 00000000....0000
	answ--;
	// printing answer
	cout << (answ + mod) % mod << endl;

	//cerr << "Brute Force Solution:" << endl;
	//BruteForce();
}

void fastIO()
{
	cin.sync_with_stdio(false);
	cin.tie(0);
}

void IO()
{
	if(fopen("d:\\lmo.in","r") != NULL)
	{
		freopen("d:\\lmo.in","r",stdin);
	}
	else if(fopen("/media/Beijing/lmo.in","r") != NULL)
	{
		freopen("/media/Beijing/lmo.in", "r", stdin);
	}
}

int main()
{
	IO();

	fastIO();

	solve();
}


Measured memory_bytes: 10240
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
ll a[100000];
int n;
int sign(int x){
  if(x==0) return 0;
  if(x<0) return -1;
  return 1;
}
int solve(){
  int cnt=1;
  int i=0;
  while(i<n){
    int sgn=sign(a[i+1]-a[i]);
    while(i<n){
      if(sign(a[i+1]-a[i])!=0){
	if(sgn==0)
	  sgn=sign(a[i+1]-a[i]);
	else if(sign(a[i+1]-a[i])!=sgn){
	  break;
	}
      }
      ++i;
    }
    ++i;
    if(i<n)
      ++cnt;
  }
  return cnt;
}
int main(){
  scanf("%d",&n);
  for(int i=0;i<n;++i)
    scanf("%d",a+i);

  printf("%d\n",solve());
  return 0;
}


Measured memory_bytes: 1024
//#include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

int dp[1000001] = {};
int ki[1000001] = {};

int main(void) {
	int poll[181] = {};

	FOR(i, 1, 180) {
		poll[i] = i * (i + 1)*(i + 2);
		poll[i] /= 6;
		//cout << poll[i] << endl;
	}
	FOR(i, 2, 1000000) {
		dp[i] = INF;
		ki[i] = INF;
	}
	dp[1] = 1;
	ki[1] = 1;
	FOR(i, 1, 1000000) {
		FOR(j, 1, 180) {
			if (i - poll[j] > 0) {
				dp[i] = min(dp[i], dp[i - poll[j]] + 1);
			}
			else if (i == poll[j]) {
				dp[i] = 1;
			}
			else {
				break;
			}
			
		}
	}
	FOR(i, 1, 1000000) {
		for(int j=1;j<=180;j+=4) {
			if (i - poll[j] > 0) {
				ki[i] = min(ki[i], ki[i - poll[j]] + 1);
			}
			else if (i == poll[j]) {
				ki[i] = 1;
			}
			else {
				break;
			}

		}
	}
	/*FOR(i, 1, 1000000) {
		cout << i << " " << ki[i] << endl;
	}*/
	while (1) {
		int n;
		int first = 0;
		int second = 0;

		cin >> n;
		if (n == 0) {
			break;
		}
		cout << dp[n] << " " << ki[n] << endl;

	}

	return 0;
}


Measured memory_bytes: 10912
import java.util.Scanner;
import java.util.stream.Stream;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] list = Stream.of(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		int A = list[0];
		int B = list[1];
		int T = list[2];
		int result=0;
		
		result = (int) ((T+0.5)/A)*B;
		
		System.out.println(result);
	}
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

typedef pair<int, int> pii;

int main() {
	int n, m;
	while (cin >> n >> m, n || m) {
		vector<vector<int> > cnt(m, vector<int>(n, INF));
		vector<string> str(m);
		REP(i, m) cin >> str[i];
		
		priority_queue<pair<int, pii>, vector<pair<int, pii> >, greater<pair<int, pii> > > pq;
		REP(i, m) {
			pq.push(make_pair(str[i][0] == '#', pii(i, 0)));
			pq.push(make_pair(str[i][n - 1] == '#', pii(i, n - 1)));
		}
		REP(i, n) {
			pq.push(make_pair(str[0][i] == '#', pii(0, i)));
			pq.push(make_pair(str[m - 1][i] == '#', pii(m - 1, i)));
		}
		
		while (!pq.empty()) {
			pair<int, pii> now = pq.top();
			pq.pop();
			
			int x = now.second.second, y = now.second.first;
			if (cnt[y][x] != INF) continue;
			cnt[y][x] = now.first;
			
			if (str[y][x] == '&') {
				cout << cnt[y][x] << endl;
				break;
			}
			
			int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
			REP(i, 4) {
				int nx = x + dx[i], ny = y + dy[i];
				if (!(nx >= 0 && nx < n && ny >= 0 && ny < m)) continue;
				pq.push(make_pair(cnt[y][x] + (str[y][x] != '#' && str[ny][nx] == '#'), pii(ny, nx)));
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1532
//By Bibi
///                 .-~~~~~~~~~-._       _.-~~~~~~~~~-.
///             __.'              ~.   .~              `.__
///           .'//                  \./                  \`.
///        .'//                     |                     \`.
///       .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \`.
///     .'//.-"                 `-.  |  .-'                 "-.\`.
///   .'//______.============-..   \ | /   ..-============.______\`.
/// .'______________________________\|/______________________________`.
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define dep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
const int MAXN=1e5+7;
typedef long long ll;
int read(){
	int sum=0,flag=1;
	char c;
	for(;c<'0'||c>'9';c=getchar())if(c=='-') flag=-1;
	for(;c>='0'&&c<='9';c=getchar())sum=(sum<<1)+(sum<<3)+c-'0';
	return sum*flag;
}
int n;
int a[MAXN];
int f1[MAXN],f2[MAXN];
int maxx;
int id1,id2,id3,id4;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read();
	rep(i,1,n) a[i]=read();
	for(int i=1;i<=n;i+=2){
		f1[a[i]]++;
		if(f1[a[i]]>maxx) maxx=f1[a[i]],id1=a[i];
	}
	maxx=0;
	for(int i=2;i<=n;i+=2){
		f2[a[i]]++;
		if(f2[a[i]]>maxx&&a[i]!=id1) maxx=f2[a[i]],id2=a[i];
	}
	maxx=0;
	for(int i=2;i<=n;i+=2){
		if(f2[a[i]]>maxx) maxx=f2[a[i]],id3=a[i];
	}
	maxx=0;
	for(int i=1;i<=n;i+=2){
		if(f1[a[i]]>maxx&&a[i]!=id3) maxx=f1[a[i]],id4=a[i];
	}
	printf("%d\n",min(n-f1[id1]-f2[id2],n-f1[id4]-f2[id3]));
	return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = n - 1; i >= 0; i -= 2) cout << a[i] << " ";
    for (int i = n & 1; i < n; i += 2) cout << a[i] << " ";
    cout << "\n";
    return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
int n,m;
int sum;
int a[105];
int main()
{
    scanf("%d%d",&n,&m);
    sum=0;
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]*4*m>=sum) cnt++;
    }
    if(cnt>=m) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
int main(){
    fastio
    int n , k ; 
    cin >> n >> k ; 
    int ans = 0 ;
    for(int i = 0; i < n; i++){
        int x ; 
        cin >> x ; 
        if ( x >= k ) ans++ ;
    }
    cout << ans << endl;
    return 0 ;
}



Measured memory_bytes: 256
import java.io.*;

class Main{
    
        public static int maxv(int x, int y){
            if(x >= y){
                return x;
            }else{
                return y;
            }
        }

        public static int minv(int x, int y){
            if(x <= y){
                return x;
            }else{
                return y;
            }
        }

    public static void main(String[] args){

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try {       
                int N = Integer.parseInt(reader.readLine());;
		    	String line = reader.readLine();
			    String[] strAry = line.split(" ");
                
			    int[] a = new int[N];
			
			    for (int i = 0;i < N; i++){
				    a[i] = Integer.parseInt(strAry[i]);
			    }

                int count = 0;

                for(int i = 0; i < N; i ++){
                    int minj = i;
                    for(int j = i; j < N; j++){
                        if(a[j] < a[minj]){
                            minj = j;
                        }
                    }
                     int k = a[i];
                     a[i] = a[minj];
                     a[minj] = k;
                     if(minj != i){
                         count += 1;
                     }
                }
            
                for(int i = 0; i < N; i++){
                    System.out.print(a[i]);
                    if(i != (N - 1)){
                        System.out.print(" ");
                    }
                }
                System.out.println();

                System.out.println(count);
                            
        } catch (IOException e) {
            //TODO: handle exception
            System.out.println(e);
        }
    }
}

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

using namespace std;

int main()
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(NULL);
	int a , b , c , d; 
	cin >> a >> b >> c >> d ;
	bool battle = true ; 
	while(battle)
	{
		c -= b ; 
		if(c <= 0)
		{
			cout << "Yes" ; 
			battle = false ; 
			break ;
		}
		a -=d ;
		if(a <= 0)
		{
			cout << "No" ; 
			battle = false ; 
			break ; 
		}  
	} 

}



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

signed main() {
	int a, b, k;
	cin >> a >> b >> k;
	for(int i = min(a,b); i >= 1; i--){
		if(a%i == 0 && b%i == 0){
			k--;
			if(k == 0){
				cout << i << endl;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A, B;
		A = sc.nextInt();
		B = sc.nextInt();

		System.out.println(A > 8 || B > 8 ? ":(" : "Yay!");
	}
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T,class U>
istream& operator >> (istream&is, P<T,U>&p){
  is >> p.first >> p.second;
  return is;
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v){
    is >> e;
  }
  return is;
}

int main(){
  int h,w; cin >> h >> w;
  int a[1000] = {};
  for(int i = 0; i < h; ++i){
    for(int j = 0; j < w; ++j){
      char c; cin >> c;
      a[int(c)]++;
    }
  }
  int cnt1=0,cnt4=0;
  for(int i = 0; i < 1000; ++i){
    cnt1 += a[i]%2;
    cnt4 += a[i]/4;
  }
  cout << (cnt1 == (h%2)*(w%2) && 4*cnt4 >= h*w-(h%2)*(w%2)-(h%2)*w-(w%2)*h ? "Yes" : "No") << endl;
}



Measured memory_bytes: 3640
#include <iostream>
using namespace std;
int main(){
    int a,b,c,tmp;
    cin >> a >> b >> c;
    if(a > b){
       tmp = a;
       a = b;
       b = tmp;
    }
    if(b > c){
       tmp = b;
       b = c;
       c = tmp;
    }
    if(a > b){
       tmp = a;
       a = b;
       b = tmp;
    }
   cout << a << " " << b << " " << c << endl;
   return 0;
}



Measured memory_bytes: 3080
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>

using namespace std;

#define N_MAX 100001

void solv()
{
	int N; scanf("%d", &N);
	int s[N_MAX]; 
	for (int i = 0; i < N; i++){
		scanf("%d", s + i);
	}

	long long int ret = 0;
	for (int i = 1; i < N; i++){
		long long int suml = 0, sumr = 0;
		for (int j = 1; j < N; j++){
			if (i*j >= N || (N - 1 - i*j) < 0) {
				break;
			}
			if (i*j == (N - 1 - i*j)){
				break;
			}
			if (i*(j + 1) == (N - 1 - i*j)){
				suml += s[i*j];
				sumr += s[N - 1 - i*j];
				ret = max(ret, suml + sumr);
				break;
			}
			if ((N - 1 - i*j) < i){
				break;
			}
			suml += s[i*j];
			sumr += s[N - 1 - i*j];
			ret = max(ret, suml + sumr);
		}
	}

	printf("%lld", ret);

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

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

const int mod=1e9+7;

int main(){
    int h,w;
    cin>>h>>w;
    string s,ans;
    for(int i=1; i<=h; ++i){
        for(char j=1; j<=w; ++j){
            cin>>s;
            if(s=="snuke"){
                ans+=char(j+64)+to_string(i);
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
	
	int n;
	double xa,ya,ra;
	double xb,yb,rb;
	double s;
	
	cin>>n;
	while(n>0){
		cin>>xa>>ya>>ra>>xb>>yb>>rb;
		
		s=sqrt(pow(xa-xb,2)+pow(ya-yb,2));
		
		if(s+rb<ra)
			cout<<2<<endl;
		else if(s+ra<rb)
			cout<<-2<<endl;
		else if(s<=ra+rb)
			cout<<1<<endl;
		else
			cout<<0<<endl;
		n--;
	}
	
	
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main(){
    ll a,b,ans=0;
    cin>>a>>b;
    if(a>b){
        ans+=a;
        a--;
    }else{
        ans+=b;
        b--;
    }
    if(a>b){
        ans+=a;
        a--;
    }else{
        ans+=b;
        b--;
    }
    cout<<ans<<endl;
    
}
   



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;


typedef long long ll;
typedef pair<ll, ll> P;

const ll mod = 1000000007;
ll fact[200200];
ll invfact[200200];


inline ll take_mod(ll a){
    return (a % mod + mod) % mod;
}

inline ll add(ll a, ll b){
    return take_mod(a+b);
}

inline ll sub(ll a, ll b){
    return take_mod(a-b);
}


inline ll mul(ll a, ll b){
    return take_mod(a * b);
}

inline ll pow(ll x, ll n){
    ll res = 1LL;
    while(n > 0){
        if(n & 1) res = mul(res, x);
        x = mul(x, x);
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x){
    return pow(x, mod-2);
}

// nは上限
void make_fact(ll n){
    fact[0] = 1;
    ll res = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = res;
        res = mul(res, i+1);
    }
}

// nは上限
void make_invfact(ll n){
    invfact[0] = 1;
    invfact[n] = mod_inv(fact[n]);
    for(int i = n-1; i >= 1; i--){
        invfact[i] = mul(invfact[i + 1], i + 1);
    }
}

ll perm(ll n, ll k){
    return mul(fact[n], invfact[n-k]);
}

ll comb(ll n, ll k){
    if(n < k){
        return 0;
    }
    return mul(mul(fact[n], invfact[n-k]), invfact[k]);
}


ll po2[201000];
ll b[201000], w[201000];


void output(ll x, ll y){
    cout << mul(mod_inv(x), y) << endl;
}


int main(){
    ll B, W;
    cin >> B >> W;

    ll x = 1;
    for(int i = 0; i < 201000; i++){
        po2[i] = x;
        x = mul(x, 2LL);
    }

    make_fact(B+W+10);
    make_invfact(B+W+10);

    w[0] = b[0] = 0;
    for(int i = 1; i <= B+W; i++){
        b[i] = mul(comb(i-1, B-1), po2[B+W-i]) + b[i-1];
        w[i] = mul(comb(i-1, W-1), po2[B+W-i]) + w[i-1];
        x = add(sub(po2[B+W], b[i-1]), w[i-1]);
        output(po2[B+W+1], x);
    }



    return 0;
}


Measured memory_bytes: 9984
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	var z, o int
	for _, r := range s {
		switch r {
		case '0':
			z++
		case '1':
			o++
		}
	}

	var n int
	if z < o {
		n = z
	} else {
		n = o
	}
	fmt.Println(n * 2)
}


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

int main() {
    int grid[3][3];
    for (int i = 0; i < 3; i++) {
        cin >> grid[i][0] >> grid[i][1] >> grid[i][2];
    }
    
    int sum_all = 0;
    int sum_cross = 0;
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            sum_all += grid[i][j]; 
            if (i == j) sum_cross += grid[i][j];
        }
    }

    string ans = sum_all == sum_cross * 3 ? "Yes" : "No";
    cout << ans << endl;
}

Measured memory_bytes: 256
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-04-11 17:57:52
*/

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

#define all(x) (x).begin(),(x).end()
#define rev(x) greater<x>()
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

LL modpower(LL n, LL m, LL mod)
{
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod)
{
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod)
{
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

int gcd(int k, int l)
{
    if (l > 0) return gcd(l, k%l);
    else return k;
}

struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n) {
        for (int i = 0; i < n; i++) par[i] = i;
    }

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

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

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

int main()
{
    int n;
    cin >> n;
    vector<int> c(n-1), s(n-1), f(n-1);
    for (int i = 0; i < n-1; i++)
        cin >> c[i] >> s[i] >> f[i];

    for (int i = 0; i < n; i++) {
        int t = 0;
        for (int j = i; j < n-1; j++) {
            if (t < s[j]) t = s[j];
            else if (t % f[j] == 0) ;
            else t += f[j] - t%f[j];

            t += c[j];
        }

        cout << t << endl;
    }

    return 0;
}


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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
	summon_tourist;

	string S; cin >> S;
	if(S[1] == 'B') S[1] = 'R';
	else S[1] = 'B';
	cout << S << ln;
}


Measured memory_bytes: 3608
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, M = getNM()
dist = [[] for i in range(N)]
for i in range(M):
    l, r, d = getNM()
    dist[l - 1].append([r - 1, d])
    dist[r - 1].append([l - 1, -d])

dis = [float('inf')] * N

pos = deque([i for i in range(N)])
while len(pos) > 0:
    u = pos.popleft()
    # 始めの第一歩
    if dis[u] == float('inf'):
        dis[u] = 0
    # 行き先の位置が未確定なら確定させる
    # 既に確定しているなら判定
    for to, d in dist[u]:
        if dis[to] == float('inf'):
            dis[to] = dis[u] + d
            pos.appendleft(to)
        else:
            if dis[u] + d != dis[to]:
                print('No')
                exit()
print('Yes')

Measured memory_bytes: 143928
n=int(input())
s=[]
h=[]
c=[]
d=[]
for i in range (0,n):
    a,b=input().split()
    b=int(b)
    if a=="S":
        s.append(b)
    if a=="H":
        h.append(b)
    if a=="C":
        c.append(b)
    if a=="D":
        d.append(b)
for i in range(1,14):
  if not (i in s):
    print("S",i)
for i in range(1,14):
    for j in range(0,len(h)):
        if i==h[j]:
            break
        elif j==len(h)-1:
            print("H",i)
for i in range(1,14):
    for j in range(0,len(c)):
        if i==c[j]:
            break
        elif j==len(c)-1:
            print("C",i)
for i in range(1,14):
    for j in range(0,len(d)):
        if i==d[j]:
            break
        elif j==len(d)-1:
            print("D",i)


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

int main(){
  long long n,a[5];
  cin>>n>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
  sort(a,a+5);
  long team;
  if(n%a[0]==0){
    team=n/a[0];
  }else{
    team=n/a[0] +1;
  }

  long long ans = team+4;
  cout<<ans;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 30)
using namespace std;

int main(){
    int n, l;
    vector<string> vi;
    string ans;
    cin >> n >> l;
    rep(i,n){
        string inp;
        cin >> inp;
        vi.pb(inp);
    }
    sort(all(vi));
    rep(i,n){
        ans+=vi[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>

using namespace std;

#define MN 15

struct E {
    int from, to;
    double dist;
    E() {};
    E(int from, int to, double dist) : from(from), to(to), dist(dist) {}
};

struct V {
    double dist;
    int w;
};


map<int, int> index;
map<int, int> rindex;
V G[MN];

struct A {
    double v;
    vector<int> path;
    bool operator<(const A& o) const {
        return v < o.v;
    }
    A() {
        v = 1e10;
    }
};

int n;
double cost(int from, int to, int used) {
    double w = 0;
    for (int i = 0; i < n; i++) {
        if (used & (1<<i)) {
            w += G[i].w;
        }
    }
    return abs(G[from].dist - G[to].dist) / ( 2000.0 / (70.0 + w) );
}

A memo[MN][(1<<MN)];
A solve(int m, int used) {
    if (memo[m][used].v != 1e10) return memo[m][used];
    if (used == (1<<n) - 1) {
        A ans;
        ans.v = 0;
        ans.path.push_back(m);
        return ans;
    }
    A ans;
    for (int i = 0; i < n; i++) {
        if (not (used & (1<<i))) {
            A a = solve(i, used | (1<<i));
            a.v += cost(m, i, used);
            ans = min(ans, a);
        }
    }
    ans.path.push_back(m);
    return memo[m][used] = ans;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        int number, dist, w; cin >> number >> dist >> w;
        index[number] = i;
        rindex[i] = number;
        G[i].dist = dist;
        G[i].w = w * 20;
    }
    A ans;
    for (int i = 0; i < n; i++) {
        A c = solve(i, (1<<i));
        ans = min(ans, c);
    }
    bool isFirst = true;
    for (int i = ans.path.size() - 1; i >= 0; i--) {
        if (isFirst) {
            isFirst = false;
            cout << rindex[ans.path[i]];
        } else {
            cout << ' ' << rindex[ans.path[i]];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 27628
import javax.print.DocFlavor;
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        char[] s = next().toCharArray();
        int count = 0;
        for(int i=0; i<s.length/2; i++){
            if(s[i] != s[s.length-i-1]){
                count++;
            }
        }
        println(count);
    }

    static long a(long n){
        return n < 2L ? 1L : n*a(n-2);
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


Measured memory_bytes: 23892
#include <iostream>
#include <map>
#include <queue>
#include <cstdlib>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int to[13][5] = {
	{2,-1},
	{2,5,-1},
	{0,1,3,6,-1},
	{2,7,-1},
	{5,-1},
	{1,4,6,9,-1},
	{2,5,7,10,-1},
	{3,6,8,11,-1},
	{7,-1},
	{5,10,-1},
	{6,9,11,12},
	{7,10,-1},
	{10,-1}
};
int X[]={2,1,2,3,0,1,2,3,4,1,2,3,2};
int Y[]={0,1,1,1,2,2,2,2,2,3,3,3,4};

int solve(vector<int> data){
	queue< vector<int> > Q;
	map<vector<int>,int> done;
	Q.push(data);
	done[Q.front()] = 0;
	
	while(Q.size()){
		vector<int> q = Q.front(); Q.pop();
		int dif = 0;
		rep(i,13)if(q[i])dif += abs(X[q[i]]-X[i])+abs(Y[q[i]]-Y[i]);
		if(dif==0)return done[q];;
		if(dif+done[q]>20)continue;
		int curcost = done[q];
		rep(x,13){
			if(q[x] == 0){
				rep(i,5){
					if(!~to[x][i])break;
					swap(q[x],q[to[x][i]]);
					if(done.find(q) == done.end() ){
						done[q] = curcost+1;
						Q.push(q);
					}
					swap(q[x],q[to[x][i]]);
				}
			}
		}
	}
	return 21;
}
int main(){
	vector<int> data(13);
	while(1){
		rep(i,13)if(!(cin >> data[i]))return 0;
		int ans = solve(data);
		if(ans > 20)cout << "NA" << endl;
		else cout << ans << endl;
	}
}

Measured memory_bytes: 3348
#include<bits/stdc++.h>
#define fst first
#define snd second
using namespace std;
const int maxn = 1e3 + 10;
typedef pair<int,int> pii;
typedef long long ll;

int d[maxn];
int vis[maxn], par[maxn];
vector<int> g[maxn];
vector<int> ans;
void getans(int st) {
    memset(vis,0,sizeof vis);
    queue<int> que;
    que.push(st);
    while(!que.empty()) {
        int u = que.front();
        que.pop();
        for(auto v : g[u]) if(!vis[v]) {
//            printf(">> %d %d\n",u,v);
            vis[v] = 1;
            par[v] = u;
            que.push(v);
        }
        if(vis[st]) break;
    }
    if(!vis[st]) return;
    vector<int> tans;
    tans.push_back(st);
    int u = par[st];
    while(u != st) {
        tans.push_back(u);
        u = par[u];
    }
    if(ans.size() == 0 || tans.size() < ans.size()) ans = tans;
}

int main() {
    int n, m;
    scanf("%d%d",&n, &m);
    for(int i = 1;i <= m;++i) {
        int a,b;
        scanf("%d%d",&a,&b);
        g[a].emplace_back(b);
        ++d[b];
    }
    queue<int> que;
    for(int i = 1;i <= n;++i) if(!d[i]) que.push(i);
    while(!que.empty()) {
        int cur = que.front();
        que.pop();
//        printf("%d\n",cur);
        vis[cur] = 1;
        for(auto u : g[cur]) {
            --d[u];
            if(!d[u]) que.push(u);
        }
    }
    int st = -1;
    for(int i = 1;i <= n;++i) if(!vis[i]) st = i;
    if(st == -1) return 0 * puts("-1");
    else {
        for(int i = 1;i <= n;++i) if(d[i]) getans(i);
        printf("%d\n",(int)ans.size());
        for(auto u : ans) printf("%d\n",u);
    }
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

#define debug(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(int i=0;i<(n);i++)
#define fori(a,b,i) for(int i=(a);i<=(b);i++)
#define ford(a,b,i) for(int i=(a);i>=(b);i--)
#define fast_io ios_base::sync_with_stdio(false) , cin.tie(NULL);


#define INF 0x3f3f3f3f
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define eps  1e-9

#define fir first
#define sec second
#define pb push_back
#define mp make_pair

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MII;
typedef set<int> SI;
typedef long long int llint;


int main()
{
	llint a, x, b;
	cin>>x;
	loop(i, 1000){
		loop(j, 1000){
			//if(i < j) continue;
			if(pow(i, 5) - pow(j, 5) == x){
				a = i;
				b = j;
				cout<<a<<" "<<b;
				return 0;
			}
			else if(pow(i, 5) + pow(j, 5) == x){
				a = i;
				b = -j;
				cout<<a<<" "<<b;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3984
/*  -*- coding: utf-8 -*-
 *
 * a.cc: 
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 1000;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  string s;
  cin >> s;
  int n = s.size();

  int nn = 0, sn = 0, en = 0, wn = 0;
  for (int i = 0; i < n; i++)
    switch (s[i]) {
    case 'N': nn++; break;
    case 'E': en++; break;
    case 'W': wn++; break;
    case 'S': sn++; break;
    }

  if (((nn > 0 && sn > 0) || (nn == 0 && sn == 0)) &&
      ((en > 0 && wn > 0) || (en == 0 && wn == 0)))
    puts("Yes");
  else
    puts("No");
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <string>
#include <utility>
#include <map> 
#include <queue>
#include <stack>
#include <iomanip>
#include <sstream>
#define MP make_pair
#define PB push_back
#define S size()
#define B begin()
#define E end()
#define ll long long
#define REP(i,a,n) for(ll i=a; i<n; ++i)
#define RED(i,n,a) for(ll i=n; i>=a; --i)
#define m9 1000000007
#define endl "\n"
#define F first
#define SE second
#define ld long double



using namespace std;

ll gcd(ll a, ll b){
    if(a%b==0){
        return b;
    }
    else{
        return gcd(b, a%b);
    }
}
ld area(ld x1, ld y1, ld x2, ld y2, ld x3, ld y3){
    return abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
}

vector <ll> v;

void generate(string s){
    stringstream obj(s);
    ll x=0;
    obj>>x;
    if(x<=1e6){
        v.PB(x);
        generate(s+"1"), generate(s+"0");
    }
}

int main(){
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    ll h, w;
    cin>>h>>w;
    vector < vector <char> > v(h, vector <char> (w));
    ll dp[h][w];
    REP(i,0,h){
        REP(j,0,w){
            cin>>v[i][j];
            dp[i][j]=0;
        }
    }
    dp[0][0]=1;
    for(ll i=0; i<h; ++i){
        for(ll j=0; j<w; ++j){
            if(i+1<h){
                if(v[i][j]=='.' && v[i+1][j]=='.'){
                    dp[i+1][j]=(dp[i+1][j]+dp[i][j])%m9;
                    //dp[i+1][j]%=m9;
                }
            }
            if(j+1<w){
                if(v[i][j+1]=='.' && v[i][j]=='.'){
                    dp[i][j+1]=(dp[i][j+1]+dp[i][j])%m9;
                    
                }
            }
        }
    }
    cout<<dp[h-1][w-1]%m9;
    
    
    
}


Measured memory_bytes: 9088
using System;
class test{
    static void Main(){
        int a,b;
        string[] str = Console.ReadLine().Split(' ');
        a=int.Parse(str[0]);
        b=int.Parse(str[1]);
        if(a<b){
            Console.WriteLine("a < b");
        }else if(a>b){
            Console.WriteLine("a > b");
        }else{
            Console.WriteLine("a == b");
        }
    }
}


Measured memory_bytes: 8856
N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
cnt = 0

for i in range(N-2):
  for j in range(i+1, N):
    for k in range(j+1, N):
      if L[i] != L[j] != L[k] and L[i] + L[j] > L[k]:
        cnt += 1
        
print(cnt)

Measured memory_bytes: 9200
#include <iostream>
#include <cstdlib>
#include <cstring>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i > (b); i--)

using namespace std;

int main(void) {

	char s[100005];

    scanf("%s", s);

    int zero = 0;
    int now = 0;
    REP(i, 0, (int)strlen(s)) {

    	if ( (s[i] - '0') == now ) zero++;
    	now ^= 1;
    }
    
    printf("%d\n", min(zero, (int)strlen(s) - zero));

	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int D, T, S;
    
    cin>>D>>T>>S;
    
    if(T * S >= D) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
	
	
	return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    int h, w;
    cin >> h >> w;
    vstr s(h);
    rep(i, h) cin >> s[i];

    vint dx = {-1, 0, 1, 0};
    vint dy = {0, 1, 0, -1};
    bool ans = true;
    rep(i, h) rep(j, w) {
        if (s[i][j] == '.') continue;
        int count = 0;
        rep(k, 4) {
            int nx = i+dx[k];
            int ny = j+dy[k];
            if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
            if (s[nx][ny] == '#') count++;
        }
        if (count == 0) ans = false;
    }

    yns(ans);
    return 0;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

int main() {
    int N;
    cin >> N;
    int zoro = 0;
    int res = 0;
    REP(i, N) {
        int x, y;
        cin >> x >> y;
        if(x == y) {
            zoro++;
        }else{
            zoro = 0;
        }
        res = max(res, zoro);
    }
    if(3 <= res) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3620
#include<stdio.h>
#include<string.h>

int hougaku(int a[7],char b[101]) {
	unsigned int x,i;
	for (i = 0; i < strlen(b); i++) {
		if (b[i] == 'N') {
			x = a[0];
			a[0] = a[1];
			a[1] = a[5];
			a[5] = a[4];
			a[4] = x;
		}else if (b[i] == 'E') {
			x = a[0];
			a[0] = a[3];
			a[3] = a[5];
			a[5] = a[2];
			a[2] = x;
		}
		else if (b[i] == 'S') {
			x = a[0];
			a[0] = a[4];
			a[4] = a[5];
			a[5] = a[1];
			a[1] = x;
		}
		else if (b[i] == 'W') {
			x = a[0];
			a[0] = a[2];
			a[2] = a[5];
			a[5] = a[3];
			a[3] = x;
		}
	}
	return a[0];
}

struct dice {
	int men[7];
};

int main() {
	int i;
	char h[101];
	struct dice d1;

	for (i = 0; i < 6; i++) {
		scanf("%d",&d1.men[i]);
	}
	
	scanf("%s", h);


	printf("%d\n", hougaku(d1.men, h));

	return 0;
}


Measured memory_bytes: 2104
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

#include <iostream>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define INF64 1999999999999999999
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007

ll n, u;
vector<pair<ll, ll>> ans;
int main() {
	cin >> n;
	u = n;
	if (n % 2 == 0)u++;
	REPO(i, n) {
		FOR(j, i + 1, n + 1) {
			if (i + j != u) ans.push_back(make_pair(i, j));
		}
	}
	cout << ans.size() << endl;
	REP(i, ans.size()) {
		cout << ans[i].first << " " << ans[i].second << endl;
	}
}

Measured memory_bytes: 512