akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
const int INF=1001001001001001;
vector<int> s;//???????????????
    vector<int> up;//???????????????
    vector< pair<int,int> > yoko;
    int a[100002],b[100002];
    int n,m,h,k;
//??\????????????????????????
class Amidakuji{
    private:
    void init(){
        if(yoko.size())yoko.clear();
        if(up.size())up.clear();
        if(s.size())s.clear();
        return;
    }
    public:
    int solve(){ 
        init();
        scanf("%d %d %d %d",&n,&m,&h,&k);//n??¬????£????m??¬?¨??£?,h????£?????????????1~k???????????§????¨????????°????????±???????
        if(n==0&&m==0&&h==0&&k==0)return (int)-1;
        rep(i,n){
            int S;
            scanf("%d",&S);
            s.push_back(S);
        }
        rep(i,m){
            scanf("%d %d",&a[i],&b[i]);
            a[i]--;
            yoko.push_back( mp(b[i],i ) );
            up.push_back(i);
        }
        
        sort(yoko.begin(),yoko.end(), greater<pair<int,int> >() );
        
        rep(i,m){
            swap(s[a[yoko[i].second] ],s[a[yoko[i].second]+1]);
        }//s[i]=i??????????????¨?????????????????°??¨?????????(?£????????????????????????£?????¨???)
        int fans=0;
        rep(i,k){
            fans+=s[i];
        }//?£????????????????????????£?????¨????????????
        int ans=fans;
        sort(yoko.begin(),yoko.end());
        rep(i,m){//???????????????????????¨?????????
           //????????????????£???????????????????????£???????????????????????????????*?????????*??????????????????????????????1~k????????±???????????????
           //s[up[a[yoko[i].second] ]],s[up[a[yoko[i].second]+1]]?????\????????????
           int mi=min(up[a[yoko[i].second] ],up[a[yoko[i].second]+1]); int ma=max(up[a[yoko[i].second] ],up[a[yoko[i].second]+1]);
           if(mi<k&&ma>=k){ans=min(ans,fans-s[mi]+s[ma]);}
           //?¬???????????????????????????????
           swap(up[a[yoko[i].second] ],up[a[yoko[i].second]+1]);
        }
        return ans;
    }
};
signed main(){
    while(1){
       Amidakuji ans;
       int pr=ans.solve();
       if(pr==-1)break;
       printf("%d\n",pr);
    }
    return 0;
}

Measured memory_bytes: 7448
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int A,B,C;
	cin >> A >> B >> C;
	int K;
	cin >> K;
	string ans = "No";
	for(int i=0; i<K; i++){
		if(A<B*pow(2,i) && B*pow(2,i)<C*pow(2,(K-i)))
			ans = "Yes";
	}
	cout << ans << endl;
}

Measured memory_bytes: 3968
import java.util.*;

public class Main {
    static boolean canPass[][];
    static Boolean visited[];
    static int n;
    
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int m = sc.nextInt();
        int[] p = new int[m];
        int[] q = new int[m];
        canPass = new boolean[n][n];
        visited = new Boolean[n];
        
        for (int i = 0; i < m; i++) {
            p[i] = sc.nextInt() - 1;
            q[i] = sc.nextInt() - 1;
            canPass[p[i]][q[i]] = true;
            canPass[q[i]][p[i]] = true;
        }
        
        int count = 0;
        for (int i = 0; i < m; i++) {
            Arrays.fill(visited, false);
            
            // i番目の辺を通行止めにする
            canPass[p[i]][q[i]] = false;
            canPass[q[i]][p[i]] = false;

            dfs(0);
            
            boolean notConnected = Arrays.asList(visited).contains(false);
            if (notConnected) {
                count++;
            }
            
            canPass[p[i]][q[i]] = true;
            canPass[q[i]][p[i]] = true;

        }
        System.out.println(count);

    }
    public static void dfs(int p) {
        if (visited[p]) return;
        
        visited[p] = true;
        for (int q = 0; q < n; q++) {
            if (canPass[p][q]) {
                dfs(q);
            }
        }
    }
}


