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

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

ll n,m,x,k,d,i,j,index,flag=0,mini,count=0,result,odd,even,sum=0,temp;
cin>>n>>m>>x;
//string str;
//cin>>str;
//ll a[200005];
//ll b[200005];
//vector<ll> ans;
//set<ll> s;
/*for(i=0;i<n;i++)
{
    cin>>a[i];
}
*/
//sort(a,a+n);
if(m*x>= n) cout<<"Yes";
else cout<<"No";
    return 0;
}


Measured memory_bytes: 3648
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int q; cin>>q;
    cin.ignore();
    rep(_,q){
        string s; cin>>s;
        if(s.size()==1){cout<<0<<endl; continue;}
        bool flag=true;
        int cnt=1, num=0, ans=0;
        while(true){
            string hoge;
            for(int i=1; i<=s.size()-1;i++){
                string a,b;
                a=s.substr(0,i);
                b=s.substr(i);
               // cout<<"a "<<a<<" b "<<b<<" s "<<s<<endl;
                if(num<stoi(a)*stoi(b)){num=stoi(a)*stoi(b);}
                
            }
            s=to_string(num);
            if(s.size()==1){ans=cnt; break;}
            cnt++;
            if(cnt>10000){flag=false;break;}
            num=0;
        }
        if(flag)cout<<ans<<endl;
        else cout<<-1<<endl;
    }
    
}

Measured memory_bytes: 3280
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			for(;;) {
				int a = sc.nextInt();
				String op = sc.next();
				int b = sc.nextInt();

				int ans = 0;
				if(op.equals("?")) {
					break;
				}
				else if(op.equals("+")) {
					ans = a + b;
				}
				else if(op.equals("-")) {
					ans = a - b;
				}
				else if(op.equals("*")) {
					ans = a * b;
				}
				else if(op.equals("/")) {
					ans = a / b;
				}

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


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

int main() {
	// your code goes here
	int n;
	cin>>n;
	for(int i = 1; i<=9; i++)
	{
		for(int j =1; j<=9; j++)
		{
			if(i*j==n)
			{
				cout<<"Yes";
				exit(0);
			}
		}
	}
	cout<<"No";
	return 0;
}

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

using namespace std;

const int INF = 1e9 + 7;


int point(string str, char c)
{
  if (count(str.begin(), str.end(), c) == str.size()) return 0;
  string s;
  for(int i = 0; i < str.size() - 1; i++) {
    if(str[i] == c || str[i + 1] == c) {
      s += c;
    } else {
      s += str[i];
    }
  }
  return 1 + point(s, c);
}

void solve()
{
  string s;
  cin >> s;
  int ans = 1 << 25;
  for(char c = 'a'; c <= 'z'; c++) {
    if (count(s.begin(), s.end(), c))
    {
      ans = min(ans, point(s, c));
    }
  }
  cout << ans << "\n";
}

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

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

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

int N, M, K;
vector<int> edge[100010];
vector<int> ng_edge[100010];
int friend_sign[100010];

int dfs(int t, int sign, bool visit[]) {
	if (visit[t])return 0;

	friend_sign[t] = sign;
	visit[t] = true;

	int sum = 1;
	for (auto i : edge[t]) {
		if ( visit[i])continue;
		sum += dfs(i, sign, visit);
	}
	return sum;
}


void solve() {
	cin >> N >> M >> K;
	for (int i = 0; i < M; i++) {
		int A, B;
		cin >> A >> B;
		A -= 1;
		B -= 1;
		edge[A].push_back(B);
		edge[B].push_back(A);
	}
	for (int i = 0; i < K; i++) {
		int C, D;
		cin >> C >> D;
		C -= 1;
		D -= 1;
		ng_edge[C].push_back(D);
		ng_edge[D].push_back(C);
	}

	for (int i = 0; i < N; i++)friend_sign[i] = -1;
	int sign = 0;
	vector<int> friend_size;
	for (int i = 0; i < N; i++) {
		if (friend_sign[i] == -1) {
			bool visit[100010] = {};
			int num = dfs(i, sign, visit);
			friend_size.push_back(num);
			sign++;
		}
	}
	
	for (int i = 0; i < N; i++) {
		// 自分は友達じゃない
		int ans = friend_size[friend_sign[i]] - 1;
		// 既に友達なら消す
		ans -= edge[i].size();
		// 友達の中にNGおったら消す
		for (auto x : ng_edge[i]) {
			if (friend_sign[i] == friend_sign[x]) {
				ans -= 1;
			}
		}
		cout << ans << " ";
	}
	cout << endl;
}

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

Measured memory_bytes: 12800
# coding:utf-8

import sys
from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n = II()
    blue = defaultdict(int)
    for _ in range(n):
        blue[SI()] += 1
        
    m = II()
    red = defaultdict(int)
    for _ in range(m):
        red[SI()] += 1

    res = 0
    for key, v in blue.items():
        res = max(res, v - red[key])

    return res


print(main())


Measured memory_bytes: 3316
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
using ll=long long;
constexpr ll mod=998244353;
constexpr int inf=1000000000;
constexpr ll linf=1000000000000000000;

template<int COL=60>
struct bitmat{
private:
    vector<bitset<COL>> mat;
    int rank=0;
public:
    int addRow(bitset<COL> &aRow){
        mat.push_back(aRow);
        return eliminate();
    }
    int eliminate(){
        rank=0;
        for(int col=0;col<COL;++col){
            int pivot=-1;
            for(int row=rank;row<(int)mat.size();++row){
                if(mat[row][col]){
                    pivot=row;
                    break;
                }
            }
            if(pivot==-1)continue;
            swap(mat[pivot],mat[rank]);
            for(int row=rank+1;row<(int)mat.size();++row){
                if(mat[row][col]){
                    mat[row]^=mat[rank];
                }
            }
            ++rank;
        }
        return rank;
    }
    int getRank(){
        return rank;
    }
    void removeRow(){
        mat.pop_back();
    }
};


int main(){
    int t;
    cin>>t;
    rep(loop,t){
        int n;
        cin>>n;
        vector<bitset<60>> a;
        a.reserve(n);
        rep(i,n){
            ll val;
            cin>>val;
            a[i]=bitset<60>(val);
        }
        string s;
        cin>>s;
        bitmat<60> mat;
        int win=0;
        for(int i=n-1;i>=0;--i){
            int oldrank=mat.getRank();
            int newrank=mat.addRow(a[i]);
            if(oldrank==newrank){
                mat.removeRow();
            }
            else if(s[i]=='1'){
                win=1;
                break;
            }
        }
        cout<<win<<endl;
    }
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[] c = new int[n-1];
		int[] s = new int[n-1];
		int[] f = new int[n-1];
		for(int i=0;i<n-1;i++){
			c[i] = scanner.nextInt();
			s[i] = scanner.nextInt();
			f[i] = scanner.nextInt();
		}
		for(int i=0;i<n;i++){
			int time = 0;
			for(int j=i;j<n-1;j++){
				int start = s[j];
				if(time < s[j]){
					time = s[j];
				}else{
					while(start < time){
						start += f[j];
					}
					time = start;
				}
				time += c[j];
			}
			System.out.println(time);
		}
	}

}


