akhauriyash/Code-Regression huggingface dataset:
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef int64_t LL;
typedef uint64_t ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
template<class T, class... U> void DEBUG(const T &head, const U &... tail) { 
#ifdef HOME
    _W('#'); _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...);
#endif
}
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int n;R(n);
    map<int,int>H;
    REP(i,n){
        int x;R(x);H[x]++;
    }
    int an=0;
    for(auto pp:H){
        if(pp.S<pp.F)an+=pp.S;
        else an+=pp.S-pp.F;
    }
    W(an);
    return 0;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef pair<int,int> P;

char d[1000][1000];
int data[1000][1000];
int h,w,n;
int sx[4]={1,0,-1,0};
int sy[4]={0,-1,0,1};

int check(int x1,int y1,int x2,int y2){
	for(int i=0;i<h;i++)for(int j=0;j<w;j++)data[i][j]=-1;
	data[y1][x1]=0;
	queue<P> q;
	q.push(P(x1,y1));
	while(q.size()){
		P p=q.front();q.pop();
		for(int i=0;i<4;i++){
			int x=p.first+sx[i],y=p.second+sy[i];
			if(x<0||x>=w||y<0||y>=h)continue;
			if(d[y][x]=='X'||data[y][x]>=0)continue;
			q.push(P(x,y));
			data[y][x]=data[p.second][p.first]+1;
			if(x==x2&&y==y2)return data[y][x];
		}
	}
}

int main(){
	int x[10],y[10];
	scanf("%d%d%d",&h,&w,&n);
	for(int i=0;i<h;i++){
		scanf("%s",d[i]);
		for(int j=0;j<w;j++){
			if(d[i][j]=='S'){ x[0]=j,y[0]=i;}
			if(48<d[i][j]&&d[i][j]<58){ x[d[i][j]-48]=j,y[d[i][j]-48]=i;}
		}
	}
	int res=0;
	for(int i=0;i<n;i++) res+=check(x[i],y[i],x[i+1],y[i+1]);
	printf("%d\n",res);
}

Measured memory_bytes: 6092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    int n;cin >> n;
    vi a(n);
    rep(i,n) cin >> a[i];
    map<ll,ll> mp;
    rep(i,n){
        mp[a[i]]++;
    }
    ll sum=0;
    for(auto p: mp){
        sum+=p.se*(p.se-1)/2;
    }
    rep(i,n){
        ll now=mp[a[i]];
        ll csum=sum;
        csum=csum-(now*(now-1)/2)+(now-1)*(now-2)/2;
        cout << csum << endl;
    }
    return 0;
}

Measured memory_bytes: 10240
#include<bits/stdc++.h> 
using namespace std;
#define se second
#define fr first
#define int long long int
#define pb push_back
#define inf 1e18
#define all(v) v.begin(),v.end()
#define CHAL_BAAP_KO_MT_SIKHA ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mod 1000000007
/*
    Damn Fast:TheFuckinMastermind
    while(How to solve the Question?){
                Read the Question Again!!
           }
        do
            Practise
    #Motivation::::0/0  
*/
const int N=2e5;
int dp[N+1][4],a[N+1][4];
signed main()
{
      
    CHAL_BAAP_KO_MT_SIKHA
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=3;j++){
            cin>>a[i][j];
        }
    }
    for(int i=1;i<=n;i++){
        dp[i][1]=a[i][1]+max(dp[i-1][2],dp[i-1][3]);
        dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][3]);
        dp[i][3]=a[i][3]+max(dp[i-1][1],dp[i-1][2]);
    } 
    cout<<max(dp[n][1],max(dp[n][2],dp[n][3]));
}

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

struct StringInfo {
	int len;
	string word;
	StringInfo() : len(0), word("") {}
	StringInfo(int len, string& word) : len(len), word(word) {}
	void print() {
		cout << "len " << len << " " << word << " word\n"; 
	}
};
string getLongestCommonSubseq(string& s, string& t) {
	int n = s.size(), m = t.size();
	vector <vector <StringInfo>> dp(2, vector <StringInfo> (m + 1));
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j){
			// cout << i << " " << j << endl;
			dp[i%2][j] = dp[(i - 1)%2][j - 1];
			if (s[i - 1] == t[j - 1])
				dp[i%2][j].len++, dp[i%2][j].word += s[i - 1];
			if (dp[(i - 1)%2][j].len > dp[(i - 1)%2][j - 1].len)
 				dp[i%2][j] = dp[(i - 1)%2][j];
			if (dp[i%2][j - 1].len > dp[(i - 1)%2][j - 1].len)
 				dp[i%2][j] = dp[i%2][j - 1];
			// dp[i][j].print();
		}
	}
	return dp[n%2][m].word;
}


int main() {
	string s, t;
	cin >> s  >> t;
	cout << getLongestCommonSubseq (s, t) << endl;
	return 0;
}