Measured memory_bytes: 22228
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P; typedef unsigned long long int ull;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define vec vector<int>
#define vecd vector<double>
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}
std::string sreverse(string str, int firstItr, int secondItr) {
	if (firstItr < 0 || secondItr>int(str.size() - 1))return str;
	while (firstItr < secondItr) {
		swap(str[firstItr], str[secondItr]);
		firstItr++; secondItr--;
	}
	return str;
}
std::string RunLengthEncoding(std::string str) {
	int itr = 0; std::string res;
	while (itr < int(str.size())) {
		char tmp = str[itr++];
		int length = 1;
		while (itr <int(str.size()) && str[itr] == tmp) { ++itr; ++length; }
		res.push_back(tmp);
		res += to_string(length);
	}
	return res;
}
std::string split(std::string str, size_t first_itr, bool isFront) {
	if (first_itr < 0 || first_itr > str.size()) {
		return str;
	}
	else {
		if (isFront) {
			std::string tmp;
			for (size_t i = 0; i < first_itr; i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
		else {
			std::string tmp;
			for (size_t i = first_itr; i < str.size(); i++) {
				tmp.push_back(str.at(i));
			}
			return tmp;
		}
	}
}


bool dfs(int depth, str s) {
	/*if (depth == n) {
		ans.push_back(s);
		return false;
	}
	for (int i = 0; i < n; i++) {
		if (dfs(depth + 1, s + dic.at(i))) {
			return true;
		}
	}*/
	return false;
}


int N, M;
int WA[105000];
bool AC[105000];

void solve() {
	cin >> N >> M;
	int WAnum = 0, ACnum = 0;
	REP(i, 1, N) {
		WA[i] = 0;
		AC[i] = false;
	}
	while (M--) {
		int p; str s;
		cin >> p >> s;
		if (AC[p])continue;
		if (s == "AC") {
			AC[p] = true;
			++ACnum;
			WAnum += WA[p];
		}
		else if (s == "WA") {
			WA[p]++;
		}
	}
	cout << ACnum << " " << WAnum << endl;
	return;
}



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

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll r,d,x,i,y;
  cin>>r>>d>>x;
  
  for(i=0;i<10;i++){
	y=r*x-d;
    cout<<y<<endl;
    x=y;
  }

}
   

Measured memory_bytes: 256
var
	M,L,R,ans,ll,rr:int64;
    k,i,x,y,xl,yl,limx,limy,xx,yy,id,ie:Longint;
    dp:array[1..60,1..2,1..2]of int64;
begin
	read(L,R);
    M:=1000000007;
    ll:=1;
    rr:=2;
    for k:=1 to 60 do begin
    	if(rr<=L)or(R<ll)then begin
        	ll:=ll*2;
            rr:=rr*2;
        	continue;
        end;
        for i:=1 to k do begin
        	dp[i,1,1]:=0;
        	dp[i,1,2]:=0;
        	dp[i,2,1]:=0;
        	dp[i,2,2]:=0;
        end;
        if L<=ll then if rr-1<=R then dp[1,2,2]:=1 else dp[1,2,1]:=1 else if rr-1<=R then dp[1,1,2]:=1 else dp[1,1,1]:=1;
        for i:=1 to k-1 do begin
        	x:=(L>>(k-1-i))mod 2;
            y:=(R>>(k-1-i))mod 2;
            for xl:=1 to 2 do begin
            	if xl=1 then limx:=x else limx:=0;
                for yl:=1 to 2 do begin
                	if dp[i,xl,yl]=0 then continue;
                	if yl=1 then limy:=y else limy:=1;
                    if(limx=1)and(limy=1)then begin
                    	dp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;
                    end else if(limx=0)and(limy=1)then begin
                    	dp[i+1,xl,2]:=(dp[i+1,xl,2]+dp[i,xl,yl])mod M;
                        dp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;
                        dp[i+1,2,yl]:=(dp[i+1,2,yl]+dp[i,xl,yl])mod M;
                    end else if(limx=0)and(limy=0)then begin
                    	dp[i+1,xl,yl]:=(dp[i+1,xl,yl]+dp[i,xl,yl])mod M;
                    end;
                end;
            end;
        end;
        ll:=ll*2;
        rr:=rr*2;
        ans:=(ans+dp[k,1,1]+dp[k,1,2]+dp[k,2,1]+dp[k,2,2])mod M;
    end;
    writeln(ans);
end.

Measured memory_bytes: 128
def abc_of_ABC(S):
    l = [S[0], S[1], S[2]]
    l.sort()
    if l == ['a', 'b', 'c']:
        print('Yes')
    else:
        print('No')

def main():
    S = input()
    abc_of_ABC(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
def calc(al,bo,a):
  if len(al)-len(bo) != 0:
    bo.append(a)
  else :
    al.append(a)
  return al,bo
    
N=int(input())
a=input().split()
a=[int(k) for k in a]
a.sort()

alice = []
bob = []

while(N!=0):
  alice,bob = calc(alice,bob,a[N-1])
  N -= 1
  
print(sum(alice)-sum(bob))

Measured memory_bytes: 3064
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <iomanip>
#include <cassert>
#include <numeric>
using namespace std;
 
#define ff first
#define ss second
#define pb push_back 
 
using LL = long long int;
using VL = vector<LL>;
using VI = vector<int>;
using VVL = vector<VL>;
using PLL = pair<LL,LL>;
using PII = pair<int ,int>;
 
#ifdef DEBUG
void _print()
{
  cout << endl;
}
template<typename T, typename... Args >
void _print(const T first_elem, const Args... args)
{
  cout << first_elem << " ";
  _print(args...);
}
#else
void _print()
{
}
template<typename T, typename... Args >
void _print(const T first_elem, const Args... args)
{
}
#endif
 
 
// NOTE: Please dont implement _print() as function in your program. It is reserved
// for debug purpose.

int main()
{
    ios::sync_with_stdio(false);
    LL n;
    cin >> n;
    LL ans = 0;
    for (int j = 1; j < n; j++) {
        LL cnt = 0;
        for (int k = j; k < n; k += j) {
            ++cnt;
        }

        ans += cnt;
    }

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

Measured memory_bytes: 3196
#include <iostream>
#include <cmath>
#include<vector>
#include <algorithm>
#include <utility>
#include<stack>
#include<queue>
#include<map>
#include <fstream>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long

int n,d;
        long long x[30][30];

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

        int l,r;
         long long res=1000000000000000000;
        cin>>l>>r;
        if( r-l+1 >=2019 ) cout<<0<<endl;

        else{
            for( int i=l;i <=r;i++ ){
                for( int j=i+1;j<=r;j++ ){
                    long long tmp = ( i%2019 )*( j%2019 );
                    tmp%=2019;
                    res=min( res, tmp );
                }
            }
             cout<<res<<endl;
        }

      return 0;
    }



























Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
constexpr int MAX = 100005;
struct Node {
	int oya = -1, kai = 0, len_ko = 0;
	string shu = "root";
	vi ko;
};
vector<Node> T(MAX);
inline void rec(int u, int p) {
	T[u].kai = p;
	rep(i, 0, len(T[u].ko)) {
		rec(T[u].ko[i], p + 1);
	}
}
int main() {
	int n; cin >> n;
	int v, d, c;
	rep(i, 0, n) {
		cin >> v >> d;
		if(d == 0 && T[v].shu == "leaf") continue;
		rep(j, 0, d) {
			cin >> c;
			if(T[v].shu == "leaf") T[v].shu = "internal node";
			T[v].ko.eb(c);
			++T[v].len_ko;
			T[c].oya = v;
			if(len(T[c].ko)) T[c].shu = "internal node";
			else T[c].shu = "leaf";
		}
	}
	int root = 0;
	rep(i, 0, n) {
		if(T[i].shu == "root") { root = i; break; }
	}
	rec(root, 0);
	rep(i, 0, n) {
		cout << "node " << i << ": parent = " << T[i].oya << ", depth = " << T[i].kai
				<< ", " << T[i].shu << ", [";
		if(T[i].len_ko == 0) { P("]"); continue; }
		p(T[i].ko[0]);
		rep(j, 1, T[i].len_ko) {
			cout << ", " << T[i].ko[j];
		}
		P("]");
	}
	return 0;
}

Measured memory_bytes: 12968
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int row,col;
char s[22][22],c[22];
string f[22];
bool gr[22][22],g[22][22];
int a[22];
bool dfs2(int i,int mask){
	if(i == -1){
		return true;
	}
	int u = col-1-i;
	if(u == i){
		for(int j=0; j<col; j++){
			if(dfs2(i-1, mask|(1<<j)))
				return true;
		}
	}else{
		int t = 0;while(mask&(1<<t))t++;
		mask |= 1<<t;
		for(int j=0; j<col; j++)if((mask&(1<<j))==0 && g[t][j]){
			if(dfs2(i-1, mask|(1<<j)))
				return true;
		}
	}
	return false;
}
bool dfs(int i,int mask){
	if(i == -1){
		for(int i=0; i<col; i++)
		for(int j=0; j<col; j++){
			bool flag = true;
			for(int k=0; k<row; k++)
				if(s[a[k]][i] != s[a[row-1-k]][j]){
					flag = false;
					break;
				}
			g[i][j] = flag;
		}
		return dfs2((col-1)/2,0);
	}
	int u = row-1-i;
	if(u == i){
		for(int j=0; j<row; j++){
			a[i] = j;
			if(dfs(i-1, mask|(1<<j)))
				return true;
		}
	}else{
		int t = 0;while(mask&(1<<t))t++;
		a[i] = t;
		mask |= 1<<t;
		for(int j=0; j<row; j++)if((mask&(1<<j))==0 && gr[t][j]){
			a[u] = j;
			if(dfs(i-1, mask|(1<<j)))
				return true;
		}
	}
	return false;
}
int main(){
	scanf("%d%d",&row,&col);
	for(int i=0; i<row; i++)
		scanf("%s",s[i]);
	for(int i=0; i<row; i++){
		for(int j=0; j<col; j++)
			c[j] = s[i][j];
		sort(c,c+col);
		f[i] = "";
		for(int j=0; j<col; j++)
			f[i] += c[j];
	}
	for(int i=0; i<row; i++)for(int j=0; j<row; j++)
		gr[i][j] = (f[i] == f[j]);
	puts(dfs((row-1)/2,0) ? "YES" : "NO");
	return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

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

left = 0; right = 0; res = 0; xor = 0; ans = 0
for _ in range(N):
    if right == N and left == N:
        break
    for i in range(right,N):
        if res + A[i] == xor ^ A[i]:
            res += A[i]
            xor = xor ^ A[i]
            right += 1
        else:
            break
    ans += right - left
    if left == right:
        right += 1
    else:
        res -= A[left]
        xor -= A[left]
    left += 1

print(ans)

Measured memory_bytes: 24528
/*
 * @Author: Kaizyn
 * @Date: 2020-07-08 20:28:34
 * @LastEditTime: 2020-07-11 21:29:25
 */ 
#include <bits/stdc++.h>

// #define DEBUG

using namespace std;

const double eps = 1e-7;
const double PI = acos(-1);
typedef pair<int, int> pii;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const int N = 2e5+7;

template <int _MOD> struct Mint {
  int v = 0;
  Mint() {}
  Mint(int _v) : v((_v%_MOD+_MOD)%_MOD) {}
  Mint(long long _v) : v(static_cast<int>((_v%_MOD+_MOD)%_MOD)) {}
  Mint operator = (const int &_v) { return *this = Mint(_v); }
  Mint operator = (const long long &_v) { return *this = Mint(_v); }
  bool operator ! () const { return !this->v; }
  bool operator < (const Mint &b) const { return v < b.v; }
  bool operator > (const Mint &b) const { return v > b.v; }
  bool operator == (const Mint &b) const { return v == b.v; }
  bool operator != (const Mint &b) const { return v != b.v; }
  bool operator <= (const Mint &b) const { return v < b.v || v == b.v; }
  bool operator >= (const Mint &b) const { return v > b.v || v == b.v; }
  Mint operator + (const Mint &b) const { return Mint(v+b.v); }
  Mint operator - (const Mint &b) const { return Mint(v-b.v); }
  Mint operator * (const Mint &b) const { return Mint(1ll*v*b.v); }
  Mint operator / (const Mint &b) const { return Mint(b.inv()*v); }
  Mint& operator += (const Mint &b) { return *this = *this+b; }
  Mint& operator -= (const Mint &b) { return *this = *this-b; }
  Mint& operator *= (const Mint &b) { return *this = *this*b; }
  Mint& operator /= (const Mint &b) { return *this = *this/b; }
  Mint operator - () const { return Mint(-v); }
  Mint& operator ++ () { return *this += 1; }
  Mint& operator -- () { return *this -= 1; }
  Mint operator ++ (int) { Mint tmp = *this; *this += 1; return tmp; }
  Mint operator -- (int) { Mint tmp = *this; *this -= 1; return tmp; }
  Mint pow(int p) const {
    Mint res(1), x(*this);
    while (p) {
      if (p&1) res = res*x;
      x *= x;
      p >>= 1;
    }
    return res;
  }
  Mint inv() const { return pow(_MOD-2); }
  friend istream& operator >> (istream &is, Mint &mt) { return is >> mt.v; }
  friend ostream& operator << (ostream &os, const Mint &mt) { return os << mt.v; }
};
using mint = Mint<MOD>;

int n, k;
long long a[N];

inline void solve() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  sort(a+1, a+n+1);

  mint res = 1;
  if (k%2 == 1 && a[n] <= 0) {
    res = 1;
    for (int i = 1; i <= k; ++i) res *= a[n-i+1];
    cout << res << endl;
    return;
  }
  int l = 1, r = n;
  if (k&1) res = a[r--];
  for ( ; k >= 2; k -= 2) {
    if (a[l]*a[l+1] >= a[r]*a[r-1]) {
      res *= a[l]*a[l+1];
      l += 2;
    } else {
      res *= a[r]*a[r-1];
      r -= 2;
    }
  }
  cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int T = 1;
  // cin >> T;
  for (int t = 1; t <= T; ++t) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 5160
#include <stdio.h>

int main(void){

  int A[100];
  int i,j,k,n,minj,x=0,flag=0;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  for(i=0;i<n;i++){
    minj = i;
      flag = 0;
    for(j=i;j<n;j++){
      if(A[j] < A[minj]){
	minj = j;
	flag = 1;
      }
    }
    if(flag == 1)
      x++;
    k = A[i];
    A[i] = A[minj];
    A[minj] = k;
  }

  for(i=0;i<n;i++){
    if(i == n - 1){
      printf("%d\n",A[i]);
      break;
    }
    printf("%d ",A[i]);
  }
  printf("%d\n",x);
  return 0;
}

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

using namespace std;
typedef long long ll;

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

    int ans = 0;
    int cnt = 0;
    for (int i = 0; i < S.size(); ++i) {
        if (S[i] == 'A' || S[i] == 'T' || S[i] == 'G' || S[i] == 'C') {
            cnt++;
            if (ans < cnt) ans = cnt;
        } else {
            cnt = 0;
        }
    }

    cout << ans << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
int euclidean_gcd(int a, int b) {
  if(a < b) return euclidean_gcd(b, a);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
signed main()
{
int x=0,y=0,z=0,w=0,n=1,m=0,a=0,b=0;
std::cin >> x;
while(1){
  if(x==4||x==1||x==2){
    std::cout << n+3 << '\n';
    return 0;
  }else{
    if(x%2==0){
      x/=2;
    }else{
      x=3*x+1;
    }
  }
  n++;
}

}


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

int main()
{
    int N;
    scanf("%d", &N);
    int A[N];
    for(int i = 0; i < N; ++i) {
        int tmp;
        scanf("%d", &tmp);
        A[tmp-1] = i+1;
    }
    for(int i = 0; i < N; ++i) printf("%d ", A[i]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 1152
n,m = map(int,input().split())
li = []
for i in range(n):
    a,b = map(int,input().split())
    li.append([a,b])
li = sorted(li)
cnt = 0
coin = 0
i = 0
while True:
    if cnt == m:
        break
    if li[i][1]>0:
        li[i][1]-=1
        coin += li[i][0]
        cnt+=1
    else:
        i += 1
print(coin)

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

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a/g*b;
}

int main() {
  int N;
  cin >> N;
  
  ll ans = 1ll;
  rep (i,N) {
    ll T;
    cin >> T;
    ans = lcm(ans, T);
  }
  
  cout << ans << endl;
  return 0;
}
    

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <list>
#include <iomanip>
#include <set>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
const int MOD=1000000007;
const int INF=1000000000;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;

ll godlogin=INF;
ll godlogout=0;
ll lin[1005];
ll lou[1005];
ll pray[1005];
bool stay[1005];
int main(int argc,char const* argv[])
{
  int n;
  while(cin >> n && n)
    {
      string monday;
      string times;
      char io;
      string id;
      int num;
      ll ans=-1;
      memset(lin,0,sizeof(lin));
      memset(lou,0,sizeof(lou));
      memset(pray,0,sizeof(pray));
      memset(stay,false,sizeof(stay));
      bool godstay=false;
      for(int i=0;i<n;i++)
	{
	  cin >> monday >> times >> io >> id;
	  num=int(id[0]-'0')*100+int(id[1]-'0')*10+int(id[2]-'0');
	  if(io=='I')
	    {
	      lin[num]=(int(monday[0]-'0')*10+int(monday[1]-'0'))*30*3600+(int(monday[3]-'0')*10+int(monday[4]-'0'))*3600+(int(times[0]-'0')*10+int(times[1]-'0'))*60+(int(times[3]-'0')*10+int(times[4]-'0'));
	      if(num==0) godstay=true;
	      else stay[num]=true;
	    }
	  if(io=='O')
	    {
	      lou[num]=(int(monday[0]-'0')*10+int(monday[1]-'0'))*30*3600+(int(monday[3]-'0')*10+int(monday[4]-'0'))*3600+(int(times[0]-'0')*10+int(times[1]-'0'))*60+(int(times[3]-'0')*10+int(times[4]-'0'));
	      if(num==0)
		{
		  godstay=false;
		  for(int i=1;i<1000;i++)
		    {
		      if(stay[i])
			{
			  pray[i]+=(lou[0]-max(lin[i],lin[0]));
			  pray[i]=max(pray[i],(ll)0);
			}
		    }
		}
	      else
		{
		  stay[num]=false;
		  if(godstay)
		    {
		      pray[num]+=(lou[num]-max(lin[num],lin[0]));
		      pray[num]=max(pray[num],(ll)0);
		    }
		}
	    }
	}
      for(int i=1;i<1000;i++)
	{
	  ans=max(ans,pray[i]);
	}
      cout << ans << endl;
    }
  return 0;
}



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


void solve(std::vector<long long> x){
    for (int i = 0; i < x.size(); i++) {
        if(x[i] == 0) {
            cout << i+1 << endl;
            return;
        }
    }
}

int main(){
    std::vector<long long> x(5);
    for(int i = 0 ; i < 5 ; i++){
        scanf("%lld",&x[i]);
    }
    solve(std::move(x));
    return 0;
}


Measured memory_bytes: 3684
def examA():
    A, P = LI()
    ans = (A*3+P)//2
    print(ans)
    return

def examB():
    N = I()
    SP = [[]for _ in range(N)]
    for i in range(N):
        SP[i] = LSI()
        SP[i][1] = int(SP[i][1])
        SP[i].append(i)
#    print(SP)
    SP = sorted(SP,key = lambda x:x[1], reverse = True)
    SP = sorted(SP,key = lambda x:x[0])
#    print(SP)
    for v in SP:
        print(v[2]+1)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N;
pair<string, pair<int,int>>p[100];

int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> p[i].first >> p[i].second.first;
		p[i].second.first = -p[i].second.first;
		p[i].second.second = i + 1;
	}
	sort(p, p + N);
	for (int i = 0; i < N; ++i) {
		cout << p[i].second.second << endl;
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

int main()
{
    int n = 5;
    vector<int> v(n);
    for(int i=0; i<n; ++i)
        cin >> v[i];

    int sum = 0;
    for(int i=0; i<n; ++i)
        sum += (v[i] + 9) / 10 * 10;

    int ans = INT_MAX;
    for(int i=0; i<n; ++i){
        int tmp = sum - (v[i] + 9) / 10 * 10 + v[i];
        ans = min(ans, tmp);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
/* ex3_3
    sak_Citrus*/

#include <stdio.h>

int main(void){
    //numはintだとオーバーフローする
    long int num;
    int base;
    scanf("%ld %d",&num,&base);
    
    //解の初期化、baseで何回割れるかが桁数に一致
    int ans = 0;
    while(1){
        num = num / base;
        ans += 1;
        if(num == 0)
            break;
    }
    //解出力+改行
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
//#define int long long 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

signed main()
{
    string x;
    cin>>x;
    if(x[2]==x[3] && x[4]==x[5]) cout<<"Yes";
    else cout<<"No";

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,a,b,c,d;
  //入力 
  cin >> n >> a >> b;
  //処理
  d = n * a;
    if (d >= b) {
     cout << b << endl; 
    }else{
      cout << d << endl;
    }
  
  //出力
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

void trace(vector<int> A, int N){
  int i;
  REP(i,N){
    if(i > 0)cout << " ";
    cout << A.at(i);
  }
  cout << endl;
}

void inseringsort(vector<int>A, int N){
  int j,i,v;
  REP(i,N){
    if(i ==0)continue;
    v = A[i];
    j = i-1;
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1]= v;
    trace(A,N);
  }
}

int main(){
int N,i,j;
cin >> N;
vector<int> A(100);
REP(i,N) cin >> A.at(i);
trace(A,N);
inseringsort(A,N);
return 0;
}



Measured memory_bytes: 3156
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans = [False]*(k+1)
for i in range(1,k+1):
    ok = False
    for j in a:
        if i-j<0:
            continue
        if ans[i-j] == False:
            ans[i] = True
            break

print('First' if ans[k] else 'Second')

Measured memory_bytes: 3828
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define sz size()
#define mk make_pair
#define clr clear()
#define B begin()
#define E end()
#define EM empty()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define all(cont) cont.begin(),cont.end()
#define pb push_back
string en="\n";
string t="hello";
#define sqr(a) ((a) * (a))
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1;
    while(cin>>n>>m)
    {
        s=0;
        for(i=0;i<=n;i++)
        {
            for(j=0;j<=n;j++)
            {
                k=m-i-j;
                    if(k>=0 && k<=n) s++;
            }
        }
        cout<<s<<en;
    }
}


Measured memory_bytes: 3520
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
ll n,k;
bool is_able_to_cut(ll x,vector<ll> a){
    ll total = 0;
    if(x == 0){
        return true;
    }
    REP(i,a.size()){
        total+=(a[i]-1)/x;
    }
    return k >= total;
}

ll BinarySearch(vector<ll>a){
    ll ng=0,ok = 1000000000;
    while(llabs(ok-ng) > 1){
        ll mid = (ng+ok)/2;
        if(is_able_to_cut(mid,a)){
            ok = mid;
        }else{
            ng = mid;
        }
    }

    return ok;
}

int main(){
    cin >> n >> k;
    vector<ll>a(n);
    REP(i,n)cin >> a[i];
    if(k==0){
        SORT(a);
        reverse(ALL(a));
        cout << a[0] << endl;
        return 0;
    }
    cout << BinarySearch(a) << endl;
    return 0;
}

Measured memory_bytes: 7828
inner_product (ax,ay) (bx,by) = ax * bx + ay * by
vabs (ax,ay) = sqrt (ax*ax+ay*ay)
vmul a (ax,ay) = (a*ax,a*ay)
vadd (ax,ay) (bx,by) = (ax+bx,ay+by)
vsub (ax,ay) (bx,by) = (ax-bx,ay-by)

vatan (x,y) = atan2 y x
vnorm (x,y) = x*x+y*y

fmod m v
  | v > m = fmod m (v-m)
  | v < 0 = fmod m (v+m)
  | otherwise = v

judge a1 t1 a2 t2
  | a2 == 0  = "ON_SEGMENT"
  | da == 0  = if a2 > a1
               then "ONLINE_FRONT"
               else "ON_SEGMENT"
  | da == pi = "ONLINE_BACK"
  | da <  pi = "COUNTER_CLOCKWISE"
  | otherwise= "CLOCKWISE"
  where
    da = fmod (2*pi) (t2-t1)

ans p0 p1 p2 =
  let v1 = p1 `vsub` p0
      v2 = p2 `vsub` p0
      t1 = vatan v1
      t2 = vatan v2
      a1 = vnorm v1
      a2 = vnorm v2
  in
    judge a1 t1 a2 t2

main = do
  l <- getLine
  getLine
  qs' <- getContents
  let (p0x:p0y:p1x:p1y:_) = map read $ words l :: [Double]
      qs = map (map read) $ map words $ lines qs' :: [[Double]]
      o = map (\ (p2x:p2y:_) -> ans (p0x,p0y) (p1x,p1y) (p2x,p2y) ) qs
  mapM_ putStrLn o

Measured memory_bytes: 4840
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        
        // 標準入力の取得
        int N = Integer.parseInt(scan.next());

        String[] W = new String[N];
        for (int i = 0; i < N; i++) {
            W[i] = scan.next();
        }
        scan.close();

        // 重複チェック
        Set<String> Wst = new HashSet<String>(Arrays.asList(W));
        if(!(Wst.size() == N)){
            System.out.println("No");
            return ;
        }
        
        // しりとりできてるかチェック
        for (int i = 0; i < N-1; i++) {
            if(W[i].charAt(W[i].length() - 1) != W[i+1].charAt(0)){
                System.out.println("No");
                return ; 
            }
        }
        System.out.println("Yes");
        return ; 
    }
}


Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,m,k,i,j,a,b,c = 1,t;scanf("%lld%lld%lld",&n,&m,&k);
  ll g[n] = {},ans[n];vector<ll> bf[n],bl[n];
  for(i=0;i<n;i++) bl[i].push_back(i);
  for(i=0;i<m;i++){
    scanf("%lld%lld",&a,&b);a--;b--;
    bf[a].push_back(b);
    bf[b].push_back(a);
  }
  for(i=0;i<k;i++){
    scanf("%lld%lld",&a,&b);a--;b--;
    bl[a].push_back(b);
    bl[b].push_back(a);
  }
  queue<ll> q;
  for(i=0;i<n;i++){
    if(g[i]!=0) continue;
    queue<ll>().swap(q);
    q.push(i);
    while(!q.empty()){
      t = q.front();q.pop();
      g[t] = c;
      for(j=0;j<bf[t].size();j++){
        if(g[bf[t][j]]==0) q.push(bf[t][j]);
      }
    }
    c++;
  }
  ll s[n] = {};
  for(i=0;i<n;i++){
    g[i]--;s[g[i]]++;
  }
  for(i=0;i<n;i++) ans[i] = s[g[i]];
  for(i=0;i<n;i++){
    for(j=0;j<bf[i].size();j++){
      if(g[i] == g[bf[i][j]]) ans[i]--;
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<bl[i].size();j++){
      if(g[i] == g[bl[i][j]]) ans[i]--;
    }
  }
  for(i=0;i<n;i++) printf("%lld ",ans[i]);
  printf("\n");
}

Measured memory_bytes: 17908
#include <iostream>
#include <vector>

void solve() {
    int n, m;
    std::cin >> n >> m;

    std::vector<int> xs(n);
    for (auto& x : xs) std::cin >> x;

    for (int k = 1; k <= m; ++k) {
        for (int i = 0; i + 1 < n; ++i) {
            if (xs[i] % k > xs[i + 1] % k) {
                std::swap(xs[i], xs[i + 1]);
            }
        }
    }

    for (auto x : xs) std::cout << x << std::endl;
}

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

    solve();

    return 0;
}



Measured memory_bytes: 3140
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)

	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	k := getNextInt(scanner)
	im := IntMap{}
	for i := 0; i < n; i++ {
		a := getNextInt(scanner)
		im.increment(a)
	}

	ans := 0
	l := len(im)
	if l-k > ans {
		cc := make([]int, l)
		i := 0
		for _, c := range im {
			cc[i] = c
			i++
		}
		sort.Ints(cc)
		for i := 0; i < l-k; i++ {
			ans += cc[i]
		}
	}

	fmt.Fprintln(writer, ans)

	writer.Flush()
}

// IntMap ...
type IntMap map[int]int

func (m IntMap) get(key int) int {
	if _, ok := m[key]; ok {
		return m[key]
	}
	return 0
}
func (m IntMap) increment(key int) {
	if _, ok := m[key]; ok == false {
		m[key] = 0
	}
	m[key]++
}


Measured memory_bytes: 12672
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n-1];
    for(int i=0;i<n-1;i++)
    {
        cin>>a[i];
    }
    int count[n];
    for(int i=0;i<n;i++)
    {
        count[i]=0;
    }
    for(int i=0;i<n-1;i++)
    {
        int ans=a[i]-1;
        count[ans]+=1;
    }
    for(int i=0;i<n;i++)
    {
        cout<<count[i]<<endl;
    }

}

