akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main()
{
  int a,b,c,d;
  cin >> a >> b >> c;
  if(a < b)
  {
    if(c < b && c > a)
    {
      d = 1;
    }else{
      d = 0;
    }
  }else{
    if(c < a && c > b)
    {
      d = 1;
    }else{
      d = 0;
    }
  }
  if(d == 1)
  {
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}
    

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int n, m, c; cin >> n >> m >> c;
	vector<int> b(m), d(n);
	vector<vector<int>> a(n, vector<int>(m));
	int ans = 0;
	for (int i = 0; i < m; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a.at(i).at(j);
			d[i] += a.at(i).at(j) * b[j];
		}
		d[i] += c;
		if (d[i] > 0) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
n, y = map(int, input().split())
z = y/1000
for i in range(n+1):
    for j in range(n+1-i):
        k = n - i- j
        if 10*i + 5*j + k == z:
            print(i, j, k)
            exit(0)
print('-1 -1 -1')


Measured memory_bytes: 2940
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>
#include<queue>

const int mod = 1000000007;
//const int mod = 998244353;

class Matrix {
	int N;
	long long **d;
public:
	Matrix(int N) :N(N) {
		d = new long long*[N];
		for (int i = 0; i < N; i++) {
			d[i] = new long long[N] {};
		}
	}
	void set(long long** o) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				d[i][j] = o[i][j];
			}
		}
	}
	void identity() {
		for (int i = 0; i < N; i++)d[i][i] = 1;
	}

	~Matrix() {
		for (int i = 0; i < N; i++) {
			delete[] d[i];
		}
		delete[] d;
	}
	long long* operator[](int x) const {
		return d[x];
	}
	Matrix& operator*=(const Matrix& o) {
		Matrix temp(N);
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				for (int k = 0; k < N; k++) {
					temp[i][j] += d[i][k] * o[k][j];
					temp[i][j] %= mod;
				}
			}
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				d[i][j] = temp[i][j];
			}
		}
		return *this;
	}
	long long* operator*(long long* v) {
		long long* res = new long long[N] {};
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				res[i] += d[i][j] * v[j];
			}
		}
		return res;
	}
	void print() {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				printf("%lld ", d[i][j]);
			}
			printf("\n");
		}
	}
};