Measured memory_bytes: 26204
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

void Main()
{
	string N;
  
  	cin >> N ;
  
  if(N[2] == N[3] && N[4] == N[5]){
    printf("Yes");
  }
  else
    printf("No");
	
	
}

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

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#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 shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    string s;
    cin >> s;
    char c;
    rp(i,26){
      c = 'a'+i;
      bool nice = true;
      rp(j,s.length()){
        if(s[j] == c) {
          nice = false;
          break;
        }
      }
      if(nice){
        cout << c<<endl;
        return 0;
      }
    }
    cout << "None"<<endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 512
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 9e18
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}
string YN(bool y) { return (y ? "YES" : "NO"); }
string yn(bool y) { return (y ? "Yes" : "No"); }
string ON(bool y) { return (y ? "OK" : "NG"); }

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;

int dir4[4][2] = { {0,-1},{-1,0},{1,0},{0,1} };
int dir8[8][2] = { {-1,-1},{0,-1},{1,-1},{-1,0},{1,0},{-1,1},{0,1},{1,1} };

//=======ここまでテンプレート===============================================

void Dijkstra(Graph graph, int start, vi &cost) {
	int V = graph.size();
	vi prev(V);
	pqlP Q;

	fill(cost.begin(), cost.end(), INF);
	cost[start] = 0;

	Q.push(mp(0, start));	// (cost, index)

	while (!Q.empty()) {
		int pos = Q.top().second;
		int d = Q.top().second;
		Q.pop();
		rep(i, graph[pos].size()) {
			if (cost[graph[pos][i].to] > cost[pos] + graph[pos][i].cost) {
				cost[graph[pos][i].to] = cost[pos] + graph[pos][i].cost;
				Q.push(mp(cost[graph[pos][i].to], graph[pos][i].to));
				prev[graph[pos][i].to] = pos;
			}
		}
	}
}

int main(void) {
	int K;
	cin >> K;

	Graph G(K);

	rep(i, K) {
		G[i].push_back(Edge{ i,(i + 1) % K,1 });
		G[i].push_back(Edge{ i,(i * 10) % K,0 });
	}
	vi cost(K);

	Dijkstra(G, 1, cost);

	cout << cost[0] + 1 << endl;

	return 0;
}

Measured memory_bytes: 12672
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x,n1=0,n2=0,n4=0;
	for(scanf("%d",&n);n--;){
		scanf("%d",&x);
		if(x%4==0)n4++;else
		if(x%2==0)n2++;else
			n1++;
	}
	if(n2 > 0)n1++;
	if(n1 <= n4 + 1)puts("Yes");else
		puts("No");
	return 0;
}


Measured memory_bytes: 256
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = (ll)n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = (ll)r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U> inline void cmax(T &a, U b) { if (a < b) a = b; }
template<class T, class U> inline void cmin(T &a, U b) { if (a > b) a = b; }
constexpr char el = '\n';
template<class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<class T, class U> istream &operator>>(istream &is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) os << v[i] << (i+1 != v.size() ? " " : ""); return os; }
template<class T> istream &operator>>(istream &is, vector<T> &v) { for(T &i : v) is >> i; return is; }
struct IoSetup {
  IoSetup() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15); }
} io_setup;
#line 2 "d.cpp"