Measured memory_bytes: 5196
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        for(;;) {
            String s = scan.nextLine();
            if(s.equals("0")){
                break;
            }
            int sum=0;
            for (int i = 0; i < s.length(); i++) {

                char n = s.charAt(i);
                sum+=Character.getNumericValue(n);
            }
            System.out.println(sum);
        }
    }
}



Measured memory_bytes: 26456
program engines
  implicit none
  integer :: n, i, j
  real(8) :: r(100,2) = 0.d0, p(2) = 0.d0, ans = 0.d0
  logical :: used(100) = .false.
  character(64) :: tmp
  read(*,*) n
  do i = 1, n
    read(*,*) r(i,:)
  end do
  do i = 1, n
    p = 0.d0
    used(1:n) = .false.
    do j = 1, n
      if (dot_product(r(i,:),r(j,:)) > 0.d0) then
        p = p+r(j,:)
        used(j) = .true.
      end if
    end do
    do j = 1, n
      if (used(j)) cycle
      if (d(p+r(j,:)) > d(p)) then
        p = p+r(j,:)
      end if
    end do
    ans = max(ans,d(p))
  end do
  write(tmp,'(f50.20)') ans
  write(*,'(a)') trim(adjustl(tmp))
contains
  real(8) function d(a)
    real(8), intent(in) :: a(2)
    d = sqrt(a(1)*a(1)+a(2)*a(2))
  end