Measured memory_bytes: 8576
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  int n, d, x, a, sum = 0;
  cin >> n >> d >> x;

  for(int i = 0; i < n; i++){
    cin >> a;
    if(d / a == 0){
      sum += 1;
    }
    else{
      if(a == 1){
        sum += d / a;
      }
      else{
        if(d % a == 0){
          sum += d / a;
        }
        else{
        sum += d / a + 1;
        }
      }
    }
  }
  cout << sum + x << endl;

}


Measured memory_bytes: 256
# -*- coding:utf-8 -*-
import itertools
if __name__ == "__main__":
    a  = list(map(int, input().split()))
    ans = float('inf')
    factor = list(itertools.permutations(a))
    for tuples in factor:
        cost = 0
        for tmp in range(1,3):
            cost += abs(tuples[tmp]-tuples[tmp-1])
        ans = min(ans, cost)
    print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

#define COUT(x) cout << x << endl
#define CIN(x) cin >> x
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define EXIST(s, e) (s.find(e) != s.end())
#define SORT(c) sort(c.begin(), c.end())
#define ERASEUNIQE(v) v.erase(unique(v.begin(), v.end()), v.end())

// conversion
inline int toInt(string s)
{
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x)
{
  ostringstream sout;
  sout << x;
  return sout.str();
}

// math
template <class T>
inline T sqr(T x) { return x * x; }

// typedef
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

// container util
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()

// constant
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

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