ll n = 1e5, m = 2*n;
vl ans(n);
vector<vl> g(n);

int main() {
  cin >> n >> m;
  rep(i, m) {
    ll a, b;
    cin >> a >> b;
    g[a-1].push_back(b-1);
    g[b-1].push_back(a-1);
  }

  rep(i, n) {
    ans[i] = -1;
  }

  queue<pl> que;
  que.emplace(0, -1);
  while (que.size()) {
    ll now, p;
    tie(now, p) = que.front(); que.pop();

    for (auto&& i : g[now]) {
      if (i != p and ans[i] == -1) {
        ans[i] = now;
        que.emplace(i, now);
      }
    }
  }

  cout << (1 ? "Yes" : "No") << el;
  rep(i, n-1) {
    cout << ans[i+1]+1 << el;
  }
}


Measured memory_bytes: 13684
import java.util.Scanner;

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

    long k = 0;
    int max = -1000001;
    int min = 1000001;
      for ( int i = 1 ; i <= a ; i++){
        int b = sc.nextInt();
        if ( b > max ){
          max = b;
        }
        if ( b < min ){
          min = b;
        }
        k = k + b;
      }
      System.out.println(min + " " + max + " " + k);
  }
}



Measured memory_bytes: 41568
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair


int main()
{
  string s1,s2;
  cin>>s1>>s2;
  ll flag=0;
for(ll i=0;i<s1.length();i++)
{
  if(s1[i]!=s2[i])
  {
    flag=1;
    break;
  }
}
if(flag==0)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}


Measured memory_bytes: 3624
# -*- coding: utf-8 -*-

N = int(input())
H = list(map(int, input().split()))

ans = 0
count = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        count+=1
        ans = max(count, ans)
    else:
        ans = max(count, ans)
        count = 0

print(ans)

Measured memory_bytes: 14252
#include <set>
#include <map>
#include <math.h>
#include <vector>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define  LL long long
const double pi = acos(-1);
const double g = -9.8;
const int maxn = 1e5+555;

int main()
{
	char s[maxn];
	scanf("%s",s);
	int ll=strlen(s);
	int ans=ll/2;
	int l,r;
	while(1){
		l=ll-ans;
		r=ans+1;
		int flag=1;
		int now=s[l-1];
		for(int i=l;i<r;i++){
			if(s[i]!=now){
				flag=0;
				break;
			}
		}
		if(!flag){
			break;
		}
		ans++;
	}
	printf("%d\n",ans);
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
#define all(ARRAYY) (ARRAYY).begin,(ARRAYY).end()
int gcd(int a,int b){
  while(b > 0){
    int tmp=a;
    a=b;
    b=tmp%b;
  }
  return a;
}
int main(){
int n,i;cin>>n;vint x(n+1);vint sa(n);for(i=0;i<n+1;i++){cin>>x[i];}
for(i=0;i<n;i++){sa[i]=abs(x[i]-x[i+1]);}
for(i=0;i<n-1;i++){sa[i+1]=gcd(sa[i],sa[i+1]);}
  cout<<sa[n-1]<<endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> x(n);
    int p = 0; 
    for(int i = 0; i < n; i++){
        cin >> x[i];
        p += x[i];
    }
    p /= n;
    int ans1 = 0;
    int ans2 = 0;
    for(int i = 0; i < n; i++){
        ans1 += (x[i]-p)*(x[i]-p); 
    }
    p++;
    for(int i = 0; i < n; i++){
        ans2 += (x[i]-p)*(x[i]-p); 
    }
    cout << min(ans1, ans2) << endl;
    
    

    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> h;
    int dp[n + 1];

    for(int i = 0; i < n; ++i){
        int x;
        cin >> x;
        h.push_back(x);
    }
    //for(int i = 0; i < n; ++i) cout << h[i] << " ";
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for(int i = 2; i < n; i++){
        int x = dp[i - 1] + abs(h[i] - h[i - 1]);
        int y = abs(h[i] - h[i - 2]) + dp[i - 2];
        dp[i] = min(x, y);
    }
    cout << dp[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 1144
#include<iostream>
#include<vector>
#include<utility>

using namespace std;

vector<bool> rowCheck(8, true);
vector<bool> columnCheck(8, true);
vector<bool> rightDiagonal(2 * 8 - 1, true);
vector<bool> leftDiagonal(2 * 8 - 1, true);



bool imp_putqueen(vector<int>& qplace) {
	for (int i = 0; i < 8; i++) {
		if (qplace.at(i) != -1) continue;
		for (int j = 0; j < 8; j++) {
			if ((((rowCheck.at(i)) && columnCheck.at(j)) && rightDiagonal.at(i - j + 7)) && leftDiagonal.at(i + j)) {
				qplace.at(i) = j;
				if (i == 7) return true;
				rowCheck.at(i) = false;
				columnCheck.at(j) = false;
				rightDiagonal.at(i - j + 7) = false;
				leftDiagonal.at(i + j) = false;
				if (imp_putqueen(qplace)) return true;
				else {
					rowCheck.at(i) = true;
					columnCheck.at(j) = true;
					rightDiagonal.at(i - j + 7) = true;
					leftDiagonal.at(i + j) = true;
					qplace.at(i) = -1;
				}
			}
		}
		return false;
	}
	if (qplace.at(7) != -1) true;
	else return false;
}

int main(void) {
	int putq, row, column;

	cin >> putq;
	vector<int> qplace(8, -1);
	for (int i = 0; i < putq; i++) {
		cin >> row >> column;
		rowCheck.at(row) = false;
		columnCheck.at(column) = false;
		rightDiagonal.at(row - column + 7) = false;
		leftDiagonal.at(row + column) = false;
		qplace.at(row) = column;
	}

	imp_putqueen(qplace);
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			if (qplace.at(i) == j) cout << "Q";
			else cout << ".";
		}
		cout << endl;
	}
}



Measured memory_bytes: 3120
using System;

namespace atcoderA
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            Array.Sort(input);
            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);
            int C = int.Parse(input[2]);
            Console.WriteLine(A == 5 && B == 5 && C == 7 ? "YES" : "NO");
        }
    }
}