int main() {
	int N;
	long long K;
	scanf("%d %lld", &N, &K);
	long long **G = new long long*[N];
	for (int i = 0; i < N; i++) {
		G[i] = new long long[N];
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			scanf("%lld", G[i] + j);
		}
	}
	Matrix g(N);
	g.set(G);
	Matrix r(N);
	r.identity();
	while (K != 0) {
		if (K & 1) {
			r *= g;
		}
		K >>= 1;
		g *= g;
	}
	long long res = 0;
	for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) {
		res += r[i][j];
		res %= mod;
	}
	printf("%lld", res);
	return 0;
}


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

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

    vector<pair<string, int>> restaurant(N);

    for(int i = 0; i < N; i++) {
        string location;
        uint64_t ascii_loc;
        int init_score;
        cin >> location >> init_score;
        // ascii_loc = (uint64_t)location;
        int score = 100 - init_score;
        restaurant.at(i) = make_pair(location, score);
    }

    vector<pair<string, int>> unsorted_rest = restaurant; // 未ソート状態の配列を取っておく
    sort(restaurant.begin(), restaurant.end()); // 昇順ソート

    for(int i = 0; i < N; i++) {
        string i_loc;
        int i_score;
        tie(i_loc, i_score) = restaurant[i];
        for(int j = 0; j < N; j++) {
            string j_loc;
            int j_score;
            tie(j_loc, j_score) = unsorted_rest[j];
            if(equal(i_loc.begin(), i_loc.end(), j_loc.begin()) == true && i_score == j_score) {
                cout << j + 1 << endl; // 回答する際は1 ~ Nなので0 ~ N-1を+1して出力
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll i,n,k;
    cin>>n>>k;
    ll a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    bool dp[k+1];
    dp[0]=false;
    for(i=1;i<=k;i++)
    {
        bool ans=false;
        for(ll j=0;j<n;j++)
        {
            if(a[j]>i)break;
            if(dp[i-a[j]]==false)
            {
                ans=true;break;
            }
        }
        dp[i]=ans;
    }
    //for(i=0;i<=k;i++)cout<<i<<" "<<dp[i]<<"\n";
    if(dp[k])cout<<"First\n";
    else cout<<"Second\n";
}


Measured memory_bytes: 384
def totalize(n):
    total = 0
    mins, maxs = (int(input()) for _ in range(2))
    if maxs < mins:
        maxs, mins = mins, maxs
    for _ in range(n - 2):
        s = int(input())
        if s < mins:
            s, mins = mins, s
        elif maxs < s:
            s, maxs = maxs, s
        total += s
    return total // (n - 2)

while True:
    n = int(input())
    if n == 0:
        break
    print(totalize(n))

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

typedef long long ll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

const char nl = '\n';

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    int a[n];
    int b[n];
    F0R(i, n) {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b, b + n);
    int low = b[(n - 1) / 2];
    int high = b[n / 2];
    FOR(i, 0, n) {
        if (a[i] <= low) cout << high << nl;
        else if (a[i] >= high) cout << low << nl;
    }
}

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

typedef long long ll;
const ll Mod = 1000000007;

int n;
char s[200200];

int main(){
	scanf("%d%s", &n, s);
	int cnt = 0;
	ll ans = 1;
	for(int i = 1; i <= n; i++){
		ans *= i;
		ans %= Mod;
	}
	rep(i, 2*n){
		bool col = (s[i] == 'B');
		if(!cnt && !col){
			printf("0\n");
			return 0;
		}
		if(col == cnt%2){
			ans *= cnt;
			ans %= Mod;
			cnt--;
		} else cnt++;
	}
	if(cnt != 0){
		printf("0\n");
		return 0;
	}
	printf("%lld\n", ans);
	return 0;
}

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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(1){
        int d,w;cin>>d>>w;
        if(d==0&&w==0){
            break;
        }
        int ans=0;
        vector<vector<int> >c(d,vector<int>(w));
        for(int i=0;i<d;i++){
            for(int j=0;j<w;j++){
                cin>>c[i][j];
            }
        }
        for(int i=0;i<d;i++){
            for(int j=i+2;j<d;j++){
                for(int k=0;k<w;k++){
                    for(int l=k+2;l<w;l++){
                        int mi=20;
                        for(int z=k;z<=l;z++){
                            mi=min(mi,c[i][z]);
                            mi=min(mi,c[j][z]);
                        }
                        for(int z=i;z<=j;z++){
                            mi=min(mi,c[z][k]);
                            mi=min(mi,c[z][l]);
                        }
                        int ma=0;
                        int cnt=0;
                        int res=0;
                        for(int x=i+1;x<j;x++){
                            for(int y=k+1;y<l;y++){
                                cnt++;
                                ma=max(c[x][y],ma);
                                res+=c[x][y];
                            }
                        }
                        if(ma<mi){
                            ans=max(ans,cnt*mi-res);
                        }
                    }
                }
            }
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 3148
#include<stdio.h>

int main(void){
    

    int M,D,i,j,ans=0;
    scanf("%d %d",&M,&D);

    for(i=4;i<=M;i++){
        for(j=22;j<=D;j++){
            if(i == ((j/10)*(j%10)) && (j%10) >=2 ){
               // printf("%d月%d日\n",i,j);
                ans++;
            }
        }
    }

    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<long double, long double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

struct graph{
    int to, cost, time;
    //constructer
    graph(int to, int cost, int time):to(to),cost(cost),time(time){}
};

struct ddata{
    int v, cost;
    ll time;
    //constructer
    ddata(int v, int cost, ll time):v(v),cost(cost),time(time){}
    //define operator "<" about data
    bool operator<(const ddata& a) const{
        return time > a.time;
    }
};

vector<graph> ar[50];
ll dp[50][2600];

int main() {
    int n, m, s; cin >> n >> m >> s;
    s = min(s,2550);
    rep(i,m){
        int a, b, c, d; cin >> a >> b >> c >> d;
        a--; b--;
        ar[a].emplace_back(b,c,d);
        ar[b].emplace_back(a,c,d);
    }
    rep(i,n)rep(j,2600) dp[i][j] = inf;
    priority_queue<ddata> pq;
    auto push = [&](int v, int cost, ll time){
        if (cost < 0) return;
        if (dp[v][cost] <= time) return;
        dp[v][cost] = time;
        pq.emplace(v,cost,time);
    };
    vector<int> c(n), d(n);
    rep(i,n) cin >> c[i] >> d[i];
    push(0,s,0);
    while (!pq.empty()){
        ddata x = pq.top(); pq.pop();
        int v = x.v; int cost = x.cost;
        ll time = x.time;
        if (dp[v][cost] != time) continue;
        {
            int ns = min(cost+c[v], 2550);
            push(v,ns,time+d[v]);
        }
        for (graph y: ar[v]){
            push(y.to, cost-y.cost,time+y.time);
        }
    }
    repp(i,n,1){
        ll ans = inf;
        rep(j,2600) ans = min(ans, dp[i][j]);
        cout << ans << endl;
    }
}

Measured memory_bytes: 6392
#include <iostream>
#include <algorithm>
#define MAX_N 1000000
#define L 1000
using namespace std;
struct cave{
	int num;
	int pnum;	//探索した素数洞穴の総数
	int lastp;	//最後に通った素数の値
};

struct cave hole[L+1][L+1];
bool prime[MAX_N+1];

int main(){
	for(int i = 0; i < MAX_N+1; i++){
		prime[i] = true;
	}
	prime[0] = prime[1] = false;	//prime[1]:1

	for(int i = 2; i <= MAX_N; i++){
		if(prime[i] == true){
			for(int j = 2*i; j < MAX_N; j += i){
				prime[j] = false;
			}
		}
	}	//ふるい

//	for(int i = 0; i < L*L; i++){
//		cout << i << " " << prime[i] << endl;
//	}

	int m,n;
	while(cin >> m >> n,m){
		for(int i = 0; i < L; i++){
			for(int j = 0; j < L; j++){
				hole[i][j].num = 0;
				hole[i][j].pnum = 0;
				hole[i][j].lastp = 0;
			}
		}	//hole初期化

		int sy = 0,sx = 0;
		for(int i = 0; i < L/2; i++){
			for(int j = 0; j < 2*i+1; j++){
				hole[-i-1+L/2][-i+j+L/2-1].num = (2*i+2)*(2*i+2)-j;
				if(n == (2*i+2)*(2*i+2)-j){
					sy = -i-1+L/2;
					sx = -i+j+L/2-1;
				}
				hole[-i-1+j+L/2][i+1+L/2-1].num = (2*i+1)*(2*i+2)+1-j;
				if(n == (2*i+1)*(2*i+2)+1-j){
					sy = -i-1+j+L/2;
					sx = i+1+L/2-1;
				}
				hole[i+L/2][i+1-j+L/2-1].num = (2*i+1)*(2*i+1)+1-j;
				if(n == (2*i+1)*(2*i+1)+1-j){
					sy = i+L/2;
					sx = i+1-j+L/2-1;
				}
				hole[i-j+L/2][-i+L/2-1].num = 2*i*(2*i+1)+1-j;
				if(n == 2*i*(2*i+1)+1-j){
					sy = i-j+L/2;
					sx = -i+L/2-1;
				}

			}
		}	//mapping
		if(prime[hole[sy][sx].num] == true){
			hole[sy][sx].pnum = 1;
			hole[sy][sx].lastp = hole[sy][sx].num;
		}
		for(int i = sy+1; i < L; i++){	//syのあった段から下に見ていく
			for(int j = max(0,sx-(i-sy)); j <= min(sx+(i-sy),L-1); j++){
				if(hole[i][j].num <= m){	//洞穴の個数以上の場所は見ない
					int tmp = 0,maxtmp = 0;
					for(int k = -1; k <= 1; k++){
						if(max(0,sx-(i-sy)) <= j+k && j+k <= min(sx+(i-sy),L-1) && maxtmp < hole[i-1][j+k].pnum){
							maxtmp = hole[i-1][j+k].pnum;
							tmp = hole[i-1][j+k].lastp;
						}
					}
					hole[i][j].pnum = maxtmp;
					hole[i][j].lastp = tmp;
					if(prime[hole[i][j].num] == true){
						hole[i][j].pnum ++;
						hole[i][j].lastp = hole[i][j].num;
					}
				}
			}
		}

		int maxtmp = -1;
		int last = 0;
		for(int i = 0; i < L; i++){
			for(int j = 0; j < L; j++){
				if(hole[i][j].num <= m){
					if(hole[i][j].pnum == maxtmp && hole[i][j].lastp > last){
						last = hole[i][j].lastp;
					}else if(hole[i][j].pnum > maxtmp){
						maxtmp = hole[i][j].pnum;
						last = hole[i][j].lastp;
					}
				}
			}
		}
/*
		for(int i = 0; i < L; i++){
			for(int j = 0; j < L; j++){
				cout << hole[i][j].num << " " ;
			}
			cout << endl;
		}	//debug

		for(int i = 0; i < L; i++){
			for(int j = 0; j < L; j++){
				cout << hole[i][j].pnum << " " ;
			}
			cout << endl;
		}	//debug
*/
		cout << maxtmp << " " << last << endl;
	}
	return 0;
}

Measured memory_bytes: 13868
#include <iostream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define Rep(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define Repr(i, b, e) for(int (i) = (b) - 1; (i) >= (e); --(i))
#define Print(x) cout << (x) << endl 
#define Min2(a, b) ((a) < (b)) ? (a) : (b)
#define Max2(a, b) ((a) > (b)) ? (a) : (b)

typedef long long ll;

using namespace std;

int main(){
    int N, K;
    string S;
    cin >> N >> K >> S;
    map<char, char> m;
    m['A'] = 'a', m['B'] = 'b', m['C'] = 'c';
    S[K - 1] = m[S[K - 1]];
    Print(S);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;

int len;
char c[101];
bool c_f,f;

int main()
{
	scanf("%s",c);
	len=strlen(c);
	for(int i=0;i<len;i++)
	{
		if(c[i]=='C') c_f=true;
		if(c_f && c[i]=='F') f=true;
	}
	if(f) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i, n, k) for(long long int i=k; i<n; ++i)
#define drep(i, n, k) for(long long int i=n-1; i>=k; --i)
using namespace std;

int main(){
  string s;
  cin >> s;
  long long int n = s.size();
  vector<long long int> ans;
  ans.resize(n);
  long long int rsum = 0, lsum = 0;
  rep(i,n,0){
    if(s[i] == 'R') rsum++;
    else{
      ans[i] += rsum / 2;
      ans[i-1] += rsum-(rsum/2);
      rsum = 0;
    }
  }
  drep(i,n,0){
    if(s[i] == 'L') lsum++;
    else{
      ans[i] += lsum / 2;
      ans[i+1] += lsum-(lsum/2);
      lsum = 0;
    }
  }
  rep(i,n,0) cout << ans[i] << " ";
  cout << endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int l1[26],l2[26];
int main()
{
	int n,a=0;
	string s;
	cin>>n>>s;
	for(int i=1;i<n;i++)
	{
		int m=0;
		for(int j=0;j<i;j++)
		l1[s[j]-'a']=1;
		for(int j=i;j<n;j++)
		l2[s[j]-'a']=1;
		for(int j=0;j<26;j++)
		if(l1[j]==1&&l2[j]==1)
		m++;
		a=max(a,m);
		for(int j=0;j<26;j++)
		{
			l1[j]=0;
			l2[j]=0;
		}
	}
	cout<<a;
	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc161/tasks/abc161_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve() {
  ll X, Y, Z;
  cin >> X >> Y >> Z;

  VL res({Z, X, Y});

  rep(i, res.size()) {
    if (i > 0) cout << " ";
    cout << res[i];
  }

  cout << "\n";
}

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif


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

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    int n;
    cin >> n;

    vector<int> x(n);
    rep(i, n) cin >> x[i];
    vector<int> y = x;
    sort(y.begin(), y.end());

    int h = n / 2;
    rep(i, n){
        if(x[i] <= y[h-1]){
            cout << y[h] << endl;
        }else{
            cout << y[h-1] << endl;
        }
    }
    return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
    int H, W;
    cin >> H >> W;
    int a[H][W];
    REP(i, H)REP(j, W){
        cin >> a[i][j];
        a[i][j] %= 2;
    }
    bool on = false;
    int previ, prevj;
    vector<int> x, y, z, w;
    REP(i, H)REP(k, W){
        int j = (i%2==0 ? k : W-k-1);
        if(on){
            if(a[i][j]==1){
                on =false;
            }
            x.push_back(previ);
            y.push_back(prevj);
            z.push_back(i);
            w.push_back(j);
        }else{
            if(a[i][j]==1){
                on = true;
            }
        }
        previ = i;
        prevj = j;
    }
    cout << x.size() << endl;
    REP(i, x.size()){
        printf("%d %d %d %d\n", x[i]+1, y[i]+1, z[i]+1, w[i]+1);
    }
    return 0;
}

Measured memory_bytes: 5220
from collections import deque
import copy

def bfs(graph, sh, sw):
    td = deque([[sh, sw]])
    graph[sh][sw] = "0"
    mx = 0
    while td:
        h, w = td.popleft()
        num = int(graph[h][w])
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_h, new_w = h + j, w + k
            if new_h < 0 or new_h >= H or new_w < 0 or new_w >= W:
                continue
            elif graph[new_h][new_w] == ".":
                graph[new_h][new_w] = str(num+1)
                if int(graph[new_h][new_w]) > mx:
                    mx = int(graph[new_h][new_w])
                td.append([new_h, new_w])

    return mx

H, W = map(int, input().split())
ls = [[_ for _ in input()] for _ in range(H)]

ans = []

for i in range(H):
    for j in range(W):
        if ls[i][j] == ".":
            sh = i
            sw = j
            graph = copy.deepcopy(ls)
            ans.append(bfs(graph, sh, sw))

print(max(ans))

Measured memory_bytes: 3444
#include <iostream>
using namespace std;
int main() {
    int n,sum=1,s=0;
    cin>>n;
    if(n==1){
        cout<<'1';
        return 0;
    }else {
        for (int i = 0; i < 3; i++) {
            sum = (sum * n);
            s += sum;
        }
        cout << sum;

    }


}

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

#define N (int)2e5 + 5
int a[N];

bool check(int a[], int n) {
	for (int i = 0; i < n - 1; i++) {
  		if (a[i] == a[i+1]) return false;
	}
	return true;
}

int main() {
  int n; cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a+n);
  if (check(a, n)) cout << "YES";
  else cout << "NO";
  return 0;
}

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

typedef long long LL;

const int N = 3010, mod = 1e9 + 7, i2 = (mod + 1) / 2;

int a[N], dp[N][N];

int main() {
	int n, q, tot = 1; scanf("%d%d", &n, &q);
	for (int i = 1; i <= q; i++) tot <<= 1, tot %= mod;
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			dp[i][j] = a[i] > a[j];
	for (int i = 1; i <= q; i++) {
		int l, r; scanf("%d%d", &l, &r);
		dp[l][r] = dp[r][l] = (LL)(dp[l][r] + dp[r][l]) * i2 % mod;
		for (int j = 1; j <= n; j++) if (j != r && j != l) {
			dp[j][r] = dp[j][l] = (LL)(dp[j][r] + dp[j][l]) * i2 % mod;
			dp[l][j] = dp[r][j] = (LL)(dp[l][j] + dp[r][j]) * i2 % mod;
		}
	}
	int res = 0;
	for (int i = 1; i <= n; i++)
		for (int j = i + 1; j <= n; j++)
			res = (res + dp[i][j]) % mod;
	printf("%d\n", (LL)res * tot % mod);
}

Measured memory_bytes: 35584
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define INF 1e9
using ll = std::int64_t;

template <class T>
bool chmax(T &a, const T &b);
template <class T>
bool chmin(T &a, const T &b);
//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b);
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb);
//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str);
//素数判定
bool is_prime(std::int64_t n);
// 約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n);
// 素因数分解
std::map<std::int64_t, std::int64_t> prime_factor(std::int64_t n);

//10^9 + 7
#define yojo 1000000007
#define MAX_NUM 200001

void Main()
{
  string a, b, c;
  cin >> a >> b >> c;
  std::cout << (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0] ? "YES" : "NO") << std::endl;

  return;
}

int main()
{
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

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

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

//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b)
{
  // a >= b && b != 0
  std::int64_t c;
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//最大公約数安全版
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb)
{
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0)
  {
    return -1;
  }
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str)
{
  std::vector<std::pair<char, std::int64_t>> data;
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++)
  {
    if (i == str.size())
    {
      data.push_back(make_pair(str[i - 1], count));
      break;
    }
    else if (now != str[i])
    {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return data;
}

//素数判定
bool is_prime(std::int64_t n)
{
  for (std::int64_t i = 0; i * i <= n; i++)
  {
    if (n % i == 0)
    {
      return false;
    }
  }

  return n != 1;
}

//約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n)
{
  std::vector<std::int64_t> res;
  for (int i = 0; i < n; i++)
  {
    if (n % i == 0)
    {
      res.push_back(i);
      if (i != n / i)
        res.push_back(n / i);
    }
  }
  return res;
}

// 素因数分解
std::map<std::int64_t, std::int64_t> prime_factor(std::int64_t n)
{
  std::map<std::int64_t, std::int64_t> res;
  for (int i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      ++res[i];
      n /= i;
    }
  }

  if (n != 1)
  {
    res[n] = 1;
  }

  return res;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>

using namespace std;

int main(){
  int n;
  cin >> n;
  int a[100000];
  int sum = 0;
  for(int i = 0; i <= n ; i++){
    if(i == n) a[i] = 0;
    else cin >> a[i];
    if(i == 0) sum += abs(a[0]);
    else sum += abs(a[i] - a[i-1]);
  }
  for(int i = 0; i < n ; i++){
    if(i == 0){
      cout << sum + abs(a[i+1]) - abs(a[i+1] - a[i]) - abs(a[i]) << endl;
    }
    else{
      cout << sum + abs(a[i+1] - a[i-1]) - abs(a[i+1] - a[i]) - abs(a[i] - a[i-1]) << endl;
    }
  }
}


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

int main() {
  
  int N, A, B, M;
  cin >> N >> A >> B;
  
  M = N * A;
  
  if (M >= B) {
    cout << B << endl;
  }
  else {
    cout << M << endl;
  }
  
}


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

int main(){
 ll n ;
  cin>>n;
  ll a[n+1],b[n];
  for(ll i=0;i<n+1;i++){
   cin>>a[i]; 
  }
  for(ll i=0;i<n;i++)cin>>b[i];
  ll ans=0;
  for(ll i=0;i<n;i++){
	if(i==-1){
    }
    else{
     if(b[i]>=a[i]){
         ans+=a[i],b[i]-=a[i],a[i]=0; 
         if(b[i]>=a[i+1]){
             ans+=a[i+1];
             a[i+1]=0;
         }
         else{
             ans+=b[i];
             a[i+1]-=b[i];
         }
     }
      else{
       ans+=b[i]; b[i]=0;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)
#define MP(a,b) make_pair(a,b)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {

	char c;
	cin >> c;
	cout << char(c+1);

}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	return 0;
}

Measured memory_bytes: 3496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
#define AAA 100010
typedef struct
{
    int parent;
    queue<pair<int, int>> qu;
} node;

int ans[AAA];
int m = 0;
node A[AAA];

void solve(int i, int color)
{
    while (A[i].qu.size() > 0)
    {
        pair<int, int> now = A[i].qu.front();
        A[i].qu.pop();

        int next = now.first;
        int idx = now.second;
        ans[idx] = color + 1;
        color++;
        color %= m;
        solve(next, color);
    }
}

signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    REP(i, N - 1)
    {
        ans[i] = -1;
    }
    REP(i, N)
    {
        A[i + 1].parent = -1;
    }

    REP(i, N - 1)
    {
        int a, b;
        cin >> a >> b;
        A[a].qu.push(make_pair(b, i));
        A[b].parent = a;
    }
    m = 0;
    REP(i, N)
    {
        int tmp = 0;
        tmp = A[i + 1].qu.size();
        if (A[i + 1].parent != -1)
            tmp++;
        m = max(m, tmp);
    }

    int start = 1;
    while (true)
    {
        int tmp = A[start].parent;
        if (tmp == -1)
        {
            break;
        }
        start = tmp;
    }
    solve(start, 0);
    cout << m << endl;
    REP(i, N - 1)
    {
        cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 72448
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()

#define pb push_back
#define mp make_pair

#define F first
#define S second

using ll = long long;
using namespace std;

void chmin(ll &a, ll b) { if (a > b) a = b; }

const int mod = 1000000007;
const int INF = 1e+9;

int main() {
    int n, k; cin >> n >> k;
    vector<ll> h(n);
    vector<ll> dp(n+1);

    for (int i = 0; i < n; i++) {
        cin >> h[i];
        dp[i] = INF;
    }
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);
    for (int i = 0; i < n; i++) {
        for (int j = 1; i+j < n && j <= k; j++) {
            chmin(dp[i+j], abs(h[i+j]-h[i])+dp[i]);
        }
    }
    cout << dp[n-1] << endl;
}


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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		solver.solve();
	}
}

class Solver {
	int N;
	int M;
	int cnt;
	long[] X;
	long[] Y;

	public void init() {
		N = 0;
		M = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		M = Integer.parseInt(strArr[1]);
		X = new long[N];
		Y = new long[M];
	}

	public boolean hasNext() {
		return cnt < 2;
	}

	public void readBody(String str) {
		String[] strArr = str.split(" ");
		if (cnt == 0) {
			for (int i = 0; i < N; i++) {
				X[i] = Long.parseLong(strArr[i]);
			}
		} else {
			for (int i = 0; i < M; i++) {
				Y[i] = Long.parseLong(strArr[i]);
			}
		}
		cnt++;
	}

	final long MOD = 1000000007;

	public void solve() {
		long ansX = 0;
		for (int x1 = 0; x1 < N - 1; x1++) {
			int x2 = x1 + 1;
			long s = (X[x2] - X[x1]) % MOD;
			s = (s * (N - 1 - x1)) % MOD;
			s = (s * (x1 + 1)) % MOD;
			ansX = (ansX + s) % MOD;
		}
		long ansY = 0;
		for (int y1 = 0; y1 < M - 1; y1++) {
			int y2 = y1 + 1;
			long s = (Y[y2] - Y[y1]) % MOD;
			s = (s * (M - 1 - y1)) % MOD;
			s = (s * (y1 + 1)) % MOD;
			ansY = (ansY + s) % MOD;
		}
		System.out.println((ansX * ansY) % MOD);
	}

}


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

int main(){
    string s;
    cin >> s;
    int cnt = 0;
    rep(i, 3) {
        if (s[i]=='A') cnt++;
    }
    if (cnt==0 || cnt==3) puts("No");
    else puts("Yes");
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 305
#define MOD 1000
#define oo 1000000000000000007LL
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n;
char a[maxN][maxN], b[maxN][maxN];

int main () {
    scanf("%d", &n);
    fto(i, 0, n-1) scanf("%s", &a[i]);

    int ans = 0;
    fto(A, 0, n-1) {
        fto(i, 0, n-1) fto(j, 0, n-1) b[(i+A)%n][j] = a[i][j];
        bool ok = true;
//        debug(A);
//        fto(i, 0, n-1) {
//            fto(j, 0, n-1) printf("%d ", b[i][j]);
//            puts("");
//        }
        fto(i, 0, n-1) fto(j, 0, n-1) {
            if (b[i][j] != b[j][i]) ok = false;
        }
        if (ok) ans += n;
    }

    printf("%d", ans);

    return 0;
}


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

constexpr int MAX_N = 1005;
int id[MAX_N][MAX_N];
int ToId(int i, int j) {
  if (i > j) swap(i, j);
  return id[i][j];
}

bool visted[MAX_N * MAX_N];
bool calculated[MAX_N * MAX_N];
int dfs(int s, const vector<vector<int>>& graph, vector<int>& dp) {
  if (visted[s]) {
    if (!calculated[s]) return -1;
    return dp[s];
  }
  visted[s] = true;
  dp[s] = 1;
  for (auto& to : graph[s]) {
    int res = dfs(to, graph, dp);
    if (res == -1) return -1;
    dp[s] = max(dp[s], res + 1);
  }
  calculated[s] = true;
  return dp[s]; 
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n-1));
  rep(i, n) {
    rep(j, n-1) {
      cin >> a[i][j];
      a[i][j]--;
    }
  }

  int v = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      id[i][j] = v++;
    }
  }

  vector<vector<int>> graph(n*(n-1)/2);
  rep(i, n) {
    rep(j, n-1) {
      a[i][j] = ToId(i, a[i][j]);
    }
    rep(j, n-2) {
      graph[a[i][j+1]].push_back(a[i][j]);
    }
  }
  
  vector<int> dp(v, -1);
  int ans = 0;
  rep(i, v) {
    int res = dfs(i, graph, dp);
    if (res == -1) {
      cout << -1 << endl;
      return 0;
    }
    ans = max(res, ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 38400
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n, k;
    std::cin >> n >> k;
    std::vector<int> a(n);
    for (int i = 0; i < n; ++i)
        std::cin >> a[i];
    for (int t = 0; t < k; ++t) {
        std::vector<int> b(n + 1);
        for (int i = 0; i < n; ++i) {
            ++b[std::max(0, i - a[i])];
            --b[std::min(n, i + a[i] + 1)];
        }
        for (int i = 0; i < n; ++i)
            b[i + 1] += b[i];
        b.pop_back();
        if (a == b)
            break;
        a = std::move(b);
    }
    for (int i = 0; i < n; ++i)
        std::cout << a[i] << " \n"[i == n - 1];
    return 0;
}

Measured memory_bytes: 4784
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif

int N;
vl S;
vvl dp;
set<ll> st;
ll dfs(int n, ll sum) {
    if (n >= N) {
        st.insert(sum);
        return 0;
    }

    if (dp[n][sum] >= 0) return dp[n][sum];

    ll yes = dfs(n + 1, sum+S[n]) + S[n];
    ll no = dfs(n + 1, sum);

    ll ret = max(yes, no);

    dp[n][sum] = ret;

    return ret;
}

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

    cin >> N;
    S=vl(N); REP(i, N) cin >> S[i];

    dp = vvl(N+MGN, vl(100*N+MGN, -1));
    dfs(0,0);

    ll ans = 0;
    while(!st.empty()) {
        auto it = st.end(); it--;
        ll sum = *it;
        if (sum % 10 != 0) {
            ans = sum;
            break;
        }
        st.erase(sum);
    }

    cout << ans << endl;    
    st.clear();

    return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
        #include<iostream>
        #include<algorithm>
        #include<set>
        #include<map>
        #include<math.h>
        //#include <ttmath.h>
        #define endl '\n'
        #define modulo 1000000007
        #define int long long
        #pragma GCC optimize("-Ofast")
        #define float double
        #define PI 3.141592653589793238462643
        #define sinDegrees(x) sin((x) * PI / 180.0)
        #define tanDegrees(x) tan((x) * PI / 180.0)
        #define atanDegrees(x) atan(x)* 180.0 / PI
        using namespace std;
        int power(int x,int y)
        {
        int temp;
        if(y == 0)
        return 1;
        temp = (power(x, y/2))%modulo;
        if (y%2 == 0)
        return ((temp%modulo)*temp)%modulo;
        else
        return ((x*temp%modulo)*temp)%modulo;
        }
        int inv(int x)
        {
        return (power(x,modulo-2)+modulo)%modulo;
        }
        /*#include "testlib.h"
        int main(int argc, char* argv[])
        {
        iostream::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        registerGen(argc, argv, 1);
        int n,k;
        n=rnd.next(1,50);
        k=rnd.next(1,n);
        cout<<n<<' '<<k;
        }*/
        bool comp(pair<int,int>a,pair<int,int> b)
        {
            return a.second>b.second;
        }
        int32_t main()
        {
            //freopen("output.txt","w", stdout);
            //freopen("input4.txt","r", stdin);
            iostream::sync_with_stdio(0);
            cin.tie(0);
            cout.tie(0);
            int n,buff;
            cin>>n;
            int arr[n];
            for(int i=0;i<n;i++){
            cin>>buff;
            arr[buff-1]=i+1;
            }
            for(int i=0;i<n;i++){
            cout<<arr[i]<<' ';
            }
            return 0;
        }


Measured memory_bytes: 1664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var firstLine = Console.ReadLine().Split(' ');
            var N = int.Parse(firstLine[0]);
            var T = int.Parse(firstLine[1]);

            List<int> tmpList = new List<int>();
            for (int i = 0; i < N; i++)
            {
                var tmp = Console.ReadLine().Split(' ');
                var ci = int.Parse(tmp[0]);
                var ti = int.Parse(tmp[1]);
                if (ti <= T)
                {
                    tmpList.Add(ci);
                }
            }
            if (!tmpList.Any())
            {
                Console.Write("TLE");
            }
            else
            {
                Console.Write(tmpList.Min());
            }
            //var result = tmpList.Min(x => x.Value);

        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
   
   int cnt1=0,cnt2=0,cnt3=0,cnt4=0;
   int n;
   scanf("%d",&n);
   char s1;
  
  int i;
  for(i=0;i<n;++i)
  {
      cin>>s1;
    if(s1=='P')
        cnt1++;
    
    if(s1=='W')
        cnt2++;
    
    if(s1=='G')
        cnt3++;
    
    if(s1=='Y')
        cnt4++;
  }
  
  if(cnt1>0 && cnt2>0 && cnt3>0 && cnt4>0)
      printf("Four");
  
  else if(cnt1>0 && cnt2>0 && cnt3>0 && cnt4==0)
     printf("Three");
  
}

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

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

// 400012- 128


void oneCase() {
    int n, m;
    cin >> n >> m;
    cout << ((n - m) * 100 + m * 1900) * (1 << m) << "\n";
}

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

    int t = 1;
//    cin >> t;
    while (t--) {
       oneCase();
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const ll MOD = 1000000007;
 
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
 
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
    int n, k;
    cin >> n >> k;
    if(n % k == 0){
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
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; }

bool is_prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0) return false;
    }
    return true;
}