int main(int argc, char const *argv[])
{
  string words = "keyence";
  string S;
  CIN(S);
  if(S == words) {
    COUT("YES");
    return 0;
  }
  for(int i = 0; i < (int)S.size(); i++) {
    for(int j = 0; j < (int)S.size(); j++) {
      string str = "";
      for(int k = 0; k < (int)S.size(); k++) {
        if(i <= k && k <= j) {
          continue;
        }
        else {
          str.push_back(S[k]);
        }
      }
      if(str == words) {
        COUT("YES");
        return 0;
      }
    }
  }
  COUT("NO");
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char str[1200], b;
	
	while(scanf("%c", &b) != EOF){
		if(b >= 'A' && b <= 'z') {
			if(b >= 'a') printf("%c",b-32);
			else printf("%c", b + 32);
		}
		else printf("%c", b);
	}
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define _GLIBCXX_DEBUG
#define V vector<ll>
using namespace std;
using ll = long long;


int main(){
    int n; cin>>n;
    int N=n;
    int s=0;
    while(N){
        s+=N%10;
        N/=10;
    }
    if(n%s==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>



using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,b,a) for(int i = (b) - 1; i>= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a)

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef  long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const double EPS = 1e-7;
const int MAX = 20 * 1000 + 47;
const int MAS = 1e5 * 6;
const int MOD = 1000 * 1000 * 1000 + 7;

double DIST(double x1, double x2, double y1, double y2)
{
    return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}




template<class T > void mx(T& a, T b)
{
  a = max(a, b); 
}
bool ok(pair<int, int > a)
{
    return a.first == 0 ||a.second  == 0; 
}
int main()
{
    string a, b;
    cin >> a >> b;
    vector<vector<pair<int, pair<int, int > > > > dp(3010, vector<pair<int, pair<int, int >> >(3010, { -INF,{0,0} }));
    dp[0][0] = { 0,{0,0} }; 
    rep(i, a.size())
    {
        rep(j, b.size())
        {
            if (a[i] == b[j])
            {
                mx(dp[i + 1][j + 1], MP(dp[i][j].first + 1, MP(i, j)));
            }
            mx(dp[i][j + 1], MP(dp[i][j].first, MP(i, j )));
            mx(dp[i + 1][j], MP(dp[i][j].first, MP(i, j)));
        }
    }
        pair<int, pair<int, int > >  ans = { 0,{0,0} };
        rep(i, a.size() + 1)
        {
            rep(j, b.size() + 1)
            {

                mx(ans, MP(dp[i][j].first, MP(i,j)));
            }
        }
     //   cout << ans.second.first << " " << ans.second.second << endl; 
        pair<int, int > cur = ans.second;
        
        string s;
       
       // if (ok(cur))
       // {
        //    cout << "that" << endl; 
        //}
        while (!ok(cur))
        {

            //cout << "wtf111" << endl; 
            int x = cur.first;
            int y = cur.second;
            pair<int, int > pre = dp[x][y].second;
        //    cout << "z" << endl; 
            if (pre == MP(x - 1, y - 1))
            {
              //  cout << "here" << endl;
             //   cout << a[x - 1] << endl;
                s += a[x - 1];
            }
            cur = pre;
        }
    
        reverse(ALL(s));
        cout << s << endl; 

}










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

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class BResistorsInParallel {
public:
    static constexpr int kStressIterations = 0;
    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        double c = 1;
        vector<double> A(N);
        REP(i, N) {
            double a;
            cin >> a;
            c *= a;
            A[i] = a;
        }

        double m = 0;
        REP(i, N) {
            m += c / A[i];
        }
        fcout << c / m << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    BResistorsInParallel solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
///  author:Kissheart  ///
#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>
#include<vector>
#include<stdlib.h>
#include<math.h>
#include<queue>
#include<deque>
#include<ctype.h>
#include<map>
#include<set>
#include<stack>
#include<string>
#define INF 0x3f3f3f3f
#define FAST_IO ios::sync_with_stdio(false)
const double PI = acos(-1.0);
const double eps = 1e-6;
const int MAX=2e5+10;
const int mod=1e9+7;
typedef long long ll;
using namespace std;
#define gcd(a,b) __gcd(a,b)
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll qpow(ll a,ll b){ll r=1,t=a; while(b){if(b&1)r=(r*t)%mod;b>>=1;t=(t*t)%mod;}return r;}
inline ll inv1(ll b){return qpow(b,mod-2);}
inline ll exgcd(ll a,ll b,ll &x,ll &y){if(!b){x=1;y=0;return a;}ll r=exgcd(b,a%b,y,x);y-=(a/b)*x;return r;}
inline ll read(){ll x=0,f=1;char c=getchar();for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;for(;isdigit(c);c=getchar()) x=x*10+c-'0';return x*f;}
//freopen( "in.txt" , "r" , stdin );
//freopen( "data.txt" , "w" , stdout );
char s[MAX];
ll ans,cur=1;
int main()
{
    scanf("%s",s+1);
    for(int i=1;s[i];i++)
    {
        if(s[i]=='W')
            ans+=i-cur,cur++;
    }
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 384
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
//map.containsKey(A)
//Map<String, Integer> map = new HashMap<String, Integer>(n);
//ArrayList<String> cc = new ArrayList<>(n);
//Collections.sort(list);
//Array.sort(list);
//Arrays.asList(c).contains("a")

public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	//static String eikomoji[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
	
	
	public static void main(String[] args) {
	int a=sc.nextInt();
	int b=sc.nextInt();
	List<String> cc=new ArrayList<String>();
	String ans[]=new String[2];
	ans[0]="";
	ans[1]="";
		for(int i=0;i<a;i++) {
			ans[0]=ans[0]+b;
		}
	
		for(int i=0;i<b;i++) {
			ans[1]=ans[1]+a;
		}
		if(a>b) {
			p(ans[0]);
		}else {
			p(ans[1]);
		}//p(a+"     "+b);
		/*Collections.sort(cc);
		p(a+"     "+b);
		p(ans[0]);
		p(ans[1])*/;
	
 }
}


Measured memory_bytes: 20948
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int[] s = new int[3];
		for(int i = 0; i < 3; i++) {
			s[i] = sc.nextInt();
		}
		
		sc.close();
		
		Arrays.sort(s);
		
		if(s[0] == 5 && s[1] == 5 && s[2] == 7) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
		return;
	}
	
}

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

int N;
int B[100];
int C[100][11];
int main() {
  cin >> N;
  for(int i = 0; i < N; ++i) {
    for(int k = 0; k < 10; ++k) {
      int z;
      cin >> z;
      B[i] += (z << k);
    }
  }
  
  for(int i = 0; i < N; ++i) {
    for(int k = 0; k < 11; ++k) {
      int z;
      cin >> z;
      C[i][k] = z;
    }
  }
  
  int mx = -1000000009;
  for(int s = 1; s < 1024; ++s) {
    int sum = 0;
    for(int i = 0; i < N; ++i) {
      sum += C[i][__builtin_popcount(s & B[i])];
    }
    mx = max(mx, sum);
  }
  cout << mx << endl;
  return 0;
}


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

public class Main {
    public static void main (String[] args) throws java.lang.Exception {
    
    BufferedReader input = new BufferedReader (new InputStreamReader(System.in));
    String txt = input.readLine();
    String[] text = txt.split(" ");
    Arrays.sort(text);
    System.out.println(text[0] + " " + text[1] + " " + text[2]);
    }
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using namespace std;

using ll=long long;
using pii=pair<int, int>;
using vi=vector<int>;

const ll INF=1LL<<60;
const int MOD=1e9+7;
const int N=2e5+5;

vector<bool> isPrime(N+1, 0); 

void Prime(){
    for(int i=2; i*i<=N; i++){
        if(isPrime[i]) continue;
        for(int j=2; j<=N/i; j++) isPrime[i*j]=1;
    }
}

int main(){
    int X; cin >> X;
    int res;
    Prime();
    isPrime[1]=1;
    for(int i=1; i<=N; i++){
        if(!isPrime[i] && i >= X){
            res=i;
            break;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import sys

rect = 0
rhom = 0
for line in sys.stdin:
  try:
    a, b, c = [int(i) for i in line.split(',')]
    if a**2 + b**2 == c**2:
      rect += 1
    elif a == b:
      rhom += 1
  except:
    break
print(rect)
print(rhom)

Measured memory_bytes: 5600
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
#include <complex>
using namespace std;

typedef long long ll;

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

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

  while(T--){
    int n;
    cin>>n;

    int before, up = 0, down = 0;
    cin>>before;

    rep(i,n-1){
      int h;
      cin>>h;

      if(h > before){
        up = max(up, h - before);
      }
      else{
        down = max(down, before - h);
      }

      before = h;
    }

    cout<<up<<" "<<down<<endl;
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define int long long int
#define MP make_pair
#define PB push_back
#define F first
#define S second
using namespace std;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VP;
typedef pair<PII, int> PPI;
typedef pair<int, PII> PIP;

const int INF = 3e18;

int n, a[200010];
VI b;

signed main()
{
  cin >> n;
  for(int i = 1; i <= n; i++){
    cin >> a[i];
  }

  if(n % 2){
    for(int i = n; i > 0; i -= 2){
      b.PB(a[i]);
    }
    for(int i = 2; i <= n; i += 2){
      b.PB(a[i]);
    }
  }

  else{
    for(int i = n; i > 0; i -= 2){
      b.PB(a[i]);
    }
    for(int i = 1; i <= n; i += 2){
      b.PB(a[i]);
    }
  }

  for(int i = 0; i < n; i++){
    cout  << b[i] << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 5488
import java.io.IOException;
import java.util.BitSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			boolean[][] map = new boolean[n][31];
			BitSet[] bit = new BitSet[n];
			for (int i = 0; i < n; i++) {
				bit[i] = new BitSet();
				bit[i].set(i);
				int f = scanner.nextInt();
				while (f-- > 0)
					map[i][scanner.nextInt()] = true;
			}
			int ans = -1;
		
			for (int t = 1; t <= 30; t++) {
				BitSet tmp = new BitSet();
				for (int i = 0; i < n; i++)
					if (map[i][t]){
						tmp.or(bit[i]);
						
					}
				if (tmp.cardinality() == n) {
					ans = t;
					break;
				}
				for (int i = 0; i < n; i++)
					if (map[i][t])
						bit[i] = tmp;

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

Measured memory_bytes: 68896
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def check(str):
	cnt = 0
	for s in str:
		if s.islower():
			cnt += 1
	return cnt == len(str) - 1 and str.find('C') != -1

S = input()

if S[0] == 'A' and S[1] != 'C' and S[len(S) - 1] != 'C' and check(S[2:len(S) - 1]) and S[1].islower() and S[len(S) - 1].islower():
	print('AC')
else:
	print('WA')



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,l[1001],ans;
    cin>>n;
    for(int i=0;i<2*n;i++)
    {
        cin>>l[i];
    }
    sort(l,l+(n*2));
    for(int i=0;i<n*2;i+=2)
    {
        ans+=l[i];
    } 
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())
V=list(int(x) for x in input().split())
C=list(int(x) for x in input().split())
ans=[]
for i in range(N):
	ans.append(max(0,V[i]-C[i]))
sum=0
for i in range(N):
	sum+=ans[i]
print(sum)

Measured memory_bytes: 3064
c = []
3.times do
    c << gets.chomp.split(" ").map(&:to_i)
end
a = [0, 0, 0]
b = [0, 0, 0]

def check(a, b, c)
    3.times do |i|
        3.times do |j|
            if c[i][j] != a[j] + b[i]
                return
            end
        end
    end
    puts "Yes"
    exit
end

0.upto(100) do |i| 
    0.upto(100) do |j|
        if i+j == c[0][0]
            a = j, c[0][1]-i, c[0][2]-i
            if c[1][0]-j >= 0 && c[2][0]-j >= 0
                b = i, c[1][0]-j, c[2][0]-j
                check(a, b, c)
            end
        end
    end
end

puts "No"

Measured memory_bytes: 1788
#include <stdio.h>
#define NIL -1
#define N 100006



struct Node{
  int p,l,r;
};
struct Node A[N];

int deep(int);
int brother(int);
int deg(int);
int height(int);


main()
{


  int i,j;
  int n,id,e,c;



  scanf("%d",&n);
  
  for(i = 0; i < n; i++){
   A[i].p = NIL;
   A[i].l = NIL;
   A[i].r = NIL;
  }
  for(i = 0; i < n; i++){
    scanf("%d%d%d",&id,&e,&c);
    
    A[e].p = id;
    A[c].p = id;
    A[id].l = e;
    A[id].r = c;
  
  }
  
  for(i = 0; i < n; i++){
    
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,A[i].p,brother(i),deg(i),deep(i),height(i));
    
    if(A[i].p == NIL){
      printf("root\n");
    }
    else if(A[i].r == NIL && A[i].l == NIL){
      printf("leaf\n");
    }
    else {
      printf("internal node\n");
    }
  }
  return 0;
}

int deep(int s)
{
  int a;
  
  if(A[s].p == NIL){
    return 0;
  }
  else {
    a = deep(A[s].p) + 1;
    return a;
  }
}

int brother(int s)
{
  if(A[s].p == NIL){
    return NIL;
  }
  else {
    if(s == A[A[s].p].l){
      return A[A[s].p].r;
    }
    else {
      return A[A[s].p].l;
    }
  }
}

int deg(int s)
{
  
  if(A[s].l == NIL && A[s].r == NIL){
    return 0;
  }
  else if(A[s].r != NIL && A[s].l != NIL){
    return 2;
  }
  else {
    return 1;
  }
}

int height(int s)
{

  int left=0, right=0;

  if(s == NIL){
    return 0;
  }

  if(A[s].r != NIL){
    right = height(A[s].r) + 1;
  }
  
  if(A[s].l != NIL){
    left = height(A[s].l) + 1;
  }
  
  if(left > right){
    return left;
  }
  else {
    return right;
  }
}

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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
	int n, m, x;
	cin >> n >> m >> x;
	int c[100];
	int a[100][100];

	for(int i = 0;i < n;i++){
		cin >> c[i];
		for(int j = 0;j < m;j++){
			cin >> a[i][j];
		}
	}

	int ans = LLONG_MAX;
	for(int b = 0;b < (1 << n);b++){
		int y[1000] = {};
		int tmp = 0;
		for(int i = 0;i < n;i++){
			if(b & (1 << i)){
				for(int j = 0;j < m;j++){
					y[j] += a[i][j];
				}
				tmp += c[i];
			}
		}

		bool f = true;
		for(int j = 0;j < m;j++){
			if(y[j] < x){
				f = false;
				break;
			}
		}
		if(f) chmin(ans, tmp);
	}

	cout << (ans == LLONG_MAX ? -1 : ans) << endl; 

	return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int arr[n];
	for(int i = 0; i < n; i++)scanf("%d",&arr[i]);
	printf("%d",arr[0]);
	for(int k = 1; k < n; k ++)printf(" %d",arr[k]);
	printf("\n");
	for(int i = 1; i < n; i++){
		int temp = arr[i];
		int j = i - 1;
		while(arr[j] > temp && j >= 0){
			arr[j+1] = arr[j];
			j--;
		}
		arr[j+1] = temp;
		printf("%d",arr[0]);
		for(int k = 1; k < n; k ++)printf(" %d",arr[k]);
		printf("\n");
	}
	return 0;
}


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

int main(){
  int N;
  cin>>N;
  int count = 0;
  for(int i = 1; i<=N; i++){
    if(i%2 ==1){
      count++;
    }
  }
  double a = count/(double)N;
    cout << fixed << setprecision(10);
  cout << a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

ll f(ll n) {
    return n * n * n * n * n;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll x;
    cin >> x;
    set<pair<ll, ll>> dp;
    reps(i, -1000, 1000) dp.insert(make_pair(f(i), i));
    reps(i, -1000, 1000) {
        ll a = f(i);
        ll b = a - x;
        auto it = dp.lower_bound(make_pair(b, LONG_LONG_MIN));
        if (it->first == b) {
            printf("%lld %lld\n", i, it->second);
            return 0;
        }
    }
    return 0;
}


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

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

  long long twoPrev = 2;
  long long prev = 1;
  
  long long ans = 1;
  for(int i = 2; i <= n; i++) {
    ans = prev + twoPrev;
    twoPrev = prev;
    prev = ans;
  }
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using Int = int64_t;
const Int INF = 1<<30;
const Int MOD = (Int)1e9 + 7;
const Int MAX_N = (Int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    string s; cin >> s;
    Int ans = 0;
    char ch = s.front();
    for(int i = 0; i < s.size(); i++)
    {
        if(ch != s[i]) ans++;
        ch = s[i];
    }
    cout << ans << endl;
}

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

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

typedef long long LL;
LL A[100005];
LL B[100005];
typedef pair<LL, LL> pLL;
int main(){
	int n; cin >> n;
	for (int i = 0; i < n; i++){
		cin >> A[i] >> B[i];
	}
	vector<pLL> v;
	for (int i = 0; i < n; i++){
		v.push_back(make_pair(B[i], A[i]));
	}
	sort(v.begin(), v.end());
	//find what's the most we can do. 
	//how many numbers can you fit in between? 
	int lo = 0;
	int hi = n - 1;
	while (lo != hi){
		int mid = (lo + hi + 1) / 2;
		vector<LL> sum_lowest(n + 2);
		vector<LL> suffix(n + 2);
		multiset<int> m;
		LL sm = 0;
		for (int i = 0; i < mid; i++){
			m.insert(v[i].second);
			sm += v[i].second;
		}
		sum_lowest[mid] = sm; 
		for (int i = mid; i < n; i++){
			m.insert(v[i].second);
			sm += v[i].second;
			auto it = m.end();
			it--;
			sm -= *(it);
			m.erase(it);
			sum_lowest[i + 1] = sm;
		}
		LL cur = 0;
		for (int i = n - 1; i >= 0; i--){
			cur += max(v[i].first - v[i].second, 0LL);
			suffix[i + 1] = cur;
		}
		bool works = false;
		for (int i = mid; i < n; i++){
			if (suffix[i + 1] >= sum_lowest[i]){
				works = true;
			}
		}
		if (works){
			lo = mid;
		}
		else{
			hi = mid - 1; 
		}
	}
	LL max_frac_n = 0;
	LL max_frac_d = 1;
	multiset<LL> m;
	vector<LL> sum_lowest(n + 2);
	vector<LL> suffix(n + 2); 
	LL sm = 0;
	for (int i = 0; i < lo; i++){
		m.insert(v[i].second);
		sm += v[i].second;
	}
	sum_lowest[lo] = sm;
	for (int i = lo; i < n; i++){
		m.insert(v[i].second);
		sm += v[i].second;
		auto it = m.end();
		it--;
		sm -= *(it);
		m.erase(it);
		sum_lowest[i + 1] = sm;
	}
	LL cur = 0;
	for (int i = n - 1; i >= 0; i--){
		cur += max(v[i].first - v[i].second, 0LL);
		suffix[i + 1] = cur;
	}	
	for (int i = lo; i < n; i++){
		LL tmp_num = suffix[i + 2] + v[i].first - v[i].second - sum_lowest[i];
		LL tmp_denom = v[i].first;
		if (tmp_num < 0) continue;
		if (tmp_num * max_frac_d > max_frac_n * tmp_denom){
			max_frac_n = tmp_num;
			max_frac_d = tmp_denom;
		}
	}
	LL fin_num = (max_frac_d) * lo + max_frac_n;
	LL fin_denom = max_frac_d * n;
	LL g = __gcd(fin_num, fin_denom);
	cout << fin_num / g << ' ' << fin_denom / g << endl;
}


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

int main()
{
   int a, b;
   cin >> a >> b;
  
   for(int i = 0; i < 10000; i++)
   {
      int a_ = i *8/100;
      int b_ = i/10;
      if( a == a_ && b == b_) 
      {
         cout << i << endl;
         return 0;
      }
   }
   cout << -1 << endl;

}

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

int n,h[10000000],dp[10000000];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

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

Measured memory_bytes: 2688
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}

const double PI = 3.141592653589793238;

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

  double r; cin >> r;
  printf("%.15f ", PI * r * r);
  printf("%.15f\n", 2 * PI * r);

  return 0;
}


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

int n, h, w, x, y, ans = 0;

int main(){
  cin >> n >> h >> w;
  for (int i = 0; i < n; i++){
    cin >> x >> y;
    if (x >= h && y >= w) ans++;
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	bool masu[110][110];

	int W, H, N;

	cin >> W >> H >> N;
	W--;
	H--;

	for (int i = 0; i <= H; i++) {
		for (int j = 0; j <= W; j++) {
			masu[i][j] = true;
		}
	}

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

		int x, y, a;

		cin >> x >> y >> a;

		if (a == 1) {
			for (int i = 0; i <= H; i++) {
				for (int j = 0; j < x; j++) {
					masu[i][j] = false;
				}
			}
		}
		if (a == 2) {
			for (int i = 0; i <= H; i++) {
				for (int j = x; j <= W; j++) {
					masu[i][j] = false;
				}
			}
		}
		if (a == 3) {
			for (int i = 0; i < y; i++) {
				for (int j = 0; j <= W; j++) {
					masu[i][j] = false;
				}
			}
		}
		if (a == 4) {
			for (int i = y; i <= H; i++) {
				for (int j = 0; j <= W; j++) {
					masu[i][j] = false;
				}
			}
		}


		/*for (int i = 0; i <= H; i++) {
			for (int j = 0; j <= W; j++) {
				if (masu[i][j]) cout << "0";
				else cout << "1";
			}
			cout << endl;
		}

		cout << endl;*/


	}


	/*for (int i = 0; i <= H; i++) {
		for (int j = 0; j <= W; j++) {
			if (masu[i][j]) cout << "0";
			else cout << "1";
		}
		cout << endl;
	}*/

	int cnt = 0;

	for (int i = 0; i <= H; i++) {
		for (int j = 0; j <= W; j++) {
			if (masu[i][j]) cnt++;
		}
	}

	cout << cnt << endl;





}

Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;

public class Main{
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);

        double r = sc.nextDouble();
        double pi =  Math.PI;
        
        double area = r * r * pi;
        double length = 2 * r * pi;

        System.out.printf("%f %f",area,length);
    }
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin >> S;
  int Q;
  cin >> Q;
  bool order = true;
  deque<char> left, right;
  for (int i = 0; i < Q; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      order ^= true;
    } else if (t == 2) {
      int f;
      char c;
      cin >> f >> c;
      if (f == 1 && order) left.push_front(c);
      if (f == 1 && !order) right.push_back(c);
      if (f == 2 && order) right.push_back(c);
      if (f == 2 && !order) left.push_front(c);
    }
  }
  string res;
  while (!left.empty()) {
    res += left.front();
    left.pop_front();
  }
  res += S;
  while (!right.empty()) {
    res += right.front();
    right.pop_front();
  }
  if (!order) reverse(res.begin(), res.end());
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 1328
def main():
    from sys import stdin
    input = stdin.readline

    n, m, k = map(int, input().split())
    f = [[] for i in range(n)]
    BL = [[] for i in range(n)]
    ans = [0] * n
    for _ in range(m):
        a, b = map(int, input().split())
        f[a-1].append(b-1)
        f[b-1].append(a-1)
    for _ in range(k):
        c, d = map(int, input().split())
        BL[c-1].append(d-1)
        BL[d-1].append(c-1)
    D = {}
    parent = [-1] * n
    visited = [False] * n
    for root in range(n):
        if visited[root]:
            continue
        D[root]  = set([root])
        stack = [root]
        while stack:
            x = stack.pop()
            visited[x] = True
            parent[x] = root
            for t in f[x]:
                if visited[t]:
                    continue
                D[root].add(t)
                stack.append(t)
    for i in range(n):
        grp = D[parent[i]]
        tans = len(grp) - len(f[i]) - 1
        for block in BL[i]:
            if block in grp:
                tans -= 1
        ans[i] = tans
    print(*ans)
main()


Measured memory_bytes: 109964
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//


int main() {
	char c;
	cin >> c;
	char a = char(c + 1);
	cout << a << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

ll gcd(ll m, ll n){
  ll m1 = m, n1 = n, tmp;

  while(n1 != 0){
    tmp = n1;
    n1 = m1 % n1;
    m1 = tmp;
  }

  return m1;
}

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

  if(C % gcd(A, B) == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
int x,y,z;
cin >> x >> y >> z;
if (x<=y)
{
if(x<=z)
{
if(y<=z)
{cout << x << " " << y << " " << z << endl;}
else
{cout << x << " " << z << " " << y << endl;}
}
else
{
if(x<y)
{cout << z << " " << x << " " << y << endl;}
else
{cout << z << " " << y << " " << x << endl;}
}
}
else
if(y<=z)
{
if(x<=z)
{cout << y << " " << x << " " << z << endl;}
else
{cout << y << " " << z << " " << x << endl;}
}
else
{cout << z << " " << y << " " << x << endl;}
}


Measured memory_bytes: 3116
#include<bits/stdc++.h>
#include <cassert>
#include <algorithm>
#include <functional>



using namespace std;

int main(){
int n;

int answar=INT_MAX;
int all;
cin>>n;

vector<int>sum(n),w(n);
for (int i=0;i<n;i++){
cin>>w[i];
}

 sum[0]=w[0];
for(int i=1;i<n;i++ ){
 sum[i]=sum[i-1]+w[i];
}
for(int i=0;i<n;i++){
int remain=sum[n-1]-sum[i];
int c=remain-sum[i];
int   res=abs(c);
//cout<<sum[i]<<" "<<remain<<endl;
answar=min(answar,res);
}

cout<<answar<<endl;

//for(int i:remain)cout<<i<<endl;
  /* 
int all=sum[n-1]+w[n];

 remain= all-sum[i];
 res=remain-sum[i];
 
 answar=min(answar,res);


}

cout<<answar<<endl;
*/
}



Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

target = [A,B,C,D,E]
num_list = [1,2,3,4,5,6,7,8,9,0]

ans_sur  = num_list.index(0)
ans = int()

#num_listのindexが最小の値をリストの最後に
#したいのでその判定
for i in target:
	number = num_list.index(i%10)
	if ans_sur >= number:
		ans_sur = number
		ans = i

target.pop(target.index(ans))
target00 = list()
#上のfor文でlistからpopされなかった要素について
#1の位を00秒に合わせる
for i in target:
	if i % 10 != 0:
		#00秒に合わせる
		target00.append(i+(10-i%10))
	else:
		#1桁台が0の時は何もせずにappend
		target00.append(i)

target00.append(ans)
print(sum(target00))

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

int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    //cout << a << " " << b << " " << c << " " << d << endl;
    if(a>c){
        swap(a,c); swap(b,d);
    }
    //cout << a << " " << b << " " << c << " " << d << endl;
    if(c>b){//abcd
        cout << "0" << endl;
    }
    else if(b>=d){//acdb
        cout << d-c << endl;
    }
    else{//acbd
        cout << b-c << endl;
    }

    return 0;
}

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

int main(){
    int N;
    cin>>N;
    vector<int> H(N);
    rep(i,N) cin>>H[i];

    int count=0,ans=0;
    rep(i,N-1){
        if(H[i]>=H[i+1]){
            count++;
        }else{
            count=0;
        }
        ans=max(count,ans);
    }
    cout<<ans<<endl;
}

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

int main() {

	string S, T; cin >> S >> T;
	int n = S.size();
	const int p = 26;
	vector<vector<int>> m(p, vector<int>(p, 0));
	for (int i = 0; i < n; i++) {
		m[S[i] - 'a'][T[i] - 'a']++;
	}
	bool ok = true;	
	for (int i = 0; i < p; i++) {
		int cnt = 0;
		for (int j = 0; j < p; j++) {
			if (1 <= m[i][j]) cnt++;
		}
		if (2 <= cnt) ok = false;
	}
	for (int j = 0; j < p; j++) {
		int cnt = 0;
		for (int i = 0; i < p; i++) {
			if (1 <= m[i][j]) cnt++;
		}
		if (2 <= cnt) ok = false;
	}
	if (ok) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
using namespace std;
int main(){
    long long n,k,d,a,sum=0;
    cin>>n>>k;
    vector <long long> ans(n,0);
    f(i,0,k){
        cin>>d;
        f(j,0,d){
            cin>>a;
            ans[a-1]++;
        }
    }
    f(i,0,n){
        if(ans[i]==0){
            sum++;
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main() {
	int n, m, c; cin >> n >> m >> c;
	int b[100];
	int a[100][100];

	for (int i = 0; i < m; i++) cin >> b[i];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		int sum = 0;
		for (int j = 0; j < m; j++) {
			sum += b[j] * a[i][j];
		}
		sum += c;

		if (sum > 0) ans++;
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;

int counter(int x)
{
    if(x==0) return 0;
    return counter(x >> 1) + (x & 1);
}

int main(){
    int N;
    cin >> N;
    int A[20];
    int x[20][20];
    int y[20][20];
    for(int i=0;i<N;i++)
    {
        cin >> A[i];
        for(int j=0;j<A[i];j++)
        {
            cin >> x[i][j] >> y[i][j];
        }
    }
    int ans = 0;
    for(int bit=1;bit<(1<<N);bit++)
    {
        bool ok = true;
        for(int i=0;i<N;i++)
        {
            if(!(bit&(1<<i))) continue;
            for(int j=0;j<A[i];j++)
            {
                if(((bit >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = false;
            }
        }
        if (ok) ans = max(ans, counter(bit));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void	ft_swap(long *a, long *b)
{
	long tmp;
	
	tmp = *a;
	*a = *b;
	*b = tmp;
}

void	a_qsort(long *tab, long left, long right)
{
	long Left = left;
	long Right = right;
	long pivot = tab[(left + right) / 2];

	while (1)
	{
		while (tab[Left] < pivot)
			Left++;
		while (tab[Right] > pivot)
			Right--;
		if (Left >= Right)
			break ;
		ft_swap(&tab[Left], &tab[Right]);
		Left++;
		Right--;
	}

	if (Left - 1 > left)
		a_qsort(tab, left, Left - 1);
	if (Right + 1 < right)
		a_qsort(tab, Right + 1, right);
}

void	d_qsort(long *tab, long left, long right)
{
	long Left = left;
	long Right = right;
	long pivot = tab[(left + right) / 2];

	while (1)
	{
		while (tab[Left] > pivot)
			Left++;
		while (tab[Right] < pivot)
			Right--;
		if (Left >= Right)
			break ;
		ft_swap(&tab[Left], &tab[Right]);
		Left++;
		Right--;
	}

	if (Left - 1 > left)
		d_qsort(tab, left, Left - 1);
	if (Right + 1 < right)
		d_qsort(tab, Right + 1, right);
}

int main(void)
{
	long N;
	long x;
	long i;
	scanf("%ld", &N);
	scanf("%ld", &x);
	long a[N + 1];
	long sum = 0;
	long count = 0;
	i = 1;
	while (i <= N)
	{
		scanf("%ld", &a[i]);
		sum += a[i];
		i++;
	}
	if (sum == x)
	{
		printf("%ld", N);
		return 0;
	}
	else if (sum < x)
	{
		d_qsort(a, 1, N);
		i = 1;
		while (i <= N)
		{
			if (i != N && x >= a[i])
			{
				x -= a[i];
				count++;
			}
			if (i == N)
				break ;
			i++;
		}
	}
	else if (sum > x)
	{
		a_qsort(a, 1, N);
		i = 1;
		while (i <= N)
		{
			if (x >= a[i])
			{
				x -= a[i];
				count++;
			}
			i++;
		}
	}
	printf("%ld", count);
	return 0;
}


Measured memory_bytes: 128