Measured memory_bytes: 11360
//Just have Patience...
#include<bits/stdc++.h>
using namespace std;

#define tarzan ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long 

int rr[] = {0, 1, 1, 1, 0, -1, -1, -1};
int cc[] = {1, 1, 0, -1, -1, -1, 0, 1};

const int mod = 1e9 + 7;
const int N = 300050;

signed main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    tarzan;
    int test = 1;
    //cin >> test;
    while(test--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;

        cout << max({a * c, a * d, b * c, b * d}) << '\n';
    }
    return 0;
}


Measured memory_bytes: 3644
#include <cstdio>
#include <queue>

using std::queue;

const int MAXN=200005;
int n,m;
int he[MAXN],dis[MAXN];
bool vis[MAXN];

queue<int> q;

struct line{int to,nex;}ed[MAXN<<1];

inline void addE(int u,int v){
	static int cnt=0;
	ed[++cnt]=(line){v,he[u]};
	he[u]=cnt;
}

inline void BFS(){
	q.push(1);
	vis[1]=true;
	int u;
	while(q.size()){
		u=q.front();
		q.pop();
		for(int i=he[u],v;i;i=ed[i].nex){
			v=ed[i].to;
			if(!vis[v]){
				dis[v]=dis[u]+1;
				q.push(v);
				vis[v]=true;
			}
		}
	}
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1,u,v;i<=m;++i){
		scanf("%d%d",&u,&v);
		addE(u,v),addE(v,u);
	}
	BFS();
	if(dis[n]==2) printf("POSSIBLE");
	else printf("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 5504
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  ll N, T;
  cin >> N >> T;
  ll prev, t;
  cin >> prev;
  ll res = 0;
  for (auto i = 1; i < N; i++) {
    cin >> t;
    res += min(T, t - prev);
    prev = t;
  }
  res += T;

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")
from itertools import accumulate
import operator


def solve(N: int, A: "List[int]"):
    acc_sum = [0]+list(accumulate(A))
    acc_xor = [0]+list(accumulate(A, func=operator.xor))

    ans = 0
    for i in range(1, N+1):       # left
        left, right = i, N+1
        while right-left > 1:
            # print("while, ({},{})".format(left, right))
            mid = (right+left)//2
            s = acc_sum[mid]-acc_sum[i-1]
            x = acc_xor[mid] ^ acc_xor[i-1]
            if s > x:
                right = mid
            else:
                left = mid
        ans += left-i+1
        # print("{}, ({}, {})".format(i, left, right))
        # while left < N+1 and\
        #         acc_sum[left]-acc_sum[i-1] == acc_xor[left] ^ acc_xor[i-1]:
        #     ans += 1
        #     left += 1

        # s =
        # x =
        # while s <= x and left <= N:  # いくつか見ていく
        #     s = acc_sum[left]-acc_sum[i-1]
        #     x = acc_xor[left] ^ acc_xor[i-1]
        #     if s == x:
        #         ans += 1
        #     left += 1

    # print(acc_sum)
    # print(acc_xor)
    print(ans)
    return


def main():

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


if __name__ == '__main__':
    main()


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

typedef long long lint;
typedef long double louble;

template<typename T1,typename T2> inline T1 max(T1 a,T2 b){return a<b?b:a;}
template<typename T1,typename T2> inline T1 min(T1 a,T2 b){return a<b?a:b;}

namespace ae86
{
	const int bufl = 1<<15;
	
	char buf[bufl],*s=buf,*t=buf;
	
	inline int fetch()
	{
		if(s==t){t=(s=buf)+fread(buf,1,bufl,stdin);if(s==t)return EOF;}
		return *s++;
	}
	
	inline lint ty()
	{
		lint a=0;int b=1,c=fetch();
		while(!isdigit(c))b^=c=='-',c=fetch();
		while(isdigit(c))a=a*10+c-48,c=fetch();
		return b?a:-a;
	}

	inline int tc()
	{
		int c=fetch();
		while(c<=32 && c!=EOF)c=fetch();
		return c;
	}
}
using ae86::ty;
using ae86::tc;

const int _ = 1007 , mo = 1000000007;

inline lint powa(lint a,lint t)
{
	lint b=1;
	while(t){if(t&1)b=b*a%mo;a=a*a%mo,t>>=1;}
	return b;
}

inline lint inva(lint a){return powa(a,mo-2);}

const int M = 3;

struct martix
{
	lint val[M][M];

	inline lint* operator [] (int x){return val[x];}

	martix(){memset(val,0,sizeof(val));}

	void be0(){memset(val,0,sizeof(val));}
	void be1(){memset(val,0,sizeof(val));for(int i=0;i<M;i++)val[i][i]=1;}
	
	inline friend martix operator * (martix a,martix b)
	{
		martix c;
		for(int i=0;i<M;i++)
			for(int j=0;j<M;j++)
				for(int k=0;k<M;k++)
					c[i][j]=(c[i][j]+a[i][k]*b[k][j]%mo)%mo;
		return c;
	}
};

inline martix powa(martix a,lint t)
{
	martix b;b.be1();
	while(t){if(t&1)b=b*a;a=a*a,t>>=1;}
	return b;
}

int H,W,val[_][_],sval=0,xh=0,xw=0,ph=0,pw=0;
lint tim;

int main()
{
	H=ty(),W=ty(),tim=ty();
	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++)
			val[i][j]=tc()=='#',sval+=val[i][j];

	if(tim<=1){puts("1");return 0;}

	for(int i=1;i<=H;i++)xh+=val[i][1]&val[i][W];
	for(int i=1;i<=W;i++)xw+=val[1][i]&val[H][i];
	for(int i=1;i<=H;i++)
		for(int j=1;j<=W;j++)
		{
			if(i<H)pw+=val[i][j]&val[i+1][j];
			if(j<W)ph+=val[i][j]&val[i][j+1];
		}
	
	if(xh<=0 && xw<=0){printf("%lld\n",powa(sval,tim-1));return 0;}
	if(xh>0 && xw>0){puts("1");return 0;}
	if(xh<=0)swap(xh,xw),swap(ph,pw);

	martix bas,tran;

	bas[0][0]=sval,bas[0][1]=ph,bas[0][2]=xh;
	tran[0][0]=sval,tran[1][1]=sval,tran[2][1]=ph,tran[2][2]=xh;

	bas=bas*powa(tran,tim-2);
	printf("%lld\n",(bas[0][0]-bas[0][1]+mo)%mo);
	
	return 0;
}