int main() {
    int x; cin >> x;
    while (!is_prime(x)) x++;
    cout << x << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//Optimisations
#pragma GCC target ("avx2")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("O2")
//shortcuts for functions
#define pb push_back
#define mp make_pair
#define ff first 
#define ss second
#define all(v) v.begin(),v.end()
#define prec(n) fixed<<setprecision(n)
#define n_l '\n'
// make it python 
#define gcd __gcd
#define append push_back
#define str to_string
// utility functions shortcuts
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define sswap(a,b) {a=a^b;b=a^b;a=a^b;}
#define swap(a,b) {auto temp=a; a=b; b=temp;}
#define init(dp) memset(dp,-1,sizeof(dp));
#define set0(dp) memset(dp,0,sizeof(dp));
#define bits(x) __builtin_popcount(x)
#define SORT(v) sort(all(v))
#define endl "\n"
#define forr(i,n) for(ll i=0;i<n;i++)
// declaration shortcuts
typedef long long int ll;
#define int ll
// Constants
constexpr int dx[] = {-1, 0, 1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
constexpr ll INF = 1999999999999999997; 
constexpr int inf= INT_MAX;
constexpr int MAXSIZE = int(1e6)+5;
constexpr auto PI  = 3.14159265358979323846L;
constexpr auto oo  = numeric_limits<int>::max() / 2 - 2;
constexpr auto eps = 1e-6;
constexpr auto mod = 1000000007;
constexpr auto MOD = 1000000007;
constexpr auto MOD9 = 1000000009;
constexpr auto maxn = 100006;
//void IOfile(){
//freopen(file_name, reade_mode, stdin);
//freopen(file_name, write_mode, stdout);
//}
void fastio(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
int32_t main(){
	fastio();
	string s;
	cin>>s;
	for(auto i:s){
		if(i=='7'){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
}

Measured memory_bytes: 3612
N = input()
X = [0]*N
for _ in range(N*(N-1)/2):
  A,B,C,D = map(int, raw_input().split())
  if C>D:
    X[A-1] += 3
  elif D>C:
    X[B-1] += 3
  else:
    X[A-1] += 1
    X[B-1] += 1

for i in range(N):
  c = 0
  for x in X:
    if x>X[i]:
      c += 1
  print c+1

Measured memory_bytes: 6460
#include <iostream>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

int sx,sy,tx,ty;

static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){

}

void debug(){

}

int main(){
	cin >> sx >> sy >> tx >> ty;
	int x = tx-sx,y = ty-sy;
	for (int i = 0; i < y; ++i)
	{
		cout << 'U';
	}
	for (int i = 0; i < x; ++i)
	{
		cout << 'R';
	}
	for (int i = 0; i < y; ++i)
	{
		cout << 'D';
	}
	for (int i = 0; i < x+1; ++i)
	{
		cout << 'L';
	}
	for (int i = 0; i < y+1; ++i)
	{
		cout << 'U';
	}
	for (int i = 0; i < x+1; ++i)
	{
		cout << 'R';
	}
	cout << "DR";
	for (int i = 0; i < y+1; ++i)
	{
		cout << 'D';
	}
	for (int i = 0; i < x+1; ++i)
	{
		cout << 'L';
	}
	cout << "U\n";
	return 0;
}

Measured memory_bytes: 256