end program engines

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

long long modexp(int x, long long e, int m) {
    long long ans = 1, p = x % m;
    while (e > 0) {
        if (e % 2 != 0) ans = (ans * p) % m;
        p = (p * p) % m;
        e >>= 1;
    }
    return ans;
}

long long comb[3001][3001], h[3001][3001];

int main() {
    int N, M; cin >> N >> M;
    for (int i = 0; i <= N; i++) {
        comb[i][0] = 1;
        for (int j = 1; j <= i; j++) {
            comb[i][j] = (comb[i-1][j-1] + comb[i-1][j]) % M;
        }
    }
    h[0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= i; j++) {
            (h[i+1][j+1] += h[i][j]) %= M;
            (h[i+1][j] += (j + 1) * h[i][j] % M) %= M;
        }
    }

    long long f[N+1];
    for (int k = 1; k <= N; k++) {
        long long val = 0;
        for (int j = 0; j <= k; j++) {
            val += h[k][j] * modexp(2, (N-k) * j, M) % M;
        }
        f[k] = val % M * modexp(2, modexp(2, N-k, M-1), M);
    }
    long long g[N+1];
    for (int k = 1; k <= N; k++) {
        long long val = 0;
        for (int j = k; j <= N; j++) {
            const int sign = (j - k) % 2 == 0 ? 1 : -1;
            val += sign * f[j] % M * comb[N-k][j-k] % M;
        }
        g[k] = val % M;
    }
    long long ans = modexp(2, modexp(2, N, M-1), M);
    for (int k = 1; k <= N; k++) ans -= g[k] * comb[N][k] % M;
    cout << (ans % M + M) % M << endl;
}