Measured memory_bytes: 4224
a,b,c,d = map(int, input().split())

aa = c-a
bb = d-b
ans = ''
for i in range(bb):
	ans = ans + 'U'
for i in range(aa):
	ans = ans + 'R'
for i in range(bb):
	ans = ans + 'D'
for i in range(aa):
	ans = ans + 'L'

ans = ans + 'L'
for i in range(bb+1):
	ans = ans + 'U'
for i in range(aa+1):
	ans = ans + 'R'
ans = ans + 'D'
ans = ans + 'R'
for i in range(bb+1):
	ans = ans + 'D'
for i in range(aa+1):
	ans = ans + 'L'
ans = ans + 'U'

print(ans)

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

int main() {
    int a, b;
    cin >> a >> b;
    if (a > 0) {
        cout << "Positive" << '\n';
    } else if (b >= 0) {
        cout << "Zero" << '\n';
    } else {
        int x = b - a + 1;
        if (x & 1) {
            cout << "Negative" << '\n';
        } else {
            cout << "Positive" << '\n';
        }
    }
    
    return 0;
}


Measured memory_bytes: 3596
# WA
import math
n = int(input())
a = [0] * n;  b = [0] * n;
for i in range(n):
    a[i], b[i] = [int(x) for x in input().split()]
p = 10 ** 9 + 7

# d = [0] * n
dict = {}
for i in range(n):
    d = math.gcd(a[i], b[i])
    if d > 0:
        aa = a[i] // d
        bb = b[i] // d
    else:
        aa = a[i]
        bb = b[i]
    if aa < 0: # 非負数にする
        aa = -aa
        bb = -bb
    if aa == 0 and bb > 0:
        bb = -bb
    # print("aa, bb = {}, {}".format(aa, bb))
    if (aa, bb) in dict:
        dict[(aa, bb)] += 1
    else:
        dict[(aa, bb)] = 1

bad = []
others = []
zeros = 0

for (aa, bb) in dict:
    if dict[(aa, bb)] == 0: continue
    if aa == 0 and bb == 0:
        zeros += dict[(aa, bb)]
        dict[(aa, bb)] = 0
    elif (bb, -aa) in dict:
        bad.append((dict[(aa, bb)], dict[(bb, -aa)]))
        dict[(bb, -aa)] = 0
    elif (-bb, aa) in dict:
        bad.append((dict[(aa, bb)], dict[(-bb, aa)]))
        dict[(-bb, aa)] = 0
    else:
        others.append(dict[(aa, bb)])
    dict[(aa, bb)] = 0

ans = 1
for (x, y) in bad:
    ans = ans * (pow(2, x, p) + pow(2, y, p) - 1) % p
for z in others:
    ans = ans * pow(2, z, p) % p
ans = (ans - 1) % p
if zeros > 0:
    ans = (ans + zeros) % p
print(ans)

Measured memory_bytes: 62212
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
typedef long long ll;
 
int main() {
  ll a,b,c;cin>>a>>b>>c;
  ll d=max(max(a,b),c);
  cout<<a+b+c-d;
  return 0;
}

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

namespace Atcoder
{

    public class Class1
    {
        static void Main(string[] args)
        {
            int count = 0;
            var a = Console.ReadLine();
            foreach (var item in a)
            {
                if (item == '1')
                {
                    count++;
                }

            }
            Console.WriteLine(count);
        }
    }

}


Measured memory_bytes: 11092
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

int dy[] = {0,1,0,-1};
int dx[] = {1,0,-1,0};
int dy8[] = {0,1,1,1,0,-1,-1,-1};
int dx8[] = {1,1,0,-1,-1,-1,0,1};

/*==================================================*/
/*variable*/
ll N , a[10010];
ll dp[10010][2][1];
/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>N;
    REP(i,0,N){
        cin>>a[i];
    }


    ll ans = 0;
    REP(i,0,N){
        ll cnt = 0;
        while(a[i] % 2LL == 0LL && a[i] > 0LL){
            a[i] /= 2;
            cnt++;
        }
        ans += cnt;
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,sum;
  sum = 0;
  cin >> n;
  vector<int> l(n);
  for(int i = 0;i < n;i++){
    cin >> l.at(i);
    sum += l.at(i);
  }    
  sort(l.begin(),l.end());
  if(sum-l.at(n-1) > l.at(n-1))cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int[] d = new int[n];
        for (int i = 0; i < d.length; i++) {
            d[i] = scanner.nextInt();
        }
        Arrays.sort(d);
        int best = c / a;
        for (int i = 1; i <= d.length; i++) {
            int cal = c;
            int price = a + b * i;
            for (int j = 1; j <= i; j++) {
                cal += d[d.length - j];
            }
            if (cal / price > best) {
                best = cal / price;
            }
        }
        System.out.println(best);
    }
}



Measured memory_bytes: 26372
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>
#define LL long long
const int N=100005;
using namespace std;

LL n,m,a[N],b[N],la=0,ans,lb=0,x;

int main(){
	scanf("%lld%lld",&n,&m);
	for(LL i=1;i<=n;i++){
		scanf("%lld",&x);
		if(x<0)a[++la]=0-x;
		else b[++lb]=x;
	}
	sort(a+1,a+la+1);
	ans=1e14;
	if(la>=m)ans=min(ans,a[m]);
	if(lb>=m)ans=min(ans,b[m]);
	//if(b[1]==0)if(la>=m-1)ans=min(ans,a[m-1]);
	for(LL i=1;i<=la;i++){
		if(m-i>lb)continue;
		if(m-i<=0)break;
		ans=min(ans,a[i]*2+b[m-i]);
	}
	for(LL i=1;i<=lb;i++){
		if(m-i>la)continue;
		if(m-i<=0)break;
		ans=min(ans,b[i]*2+a[m-i]);
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
int A, B;
cin >> A >> B;

if(A != 1 && B != 1){
  cout << 1;
}
if(A != 2 && B != 2){
  cout << 2;
}
if(A != 3 && B != 3){
  cout << 3;
}
  
}

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vl v(n);
	REP(i, n)cin >> v[i];
	ll ans = 0, cmax = 2;
	ans += v[0] - 1;
	FOR(i,1, n) {
		if (v[i] == cmax) {
			cmax++;
		}
		else {
			if (v[i] % cmax == 0) {
				ans++;
				v[i] -= cmax+1;
			}
			ans += v[i] / cmax;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 1024
import statistics

n = int(input())
A = list(map(int, input().split()))
A_1 = [A[i] - (i+1) for i in range(n)]
m = int(statistics.median(A_1))
A_2 = [abs(m - A_1[i]) for i in range(n)]
print(sum(A_2))


Measured memory_bytes: 35528
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int a = -1;
        int b = -1;

        for(int i=0; i<s.length(); i++) {
            if(i < s.length() - 1 && s.charAt(i) == s.charAt(i+1)) {
                a = i+1;
                b = i+2;
                break;
            }
            if(i < s.length() - 2 && s.charAt(i) == s.charAt(i+2)) {
                a = i+1;
                b = i+3;
                break;
            }
        }

        System.out.println(a + " " + b);

        in.close();
    }
}


Measured memory_bytes: 13484
import java.io.*;
import java.util.*;

class Process {
   private String name;
   private int time;
  
   public Process(String name, int time) {
       this.name = name;
       this.time = time;
   }
  
   public int getTime() {
       return time;
   }

   public void setTime(int time) {
       this.time = time;
   }

   public String getName() {
       return name;
   }
  
  
}
public class Main {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);
       int inputProcesses = in.nextInt();
       int quantum = in.nextInt();

       Queue<Process> processes = new LinkedList<Process>();

       for (int i = 0; i < inputProcesses; i++) {
           String nameIndex = in.next();
           int timeIndex = in.nextInt();
          
           Process processIndex = new Process(nameIndex, timeIndex);
           processes.add(processIndex);
       }
       int currTime = 0;
       while(!processes.isEmpty()) {
           Process head = processes.poll();
           if (head.getTime() > quantum) {
          	   head.setTime(head.getTime() - quantum);
               currTime += quantum;
               processes.add(head);
           }
           else {
               currTime += head.getTime();
               System.out.println(head.getName() + " " + currTime);
           }
       }
   }
}