Measured memory_bytes: 95472
N=int(input())
d=[input().split() for i in range(N)]
name=[]
for i in range(N):
    d[i].append(i+1)
    d[i][1]=int(d[i][1])
    name.append(d[i][0])
Name=list(set(name))
Name.sort()
d.sort()
for i in range(len(Name)):
    li=[]
    for j in range(N):
        if Name[i]==d[j][0]:
            li.append([d[j][1],d[j][2]])
        else:
            continue
    li.sort()
    Li=li[::-1]
    for k in range(len(li)):
        print(Li[k][1])

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

int main(){
	int a, b, c, count;
	count = 0;
	cin >> a >> b >> c;
	for (int i = a;i <= b;i++){
		if (c % i == 0) count++;
		}
	cout << count <<  endl;
	
	return 0;
}

Measured memory_bytes: 1164
n,x,y = map(int,input().split())
d = y-x-1
x -= 1
y -= 1
A = [0 for i in range(n)]
for i in range(n):
    for j in range(i+1, n):
        if i <= x and y <= j:
            A[j-i-d] += 1
        else:
            # print(i,j,j-i, abs(x-i)+abs(y-j)+d+1)
            A[min(j-i, abs(x-i)+abs(y-j)+1)] += 1
        # A[min(j-i, abs(x-i)+abs(y-j)+d+1)] += 1