Measured memory_bytes: 75472
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
using ll = long long;

// union by size + path having
class UnionFind {
public:
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

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

    vector<vector<int>> data(M, vector<int>(2));//input　　

    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        data[i][0] = a;
        data[i][1] = b;
        //cout << data[i][0] << " " << data[i][1]<< endl;
    }
  
    vector<ll> ans(M + 1);
    ll zero = 0;
    ans[M] = N * (N - 1) / 2;
    //cout << ans[M]<<" " << N << " "<<N * (N - 1) << endl;
  
    UnionFind tree(N + 1);
      
    for (int i = M - 1; i >= 0; i--) {
      ll one, two;
      one = tree.size(data[i][0]);
      two = tree.size(data[i][1]);
      if (tree.issame(data[i][0], data[i][1])){
        ans[i] = ans[i + 1];
      }
      else{
        ans[i] = max(zero, ans[i + 1] - one * two);
      }
      tree.merge(data[i][0], data[i][1]);
    }
    for (int i = 1; i < M + 1; i++) {
      cout << ans[i] << endl;
    }
  
    return 0;
}


Measured memory_bytes: 9088
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        //山の数
        int N = Integer.parseInt(sc.next());
        //ダムの数
        int [] Ni = new int[N];

        //総降雨量
        int S = 0;

        for (int i=0; i < N;i++) {

            //ダムごとの降った雨量
            Ni[i] = Integer.parseInt(sc.next());

            S += Ni[i];
        }

        sc.close();

        //1個目の山
        int X1 = ansX1(N, Ni, S);

        //i個目の山ごとの貯水量を出力
        ansXi(N, Ni, 0, X1, 0);

    }

    public static int ansX1(int N, int[] Ni, int S) {

        int X1 = S;

         for (int i = 1; i < N; i = i + 2) {

             X1 += - 2*Ni[i];
         }

         return X1;
    }

    public static int ansXi(int N, int[] Ni, int i, int X1, int Xi) {


        if (i == 0) {

            System.out.print (X1);
            System.out.print(" ");
            i++;
            return ansXi(N,Ni,i,X1,X1);

        } else if (i == N) {

            return -1;
        } else {

            int Xiadd1 = 2*Ni[i-1] -Xi;
            System.out.print(Xiadd1);
            System.out.print(" ");
            i++;
            return ansXi(N, Ni, i, X1, Xiadd1);
        }
    }

}


Measured memory_bytes: 68648
#include <stdio.h>

int main(void)
{
	int num[128];
	int rank[128];
	int i, j;
	int t;
	int n;
	
	for (i = 0; i < 128; i++){
		rank[i] = 0;
	}
	i = 0;
	while (scanf("%d,%d", &n, &rank[i]), n != 0 || rank[i] != 0){
		num[n] = rank[i];
		for (j = i; j > 0; j--){
			if (rank[j] > rank[j - 1]){
				t = rank[j - 1];
				rank[j - 1] = rank[j];
				rank[j] = t;
			}
			if (rank[j] == rank[j - 1]){
				rank[j] = 0;
			}
		}
		i++;
	}
	n = i;
	for (i = 0; i < n - 1; i++){
		for (j = n - 1; j >= 1 + i; j--){
			if (rank[j] > rank[j - 1]){
				t = rank[j - 1];
				rank[j - 1] = rank[j];
				rank[j] = t;
			}
		}
	}
	while (scanf("%d", &n) != EOF){
		for (i = 0; i < 108; i++){
			if (num[n] == rank[i]){
				printf("%d\n", i + 1);
				break;
			}
		}
	}
	return (0);
}

Measured memory_bytes: 1028
#include <iostream>
using namespace std;
int main() {
    int N,cnt=0;
    cin >> N;
    int tmp,A[N];
    for (int i=0; i<N; i++) {
        cin >> tmp;
        A[tmp-1] = i + 1;
    }
    for (int i=0; i<N; i++) cout << A[i] << ' ';
    cout << endl;
    return 0;
}


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

typedef long long ll;

using namespace std;


//-------------------------↓↓↓↓↓↓------------------------

ll n, a[100002], sousa;

bool check1(){
    ll sum = 0, summ = 0; 
    for(int i = 0; i < n; i++){
        sum += a[i];
        summ += (i + 1);
    }
    sousa = sum / summ;
    if(sum % summ == 0)return true;
    else return false;
}

bool check2(){
    ll ma = 0, mi = 1e18;
    for(int i = 0; i < n; i++){
        ma = max(ma, a[i]);
        mi = min(mi, a[i]);
    }
    if(ma > sousa * n || mi < sousa)return false;
    else return true;
}

bool check3(){
    ll pos, sum = 0, now, tmp;
    bool ok = true;
    for(int i = 0; i < n; i++){
        pos = abs(a[i + 1] - a[i]);
        tmp = pos;
        sum += pos / (n - 1);
        now = pos / (n - 1);
        if(pos % (n - 1) != 0)sum++,now++;
        pos -= pos * now;
        if (tmp == sousa)return true;
        if(abs(pos) != sousa - now)ok = false;
    }
    if(sum != sousa)return false;
    else return ok;
}

int main(void){
  
       cin.tie(0);
    ios::sync_with_stdio(false);
      
       cin >> n;
       for(int i = 0; i < n; i++){
           cin >> a[i];
       }
       
       if(n == 1)cout << "YES\n";
       else{
       if(!check1() || !check2()){
           cout << "NO\n";
       }
       else{
           if(!check3())cout << "NO\n";
           else cout << "YES\n";
       }
       }
      
    
       
return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
long long a,b,c;
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    //A
    cin>>a>>b>>c;
    long long s=0;
    for(int i=a;i<=c;i+=a)s+=b;
    cout<<s<<endl;
    /*C


    */
    /*B


    */
}


Measured memory_bytes: 256
h, w, a, b = map(int, input().split())
m = h + w
mod = 10 ** 9 + 7

fac = [1] * (m + 1)
inv = [1] * (m + 1)
for i in range(1, m + 1):
    fac[i] = fac[i - 1] * i % mod
inv[-1] = pow(fac[-1], mod - 2, mod)
for i in range(m - 1, -1, -1):
    inv[i] = inv[i + 1] * (i + 1) % mod


def cmb(n, r):
    assert n >= r >= 0
    return fac[n] * inv[n - r] * inv[r] % mod


ans = sum(cmb(h - a + i - 1, i) * cmb(a + w - 2 - i, a - 1) % mod for i in range(b, w))
print(ans % mod)

Measured memory_bytes: 44396
N,M,K=map(int, input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 47336
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,cnt1,cnt2,max,answer;
	cnt1=0;
	cnt2=0;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	while(!(b<=0)) {
		b=b-d;
		cnt1++;
	}
	while(!(c<=0)) {
		c=c-e;
		cnt2++;
	}
	if(cnt1>cnt2) {
		max=cnt1;
	}
	else {
		max=cnt2;
	}
	answer=a-max;
	printf("%d\n",answer);
	return 0;
}

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

int main(){
  int i=0,x,l;
  char s[1001]={};

  while(1){
    scanf("%s",s);
    l = strlen(s);
    if(l==1 && s[0] == '0'){
      break;
    }
    x = 0;
    for(i=0;i<l;i++){
      x += s[i]-'0';
    }
    printf("%d\n",x);
  }

  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define lol long long
#define mp(x,y) make_pair(x,y)
using namespace std;

// const lol mod=1e9+7;

/*  author: H3XoRuSH  */

int main() {
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string a,b;
    cin >> a >> b;
    lol dp[a.length()+1][b.length()+1];
    for(lol i=0; i<=a.length(); i++){
        for(lol j=0; j<=b.length(); j++){
            if(i==0 || j==0) dp[i][j]=0;
            else if(a[i-1]==b[j-1]) dp[i][j]=dp[i-1][j-1]+1;
            else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    string ans="";
    lol x=a.length(),y=b.length();
    while(x>0 && y>0){
        if(a[x-1]==b[y-1]){
            ans=a[x-1]+ans;
            x--; y--;
        }
        else if(dp[x-1][y]>dp[x][y-1]) x--;
        else y--;
    }
    if(ans.length()==0) cout << "";
    else cout << ans;
    return 0;
}


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

long long n, k;
long long w[100005], v[100005];

long long dp[105][100005];

long long f(int i, int W) {
    if(dp[i][W] != -1) return dp[i][W];
    if(i == n) return 0;
    
    long long a = 0, b = 0;
    if(w[i] <= W) {
        a = v[i] + f(i+1, W-w[i]);
    }
    b = f(i+1, W);
    
    return dp[i][W] = max(a, b);
}

int main() {
	// your code goes here
	cin >> n >> k;
	for(int i = 0; i < n; i++) {
	    cin >> w[i] >> v[i];
	}
	memset(dp, -1, sizeof dp);
	
	cout << f(0, k);
	return 0;
}


Measured memory_bytes: 82432
def oginau(k):
  if len(k)!=N:
    k=str(("0"*(N-len(k)))+k)
    return k
  else:
    return k
N,M,X=map(int,input().split())
L=[[] for i in range(N)]
for i in range(N):
  L1=list(map(int,input().split()))
  L[i]=L1
mina=10**10
for i in range(2**N):
  R=[0 for i in range(M)]
  money=0
  s=str(bin(i)[2:])
  s=oginau(s)
  for j in range(N):
    if s[j]=="1":
      money+=L[j][0]
      for w in range(1,M+1):
        R[w-1]+=L[j][w]
  if len([i for i in R if i>=X])==M:
    mina=min(money,mina)
if mina==10**10:
  print(-1)
else:
  print(mina)

Measured memory_bytes: 9160
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let n : usize = read();
    let mut a : Vec<i64> = readnc();
    a.sort();
    a.reverse();

    let mut pair: Vec<i64> = vec![0, 0];

    let mut head = 0;
    while head < n {
        let mut to = head;
        while to < n && a[to] == a[head] {
            to += 1;
        }
        let mut len = to - head;
        while len >= 2 {
            pair.push(a[head]);
            len -= 2;
        }
        head = to;
    }

    pair.sort();
    pair.reverse();

    println!("{}", pair[0] * pair[1]);
}


Measured memory_bytes: 8444