# print(A)
for i in range(1, n):
    print(A[i])

Measured memory_bytes: 47580
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N = I()
P = III()

pmin = P[0]
count = 1
for i in range(1,N):
    if P[i]<=pmin:
        count += 1
        pmin = P[i]
    else:
        continue

print(count)

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

int main() {
	int n, h, ans = 0;
	vector<int>d(50);
	cin >> n;
	for (int i = 0; i < n; i++)cin >> d.at(i);
	for (int i = 0; i < n; i++) {
		for (int i2 = i+1; i2 < n; i2++) {
			h = d.at(i) * d.at(i2);
			ans += h;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,c,ans=0;
  scanf("%d %d %d",&a,&b,&c);
  while(a<=b){
    if(c%a==0){
      ans=ans+1;
    }
    a=a+1;
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 596
import java.util.*;

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

        int res = 0;
        for (int a=0; a<=A; a++) {
            for (int b=0; b<=B; b++) {
                int c = (X - a * 500 - b * 100) / 50;
                if (c >= 0 && c <= C)
                    res++;
            }
        }

        System.out.println(res);
    }
}


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

using namespace std;

long long MOD = 1000000007LL;

void Main() {
    long long N;
    cin >> N;

    map<long long, long long> factors;
    for (long long i = 2; i <= N; ++i) {
        long long k = i;
        for (long long j = 2; j * j <= i; ++j) {
            long long e = 0;
            while (k % j == 0) {
                k /= j;
                ++e;
            }
            if (e > 0) {
                if (factors.count(j) == 0) {
                    factors.insert(make_pair(j, 0LL));
                }
                factors[j] += e;
            }
        }
        if (k != 1) {
            if (factors.count(k) == 0) {
                factors.insert(make_pair(k, 0LL));
            }
            factors[k] += 1;
        }
    }
    long long ans = 1;
    for (auto e : factors) {
        ans *= (e.second + 1);
        ans %= MOD;
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

constexpr int max_n = 100'000 + 5;

int q;
vector<bool> is_prime(max_n, true);
vector<int> sums(max_n);

int main()
{
    // 入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(10); // 浮動小数の表示の精度

    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i < max_n; i++)
    {
        if (!is_prime[i]) { continue; }
        for (int j = 2; j * i < max_n; j++)
        {
            is_prime[j * i] = false;
        }
    }
    for (int i = 1; i < max_n; i+=2) {
        bool b = is_prime[i] && is_prime[(i+1)/2];
        sums[i] = sums[i-1] + b;
        sums[i+1] = sums[i];
    }

    cin>>q;
    rep(i,q) {
        int l,r; cin>>l>>r; l--;
        int res = sums[r] - sums[l];
        cout<<res<<'\n';
    }

    return 0;
}


Measured memory_bytes: 3668
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;
int r,c,n;
int ans;
char map[1005][1005];
bool book[1005][1005];
int dir[4][2]={{-1,0},{0,-1},{0,1},{1,0}};
struct point
{
    int x,y;
    int step;
}p[11],now,last;
bool check(int x,int y)
{
    if(x<0||x>=r||y<0||y>=c)
        return 0;
    return 1;
}
void bfs(int st)
{
    p[st].step=0;
    queue<point> q;
    now=p[st];
    q.push(now);
    book[now.x][now.y]=1;
    while(!q.empty())
    {
        now=q.front();
        q.pop();
        for(int i=0;i<4;i++)
        {
            last.x=now.x+dir[i][0];
            last.y=now.y+dir[i][1];
            last.step=now.step+1;
            if(!check(last.x,last.y))    continue;
            if(map[last.x][last.y]=='X'|| book[last.x][last.y]==1)    continue;
            if(last.x==p[st+1].x && last.y==p[st+1].y)
            {
                ans+=last.step;
                return;
            }
            book[last.x][last.y]=1;
            q.push(last);
        }
    }
}
int main()
{
    while(~scanf("%d%d%d",&r,&c,&n))
    {
        for(int i=0;i<r;i++)
        {
            getchar();
            for(int j=0;j<c;j++)
            {
                scanf("%c",&map[i][j]);
                if(map[i][j]=='S')
                {
                    p[0].x=i;
                    p[0].y=j;
                }
                if(map[i][j]!='S'&&map[i][j]!='X'&&map[i][j]!='.')
                {
                    p[map[i][j]-'0'].x=i;
                    p[map[i][j]-'0'].y=j;
                }
            }
        }
        ans=0;
        for(int i=0;i<n;i++)
        {
            memset(book,0,sizeof(book));
            bfs(i);
        }
        cout<<ans<<endl;
    }
    //system("pause");
    return 0;
}


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

int main(){
    long double a,b,c;
    cin >> a >> b >> c;

    long long int hiki;
    hiki = c-(a+b);
    if(hiki>0 && hiki*hiki>4*a*b){
        cout << "Yes" ;
    }else{
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define ll                    long long int
#define pb                    push_back
#define F                     first
#define S                     second
using namespace std;

ll MOD = 1000000007;


int main()
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    if(t.substr(0, s.size()) == s && t.size()>s.size()) cout<<"Yes"<<endl;
    else cout<<"No"<<endl; 
    return 0;
}

Measured memory_bytes: 3652
import math

N,D=map(int,input().split())
X=[]
for _ in range(N):
    X.append([int(i) for i in input().split()])

ans=0
for i in range(N-1):
    for j in range(i+1,N):
        distance=0
        for k in range(D):
            l=(X[i][k]-X[j][k])**2
            distance+=l
        p=math.sqrt(distance)
        if math.ceil(p)==p:
            ans+=1
print(ans)

Measured memory_bytes: 3064