akhauriyash/Code-Regression huggingface dataset:
package main
import (
  "bufio"
  "fmt"
  "os"
  "sort"
  "strconv"
  "strings"
)
func main() {
  io := IO{bufio.NewReaderSize(os.Stdin,100),bufio.NewWriterSize(os.Stdout,10000000)}
  n := io.NextInt()
  x := io.NextIntArray()
  a := make([]int,n)
  s := make([]int,n+1)
  for i:=0;i<n;i++ { a[x[i]-1]++ }
  sort.Ints(a)
  for i:=0;i<n;i++ { s[i+1] = s[i]+a[i] }
  ans := n
  i := n
  for k:=1;k<=n;k++ {
    for {
      for i > 0 && a[i-1] >= ans { i-- }
      if ans*(n-i)+s[i] >= ans*k { break }
      ans--
    }
    io.Println(ans)
  }
  io.Flush()
}
type IO struct {
  reader *bufio.Reader
  writer *bufio.Writer
}
func(io *IO) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := io.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(io *IO) Println(a ...interface{}) (int,error) {
  return fmt.Fprintln(io.writer,a...)
}
func(io *IO) Flush() error {
  return io.writer.Flush()
}
func(io *IO) NextInt() int {
  n,_ := strconv.Atoi(io.NextLine())
  return n
}
func(io *IO) NextIntArray() []int {
  s := strings.Fields(io.NextLine())
  a := make([]int,len(s))
  for i:=0;i<len(s);i++ { a[i],_ = strconv.Atoi(s[i]) }
  return a
}

Measured memory_bytes: 20736
#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	vector<string> S(3);
	cin >> S[0] >> S[1] >> S[2];
	vector<int> Card(3, 0);
	int Turn = 0;
	while (true) {
		Card[Turn]++;
		if (Card[Turn] > S[Turn].size()) {
			cout << (char)(Turn + 'A') << endl;
			break;
		}
		Turn = S[Turn][Card[Turn] - 1] - 'a';
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

int MOD_BIG = 1000000007;
int MOD_BIG2 = 998244353;
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

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


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

int main() {
    
    int x;
    cin >> x;
    
    if (x == 0) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string> 
using namespace std;
const int maxn=100007;
long long n,m,v,p,ans;
long long a[maxn],sum[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m>>v>>p;
	ans=p;
	for (long long i=1; i<=n; i++) cin>>a[i];
	sort(a+1,a+n+1);
	for (long long i=1; i<=n; i++) sum[i]=sum[i-1]+a[i];
	for (long long i=1; i<=n-p; i++)  
		if (a[i]+m>=a[n-p+1]) 
		if ((i+p-1)*m+(a[i]+m)*(n-p+1-i)-(sum[n-p+1]-sum[i])>=v*m) ++ans;
	//	if ((i-1+p-1)*m+a[i]+m-a[n-p+1]>=v*m) ++ans;
	cout<<ans<<endl; 
	return 0;
} 

Measured memory_bytes: 1792
import java.util.*; 
import java.lang.*; 


public class Main{
    
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                int S = scan.nextInt();
                
                long[] all = new long[S+1];
                
                for(int i=1; i<=S; i++){
                    if(i<=2){
                        all[i] = 0;
                    }else if( i== 3 ){
                        all[i] = 1;
                    }else{
                        all[i] = all[i-1]+all[i-3];
                        all[i] %= (10*10*10*10*10*10*10*10*10+7);
                    }
                }
                
                System.out.println(all[S]);

        }
}

Measured memory_bytes: 35712
def getDivisors(x):
    anss = set()
    for d in range(1, int(x**0.5)+1):
        if x%d == 0:
            anss.add(d)
            anss.add(x//d)
    return sorted(anss)

N = int(input())

divs = getDivisors(N)

ans = N
for div in divs:
    num = div + N//div - 2
    ans = min(ans, num)

print(ans)


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

int main(){

	int n, max_pt, pt[10], win, lose, drow, cnt;
	string str[10];

	cnt = 0;
	while(cin >> n){
		if(n == 0) break;
		if(cnt != 0) cout << endl;
		max_pt = 0;
		for(int i=0; i<n; i++){
			win = 0;
			lose = 0;
			drow = 0;
			cin >> str[i] >> win >> lose >> drow;
			pt[i] = win * 3 + drow;
			max_pt = max(max_pt, pt[i]);
		}
	
		for(int i=max_pt; i>=0; i--){
			for(int j=0; j<n; j++){
				if(pt[j] == i) cout << str[j] << "," << pt[j] << endl;
			}
		}
		cnt++;
	}

	return 0;

}

Measured memory_bytes: 1204
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}

	public Main(){
		new AOJ0256().doIt();
	}
	class AOJ0256{
		void doIt(){
			while(in.hasNext()){
				int sum = 0;
				for(int i=0;i<10;i++)sum+=in.nextInt();
				System.out.println(sum);
			}
		}
	}
}

Measured memory_bytes: 17316
#include <bits/stdc++.h>
#include <time.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD=1000000007;
const long double PI=3.14159265358979;
const ll MAX=0;

int main() {
  ll D,ans=0;
  cin>>D;
  ll c[26];
  ll s[D][26];
  rep(i,26){
    cin>>c[i];
    //c[i]=0;
  }
  rep(i,D){
    rep(j,26){
      cin>>s[i][j];
      //s[i][j]=1;
    }
  }
  ll t[D];
  rep(i,D){
    t[i]=i%26;
  }
  
  
  ll satis=0;
  rep(i,D){
    ll last[26];
    rep(j,26){
      last[j]=-1;
    }
    satis=0;
    satis+=s[i][t[i]];
    last[t[i]]=i;
    rep(j,26){
      satis-=c[j]*(i-last[j]);
    }
  }
  
  ans=satis;
  while(clock()<1900000){
    ll w=rand()%365,u=rand()%26;
    satis=0;
    ll last[26];
    rep(i,26){
      last[i]=-1;
    }
    ll g=t[w];
    t[w]=u;
    rep(i,D){
      satis+=s[i][t[i]];
      last[t[i]]=i;
      rep(j,26){
        satis-=c[j]*(i-last[j]);
      }
      
    }
    if(ans>satis){
      t[w]=g;
    }
    ans=max(ans,satis);
  }
  rep(i,D){
    cout<<t[i]+1<<endl;
    
  }
  //cout<<ans;
}


Measured memory_bytes: 3712
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//do {
//    print(v);
//  } while (std::next_permutation(v.begin(), v.end()));

class UnionFind {
public:
	vector<int> Parent;

	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	int root(int A) {
		if (Parent[A] < 0)return A;
		return Parent[A] = root(Parent[A]);
	}

	int size(int A) {
		return -Parent[root(A)];
	}

	bool unite(int A, int B) {
		A = root(A);
		B = root(B);
		if (A == B)
			return false;

		if (size(A) < size(B))
			swap(A, B);

		Parent[A] += Parent[B];
		Parent[B] = A;

		return true;
	}
};
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
	int N,M;
	cin >> N >> M;
	VI P(N);
	VI X(M);
	VI Y(M);
	UnionFind uni(N);
	REP(i, N)cin >> P[i];
	REP(i, M) {
		cin >> X[i] >> Y[i];
		X[i]--;
		Y[i]--;
		uni.unite(X[i], Y[i]);
	}
	int ans = 0;
	REP(i,N){
		if (uni.root(P[i]-1) == uni.root(i))ans++;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3456
#include<stdio.h>
    int main(void) {
        int h, w, i, j, g;
        char a[100];
        scanf("%d%d", &h, &w);
        for (i = 0; i<h; i++) {
            scanf("%s", a);
            g = -1;
            for (j = 0; j<w; j++) {
                if (a[j] == 'c') {
                    g = 0;
                }
                else if (g>-1) {
                    g++;
                }
                printf("%d", g);
                if (j == (w - 1)) {
                    printf("\n");
                }
                else {
                    printf(" ");
                }
            }
        }
        return 0;
    }

Measured memory_bytes: 1820
#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,d[100000],s=0,i,y,temp;
    cin>>a;
    for(i=0;i<(2*a);i++)
        cin>>d[i];
    sort(d,d+(2*a));
    //for(i=0;i<(2*a);i++)
       //cout<<d[i]<<endl;
    for(i=0;i<(2*a);i=i+2)
    {//cout<<d[i]<<endl;
        s=s+d[i];}
    cout<<s;
	}



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

ll mod = 1e9+7;

int main(){
    int N;
    cin >> N;
    vector<int> x(N);
    for (int i = 0; i < N; i++) cin >> x[i];
    x[0] = 1;
    ll ans = 1;
    int cnt = 1;
    for (int i = 1; i < N; i++) {
        ans = ans*(cnt+1)%mod;
        if (x[i] >= x[i-1]+2) {
            x[i] = x[i-1]+2;
            cnt++;
        }else x[i] = x[i-1];
    }
    cout << ans << endl;
    return 0;
}

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

int main( void )
{
    int n, a, b;
    cin >> n;
    if ( n == 1 )
    {
        cout << "Hello World" << endl;
    }
    else
    {
        cin >> a >> b;
        cout << a + b << endl;
    }

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(a) for a in input().split()]
S = 0
for i in range(N):
    if i%2 == 0:
        S += A[i]
    else:
        S -= A[i]
ans = str(S)
for i in range(N-1):
    S = 2*A[i] - S
    ans += " " + str(S)
print(ans)


Measured memory_bytes: 14024
import java.util.*;
public class Main {
    public static void main(String args []) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int [][] List = new int [H][W];
        for(int i=0;i<H;i++){
            String s = sc.next();
            for(int j=0;j<W;j++){
                if(s.charAt(j)=='.') List[i][j]=1;
                else List[i][j]=0;
            }
        }
        int max = 0;
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                int [][] Dis = new int [H][W];
                for(int k=0;k<H;k++)Arrays.fill(Dis[k],999999999);
                if(List[i][j]==1){
                    Dis[i][j]=0;
                    Dis = Dijkstra(List,Dis,H,W,i,j);
                    for(int k=0;k<H;k++)  for(int n=0;n<W;n++) if(max<Dis[k][n]&&Dis[k][n]!=999999999) max = Dis[k][n];
                }
            }
        }
        System.out.println(max);
    }
    public static int [][] Dijkstra(int [][] List,int [][] Dis,int H,int W,int now_r, int now_c){
        if(now_r!=0){
            if(List[now_r-1][now_c]==1) {
                if (Dis[now_r][now_c] + 1 < Dis[now_r - 1][now_c]) {
                    Dis[now_r - 1][now_c] = Dis[now_r][now_c] + 1;
                    Dis = Dijkstra(List, Dis, H, W, now_r - 1, now_c);
                }
            }
        }
        if(now_r!=H-1){
            if(List[now_r+1][now_c]==1) {
                if (Dis[now_r][now_c] + 1 < Dis[now_r + 1][now_c]) {
                    Dis[now_r + 1][now_c] = Dis[now_r][now_c] + 1;
                    Dis = Dijkstra(List, Dis, H, W, now_r + 1, now_c);
                }
            }
        }
        if(now_c!=0){
            if(List[now_r][now_c-1]==1) {
                if (Dis[now_r][now_c] + 1 < Dis[now_r][now_c - 1]) {
                    Dis[now_r][now_c - 1] = Dis[now_r][now_c] + 1;
                    Dis = Dijkstra(List, Dis, H, W, now_r, now_c - 1);
                }
            }
        }
        if(now_c!=W-1){
            if(List[now_r][now_c+1]==1) {
                if (Dis[now_r][now_c] + 1 < Dis[now_r][now_c + 1]) {
                    Dis[now_r][now_c + 1] = Dis[now_r][now_c] + 1;
                    Dis = Dijkstra(List, Dis, H, W, now_r, now_c + 1);
                }
            }
        }
        return Dis;
    }
}


Measured memory_bytes: 25812
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    int n;
    cin >> n;
    ll a[n];
    rep(i, n) {
        cin >> a[i];
    }
    sort(a, a + n);
    reverse(a, a + n);
    ll ans = 0;
    priority_queue<ll> que;
    que.emplace(a[0]);
    for (int i = 1; i < n; i++) {
        ans += que.top();
        que.pop();
        que.emplace(a[i]);
        que.emplace(a[i]);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N, a, b;
  cin >> N;
  vector<int> v(N);
  a = 0;
  b = 0;
  
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  
  for (int i = 0; i < N; i +=2) {
    a += v.at(i);
  }
  
  for (int i = 1; i < N; i +=2) {
    b += v.at(i);
  }
  
  cout << a - b << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 10000000000000000;
const ll mod = 1000000007;
ll test[1234][1234];
signed main() {
	ll n = 0, m = 0, k, l, cnt = 0, z = 0; cin >> n >> m;
	for (int h = 0; h < n; h++) {
		for (int i = 0; i < m; i++) {
			cin >> test[h][i];
		}
	}
	for (int h = 0; h < n; h++) {
		for (int i = h + 1; i < n; i++) {
			z = 0; double ok = 0;
			for (int j = 0; j < m; j++) {
				z += pow(abs(test[h][j] - test[i][j]), 2);
			}
			ok = sqrt(z); z = sqrt(z);
			if (z == ok) { cnt++; }
		}
	}
	cout << cnt << endl;
	cin >> n; return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<bool> one_to_i(N, false);
  vector<bool> i_to_N(N, false);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    if (a == 1) one_to_i.at(b-1) = true;
    if (b == N) i_to_N.at(a-1) = true;
  }
  bool flag = false;
  for (int i = 0; i < N; i++) {
    if (one_to_i.at(i)) {
      if (i_to_N.at(i)) flag = true;
    }
  }
  if (flag) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << x << endl

using ld = double;
using P = complex<ld>;
using G = vector<P>;
using circle = std::pair<P, ld>;
const ld pi = acos(-1);
const ld eps = 1e-10;
const ld inf = 1e12;

ld cross(const P& a, const P& b) { return a.real()*b.imag() - a.imag()*b.real(); }
ld dot(const P& a, const P& b) { return a.real()*b.real() + a.imag()*b.imag(); }

template <class iter>
circle min_ball(iter left, iter right, int seed = 1333) {
    const int n = right - left;

    assert(n >= 1);
    if (n == 1) {
        return {*left, ld(0)};
    }

    std::mt19937 mt(seed);
    std::shuffle(left, right, mt);
    // std::random_shuffle(left, right); // simple but deprecated

    iter ps = left;

    auto make_circle_3 = [](const P &a, const P &b, const P &c) -> circle {
        ld A = std::norm(b - c), B = std::norm(c - a), C = std::norm(a - b),
           S = cross(b - a, c - a);
        P p = (A * (B + C - A) * a + B * (C + A - B) * b + C * (A + B - C) * c) / (4 * S * S);
        ld r2 = std::norm(p - a);
        return {p, r2};
    };

    auto make_circle_2 = [](const P &a, const P &b) -> circle {
        P c = (a + b) / (ld)2;
        ld r2 = std::norm(a - c);
        return {c, r2};
    };

    auto in_circle = [](const P &a, const circle &c) -> bool {
        return std::norm(a - c.first) <= c.second + eps;
    };

    circle c = make_circle_2(ps[0], ps[1]);

    // MiniDisc
    for (int i = 2; i < n; ++i) {
        if (!in_circle(ps[i], c)) {
            // MiniDiscWithPoint
            c = make_circle_2(ps[0], ps[i]);
            for (int j = 1; j < i; ++j) {
                if (!in_circle(ps[j], c)) {
                    // MiniDiscWith2Points
                    c = make_circle_2(ps[i], ps[j]);
                    for (int k = 0; k < j; ++k) {
                        if (!in_circle(ps[k], c)) {
                            c = make_circle_3(ps[i], ps[j], ps[k]);
                        }
                    }
                }
            }
        }
    }
    return c;
}

int main() {
    int n; cin >> n;
    G p(n);
    rep(i,n) {
        ld x, y; cin >> x >> y;
        p[i] = P(x, y);
    }
    circle ans = min_ball(p.begin(), p.end());
    printf("%.12Lf\n", sqrtl(ans.second));
}

Measured memory_bytes: 256
a = list(map(int, input().split()))

if a[2] != 0:
    k =float(((2*(a[0]-a[2])*(a[1]-1))/(a[0]**2)))
else:
    k=float((((a[0]-a[2])*(a[1]-1))/(a[0]**2)))

print(k)


Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define ll long long
#define maxn 200010
inline ll read()
{
	ll x=0; char c=getchar(),f=1;
	for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1;
	for(;'0'<=c&&c<='9';c=getchar())x=x*10+c-'0';
	return x*f;
}
inline void write(ll x)
{
	static char buf[20],len; len=0;
	if(x<0)x=-x,putchar('-');
	for(;x;x/=10)buf[len++]=x%10+'0';
	if(!len)putchar('0');
	else while(len)putchar(buf[--len]);
}
inline void writesp(ll x){write(x); putchar(' ');}
inline void writeln(ll x){write(x); putchar('\n');}
int a,b,c;
int main()
{
	a=read(); b=read(); c=read();
	writeln(std::max(c-(a-b),0));
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rep2(i,s,t) for(int i = s; i <= t; ++i)
#define rev(i,n) for(int i = n-1; i >= 0; --i)
#define rev1(i,n) for(int i = n; i > 0; --i)
#define rev2(i,s,t) for(int i = s; i >= t; --i)
#define F first
#define S second
using namespace std;
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(a > b){ a = b; return 1; } return 0; }
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
using vii = vector<vi>;

ll floor_sum(ll n, ll m, ll a, ll b) {
  ll res = 0;
  if(a >= m) {
    res += n*(n - 1)*(a/m) / 2;
    a %= m;
  }
  if(b >= m) {
    res += n*(b/m);
    b %= m;
  }

  ll ymax = (a*n + b)/m, xmax = m*ymax - b;
  if(ymax == 0) return res;
  res += ymax*(n - (xmax + a - 1)/a);
  res += floor_sum(ymax, a, m, (a - xmax%a)%a);
  return res;
}

int main()
{
  int t; scanf("%d", &t);
  while(t-- > 0) {
    ll n,m,a,b; scanf("%lld %lld %lld %lld", &n, &m, &a, &b);
    printf("%lld\n", floor_sum(n,m,a,b));
  }
  return 0;
}


Measured memory_bytes: 3232
N = int(input())
s = 0

for i in range(N):
    l = input()
    ui = l[-3:]
    xi = float(l[:-3])
    if ui == 'JPY':
        s += xi
    elif ui == 'BTC':
        s += xi*380000.0
    else:
        pass
print(s)

Measured memory_bytes: 2940
import java.util.Scanner;
import java.util.HashMap;
import java.util.List;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long q = sc.nextLong();
        long h = sc.nextLong();
        long s = sc.nextLong();
        long d = sc.nextLong();
        int n = sc.nextInt();
        long min = 1000000000;
        if (n % 2 == 0) {
          long[] tmp = {q*8, h*4, s*2, d};
          for (int i = 0; i < 4; i++) {
            if (min > tmp[i]) {
              min = tmp[i];
            }
          }
          System.out.println(n/2 * min);
        } else {
          long[] tmp = {q*8, h*4, s*2, d};
          for (int i = 0; i < 4; i++) {
            if (min > tmp[i]) {
              min = tmp[i];
            }
          }
          if (q*4 >= h*2) {
            if (h*2 >= s) {
              System.out.println(n/2 * min + s);
            } else {
              System.out.println(n/2 * min + h*2);
            }
          } else {
            if (q*4 >= s) {
              System.out.println(n/2 * min + s);
            } else {
              System.out.println(n/2 * min + q*4);
            }
          }
        }
    }

}


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

int main() {
    char X, Y;
    cin >> X >> Y;
    char ans;
    if (X > Y) ans = '>';
    else if (X < Y) ans = '<';
    else ans = '=';
    cout << ans << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

int main(){
    int n, D[105]; cin >> n;
    ll d_sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> D[i];
    }
    for (int i = 0; i < n-1; i++)
    {
        for (int j = i+1; j < n; j++)
        {
            d_sum += D[i] * D[j];
        }
    }
    
    cout << d_sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=105;
const int M=1e5+5;
const int MOD=1e9+7;

int n,m;
int a[N];
int dp[M],sum[M];
void Add(int &x,int y)
{
	x+=y;
	if(x>=MOD) x-=MOD;
	if(x<0) x+=MOD;
}

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",a+i);
	dp[m]=1;
	for(int i=1;i<=n;i++)
	{
		memset(sum,0,sizeof(sum));
		for(int j=0;j<=m;j++)
		{
			Add(sum[max(j-a[i],0)],dp[j]);
			Add(sum[j+1],-dp[j]);
		}
		for(int j=0;j<=m;j++)
		{
			if(j) Add(sum[j],sum[j-1]);
			dp[j]=sum[j];
		}
	}
	printf("%d",dp[0]);
	
	return 0;
}

Measured memory_bytes: 1024
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	s := newScore()
	for i := 0; i < n; i++ {
		var taro, hanako string
		fmt.Scan(&taro, &hanako)
		s.game(taro, hanako)
	}
	s.print()
}

type score struct {
	taro   int
	hanako int
}

func newScore() score {
	return score{taro: 0, hanako: 0}
}
func (s *score) game(t, h string) {
	if t > h {
		s.taro += 3
	} else if t < h {
		s.hanako += 3
	} else {
		s.taro++
		s.hanako++
	}
}

func (s *score) print() {
	fmt.Printf("%d %d\n", s.taro, s.hanako)
}



Measured memory_bytes: 1172
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define forever for (;;)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
template<typename A> using V = std::vector<A>;
template<typename A> using F = std::function<A>;
template<typename A, typename B> using P = std::pair<A, B>;
using pii = P<int, int>;
using vi = V<int>;
using vd = V<double>;
using vs = V<std::string>;
using vpii = V<pii>;
using vvi = V<vi>;
using vvpii = V<vpii>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int n) { return n & 1; }
constexpr bool even(const int n) { return ~n & 1; }
template<typename T> std::istream &operator>>(std::istream &is, std::vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> std::istream &operator>>(std::istream &is, std::pair<A, B> &p) { is >> p.first; is >> p.second; return is; }
using namespace std;
// clang-format on

static const char *peropero = "AIZUNYAN";

main {
  string s;
  cin >> s;
  if (s.size() < 8) {
    cout << s << endl;
    return 0;
  }
  rep(i, s.size() - 7) {
    unordered_map<char, int> v(26);
    loop(j, i, i + 8) v[s[j]]++;
    if (v['A'] == 2 && v['I'] == 1 && v['N'] == 2 && v['U'] == 1 && v['Y'] == 1 && v['D'] == 1) {
      rep(j, 8) s[i + j] = peropero[j];
      i += 7;
    }
  }
  cout << s << endl;
}

Measured memory_bytes: 3224
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  vll a(n);
  rep(i,n)cin>>a[i];
  map<ll,ll> p;
  rep(i,n){
    p[i+1-a[i]]++;
  }
  ll ans=0;
  rep(i,n){
    ans+=p[i+1+a[i]];
    p[i+1-a[i]]--;
  }
  COUT(ans);
}

Measured memory_bytes: 27544
def solve():
    N = int(input())
    A = []
    for _ in range(N):
        A.append(int(input()))
        

    visited_flag = [False for _ in range(N)]
    cnt = 1
    i = 0
    while 1:
        if A[i] == 2:
            print(cnt)
            break
        else:
            i = A[i]  - 1
            if visited_flag[i] == True:
                print(-1)
                break
            visited_flag[i] = True
            cnt += 1


solve()

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

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> c(h);
  rep(i,h) cin >> c[i];
  int ans = 0;
  rep(bi,1<<h)rep(bj,1<<w) {
    int cnt = 0;
    rep(i,h)rep(j,w) {
      if (bi>>i & 1) continue;
      if (bj>>j & 1) continue;
      if (c[i][j] == '#') cnt++;
    }
    if (cnt == k) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
package main

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

func main() {
        var N int
        reader := bufio.NewReader(os.Stdin)

        fmt.Fscanf(reader, "%d\n", &N)

        A := make([]int, N, N)
        for i := 0; i < N; i++ {
                fmt.Fscanf(reader, "%d", &(A[i]))
        }
        reader.ReadLine()
        sort.Ints(A)
        B := make([]int, N, N)
        for i := 0; i < N; i++ {
                fmt.Fscanf(reader, "%d", &(B[i]))
        }
        reader.ReadLine()
        sort.Ints(B)
        C := make([]int, N, N)
        for i := 0; i < N; i++ {
                fmt.Fscanf(reader, "%d", &(C[i]))
        }
        sort.Ints(C)
        ans := 0
        for _, v := range B {
                a := sort.SearchInts(A, v)
                c := sort.SearchInts(C, v+1)
                ans = ans + a*(N-c)
        }
        fmt.Println(ans)
}

Measured memory_bytes: 5504
N = int(input())
Pn = input().split()
Pn = [int(i) for i in Pn]

Pn_min = Pn[0]
count = 0
for i in range(N):
    if(Pn[i] <= Pn_min):
        count = count + 1
        Pn_min = Pn[i]
print(count)
    


Measured memory_bytes: 25768
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu long long unsigned
int main()
{
    int t,a,b,x,y,z,n,mx,mn,tmp;
    scanf("%d",&t);
    int cnt=0,ans=0;
    string s="";
    vector<int>vc;
    map<int,int>mp;
    map<char,int>mc;
    char ch,ch2;
    for(int i=0;i<t;i++){
        scanf("%d",&x);
        vc.push_back(x);
    }
    for(int i=1;i<t-1;i++){
        if((vc[i]>vc[i-1] && vc[i]<vc[i+1]) || (vc[i]>vc[i+1] && vc[i]<vc[i-1])) cnt++;
    }
    cout<<cnt<<"\n";


    return 0;
}







Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<queue>
using namespace std;
int n;
long long ggcd;
long long t;
long long gcd(long long x,long long y)
{
	long long z=x%y;
	while(z)
	{
		x=y;
		y=z;
		z=x%y;
	}
	return y;
}
int main()
{
	scanf("%d",&n);cin>>ggcd;
	for(int i=2;i<=n;i++){
		cin>>t;
		ggcd=ggcd/gcd(ggcd,t)*t;
	}
	cout<<ggcd;
	return 0;
 }


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

struct UnionFind {
    vector<int> par;

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

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

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

    int solve(int N) { 
        int ans = 0;
		map<int,int> c;
		for(int i=0;i<N;i++)int a=root(i);
        for(int u:par){
			if(c[u]==0){
				c[u]++;
				ans++;
			}
		}
        return ans;
    }
};

int main() {
    int n,m;
    cin >> n >> m;
    UnionFind tree(n);
    for(int i = 0; i < m; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        tree.unite(x-1, y-1);
    }
    cout << tree.solve(n);
    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(), x.end()
#define M 1000000007
using namespace std;

int h, w;
vector<string> g;

bool isValid(int i, int j) {
    return (i >= 0 && i < h && j >= 0 && j < w && g[i][j] == '.');
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> h >> w;
    for(int i = 0; i < h; i++) {
        string s; cin >> s;
        g.push_back(s);
    }
    vector<vector<long long>> dp(h, vector<long long> (w, 0));
    dp[0][0] = 1;
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            ll a = (isValid(i-1, j)?dp[i-1][j]:0);
            ll b = (isValid(i, j-1)?dp[i][j-1]:0);
            dp[i][j] = max(dp[i][j], (a%M+b%M)%M);
        }
    }

    cout << dp[h-1][w-1] << '\n';
}


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

int N,M,A[1001],B,V[1001];
int main(int i,int j){
	cin>>N>>M;
	for(;i<=N+M;i++){
		cin>>((i<=N)?A[i]:B);
		for(j=1;j<=N;j++){
			if(i>N&&B>=A[j]){
				V[j]++;break;
			}
		}
	}
	int max=0;
	for(i=1;i<=N;i++){
		if(max<V[i]){
			max=V[i];j=i;
		}
	}
	cout<<j<<endl;
	return 0;
}

Measured memory_bytes: 1168
N = int(input())
mod = 10**9+7
memo = {}

for i in range(2, N+1):
    for j in range(2, i+1):
        while i % j == 0:
            i  = i // j
            try:
                memo[j] += 1
            except:
                memo[j] = 1

ans = 1
for key in memo.keys():
    ans *= memo[key] + 1

print(ans%mod)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1LL << 61);
const int inf = 1001001001;
const int mod = 1000000007;

ll fact(ll a) {
	ll res = 1;
	for (int i = 1; i <= a; ++i) (res *= i) %= mod;
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	if (abs(n - m) > 1) {
		cout << 0 << endl;
		return 0;
	}
	if (n == m) {
		ll ans = 2ll * fact(n) % mod * fact(m) % mod;
		cout << ans << endl;
	}
	else {
		ll ans = fact(n) * fact(m) % mod;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, N) for(int i = 0; i < N; ++i)


using namespace std;

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

    vector<int> a;

    int totalVal = 0;
    rep(i, n)
    {
        int val;
        cin >> val;
        a.push_back(val);
        totalVal += val;
    }
    sort(a.begin(), a.end(), greater<int>());
    
    if (a[m-1] >= static_cast<float>(totalVal) / (4 * m))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    return 0;
}


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

int main ()
{
    int a;
    vector<int> b(11,0);
    for(int i=0;i<3;i++)
    {
        cin>>a;
        b.at(a)+=1;
    }
    if(b.at(5)==2 && b.at(7)==1)
    cout<<"YES"<<endl;
    else
    cout<<"NO"<<endl;
        
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  cout << fixed << setprecision(15);
  int a,b,c,d,e,f;
  cin >> a >> b >> c >> d >> e >> f;
  double wmax=(double)f*100/(100+e);
  double smax=(double)f*e/(100+e);
  double pmax=-1;
  int ans1=0,ans2=0;
  for(int i=0;i<=f;i+=a*100){
    for(int j=0;i+j<=f;j+=b*100){
      if(i+j==0) continue;
      for(int k=0;i+j+k<=f;k+=c){
        for(int l=0;i+j+k+l<=f;l+=d){
          if((double)(k+l)/(i+j)>(double)e/100) continue;
          if((double)(k+l)*100/(i+j+k+l)>pmax){
            //cout << i << " " <<  j << " " << k << " " << l << " " << pmax << endl;
            pmax=(double)(k+l)*100/(i+j+k+l);
            ans1=i+j+k+l;
            ans2=k+l;
          }
        }
      }
    }
  }
  //cout << wmax << " " << smax << endl;
  cout << ans1 << " " << ans2 << 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 ll long long

int main(){
	int n;
	cin >> n;
	int cnt = 0;
	int val = -1;
	bool ans = false;

	rep(i, n)
	{
		int d1;
		int d2;
		cin >> d1 >> d2;

		if (d1 == d2)
		{
			cnt++;
			if (cnt == 3)
				ans = true;
		}
		else
		{
			cnt = 0;
		}
		
	}

	if (ans)
		cout << "Yes" << endl;
	else
	{
		cout << "No" << endl;
	}
	
	return 0;
}



Measured memory_bytes: 3628
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    private static List<Long> reverseV(List<Long> v) {
        List<Long> newList = new ArrayList<>(v);
        Collections.reverse(newList);
        return newList;
    }

    private static List<Long> reverseX(long C, List<Long> x) {
        List<Long> newList = x.stream().map(val -> C - val).collect(Collectors.toList());
        Collections.reverse(newList);
        return newList;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int N = sc.nextInt();
            long C = sc.nextLong();
            List<Long> x = new ArrayList<>();
            List<Long> v = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                x.add(sc.nextLong());
                v.add(sc.nextLong());
            }
            System.out.println(Math.max(
                solve(N, C, x, v),
                solve(N, C, reverseX(C, x), reverseV(v))));
        }
    }

    private static long solve(int N, long C, List<Long> x, List<Long> v) {
        long[] maxR = getMaxArray(N, x, v);
        long[] maxL = getMaxArray(N, reverseX(C, x), reverseV(v));

        long ans = 0;

        for (int i = 0; i < N; i++) {
            ans = Math.max(ans, maxR[i]);
            if ( N >= 2 && i < N - 1 ) {
                ans = Math.max(ans, maxR[i] - x.get(i) + maxL[N - i - 2]);
            }
        }

        return ans;
    }

    private static long[] getMaxArray(int N, List<Long> x, List<Long> v) {
        long[] max = new long[N];
        long cost = 0;
        for (int i = 0; i < N; i++) {
            cost += v.get(i);
            long costWithWalk = cost - x.get(i);
            if ( i > 0 ) {
                max[i] = Math.max(costWithWalk, max[i - 1]);
            } else {
                max[i] = Math.max(0, costWithWalk);
            }
        }
        return max;
    }
}


Measured memory_bytes: 95744
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define SF scanf
#define PF printf
#define REP(i,a,b) for(int i = (a);i <= (b);i++)
#define N 200100
int n,sum[N],a[N];
using namespace std;
long long ans = 0ll;
int main()
{
	cin>>n;
	REP(i,1,n)
		SF("%d",&a[i]);
	int r = 1;
	int xx = a[1], ss = a[1];
	REP(i,1,n){
		while(xx == ss && r <= n){
			r++;
			xx ^= a[r], ss += a[r];
		}
		ans += r - i;
		xx ^= a[i], ss -= a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans =(int) Math.ceil((a + b) / 2.0 );
		System.out.println(ans);

		}
	}

Measured memory_bytes: 21460
n, m = map(int, input().split())

h = [num for num in map(int, input().split())]

a = [1] * n

for i in range(m):
  a_in, b_in = map(int, input().split())
  a_in -= 1
  b_in -= 1
  if h[a_in] > h[b_in]:
    a[b_in] = 0
  elif h[a_in] < h[b_in]:
    a[a_in] = 0
  else:
    a[a_in] = 0
    a[b_in] = 0

# print(n, m)
# print(h)
print(sum(a))


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  ll n;
  cin >> n;
  vector<ll> a(n+2);
  a[0] = 0;
  rep(i, 1, n+1) cin >> a[i];
  a[n+1] = 0;
  
  ll sum = 0;
  rep(i, 0, n+2-1) sum += abs(a[i+1]-a[i]);
  
  rep(i, 1, n+1) {
    ll diff = abs(a[i-1]-a[i])+abs(a[i]-a[i+1]) - abs(a[i+1]-a[i-1]);
    cout << sum-diff << "\n";
  }
}

Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

void solve() {
    char c; cin >> c;
    cout << (char) (c+1) << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 256
sx, sy, tx, ty = input().split()
sx = int(sx)
sy = int(sy)
tx = int(tx)
ty = int(ty)

result = ''

# 1syuume
result += 'R'*abs(sx-tx)
result += 'U'*abs(sy-ty)
result += 'L'*abs(sx-tx)
result += 'D'*abs(sy-ty)

result += 'D'
result += 'R'*(abs(sx-tx)+1)
result += 'U'*(abs(sy-ty)+1)
result += 'L'
result += 'U'
result += 'L'*(abs(sx-tx)+1)
result += 'D'*(abs(sy-ty)+1)
result += 'R'

print(result)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  int s_size = s.size();
  int point = 0;
  int out[s_size];
  for(int i=0;i<s_size;i++){
    switch(s.at(i)){
      case '0':
        out[point] = 0;
        point += 1;
        break;
      case '1':
        out[point] = 1;
        point += 1;
        break;
      case 'B':
        if(point>0){
          point -= 1;
        }
        break;
    }
  }
  for(int i=0;i<point;i++){
    cout << out[i];
  }
  cout << endl;
}

Measured memory_bytes: 256
/*
    ASEEN AAN 
            PINDAN AALE JATT!!!
                                */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli M=1000000007;   
lli INF=1e17;
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcount(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctz(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clz(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffs(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,q,z,y,k,m;
const double pi1=3.14159265358979323846;
//unordered_map<pair<ll,lli>,lli> mp;
lli me(lli a,lli b,lli M)
{
    if(b==0)
    return 1;
    else if(b%2==0)
    return me((a*a)%M,b/2,M);
    else
    return (a%M*me((a*a)%M,(b-1)/2,M)%M)%M;
}
lli mI(lli a,lli m)
{
    return me(a,m-2,m);
}
//lli tot=0;
vector<lli> pf(string s) {
    int n = (int)s.length();
    vector<lli> pi(n);
    for (int i = 1; i < n; i++) {
        int j = pi[i-1];
        while (j > 0 && s[i] != s[j])
            j = pi[j-1];
        if (s[i] == s[j])
            j++;
        pi[i] = j;
    }
    return pi;
}
//map<ll,lli> dp;
//set<lli> s[100005];
//lli dp[3005][3005];
ll pre[3005][3005];
map<lli,lli> vis;
//string sdp[3005][3005];
lli x[3][105];
lli dp[100005];
vector<lli> v[100005];
lli dfs(lli i)
{
    vis[i]=1;
    for(int j=0;j<v[i].size();j++)
    {
        if(vis[v[i][j]]==0)
        {
            dfs(v[i][j]);
            dp[i]=max(dp[i],dp[v[i][j]]+1);
        }
        else
        dp[i]=max(dp[i],1+dp[v[i][j]]);
    }
    return dp[i];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin>>n>>m;
    lli x,y;
    for(int i=1;i<=m;i++)
    {
        cin>>x>>y;
        v[x].push_back(y);
    }
    lli mx=-1;
    for(int j=1;j<=n;j++)
    {
        if(!vis[j])
        mx=max(mx,dfs(j));
    }
    cout<<mx;
}

Measured memory_bytes: 17152
#include <bits/stdc++.h>
using namespace std;
int main(){
    vector<int>data(3);
    for(int i=0;i<3;i++)cin >>data[i];
    sort(data.begin(),data.end());
    cout<< data[0]<<" "<<data[1]<<" "<<data[2]<<endl;
}


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

int main() {
  int N,count;
  count=0;
  cin>>N;
  vector<int>vec(N);
  for(int i=0;i<N;i++)cin>>vec.at(i);
  sort(vec.begin(), vec.end());
  for(int i=0;i<N-1;i++){
    if(vec.at(i)==vec.at(i+1))count++;
  }
  if(count>0)cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
  
}


Measured memory_bytes: 1152
from collections import defaultdict
n = int(input())
s = input()

a = s[:n]
b = s[n:][::-1]
d = defaultdict(int)
e = defaultdict(int)

def cnt(c, d):
    for bit in range(1 << n):
        x = []
        y = []
        for i in range(n):
            if bit >> i & 1:
                x.append(c[i])
            else:
                y.append(c[i])
        d[(str(x), str(y))] += 1


cnt(a, d)
cnt(b, e)

ans = 0
for k, v in d.items():
    ans += e[k] * v
print(ans)


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

main()
{
  int n,q,x;
  vector<int> V;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>q;
    if(q==0){
      cin>>x;
      V.push_back(x);
    }
    if(q==1){
      cin>>x;
      cout<<V[x]<<endl;
    }
    if(q==2) V.pop_back();
  }
}



Measured memory_bytes: 3888
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
using namespace std;  
typedef long long ll;  

char s[100005];
char a[30] = {'0','z','y','x','w','v','u','t','s','r','q','p','o','n','m','l','k','j','i','h','g','f','e','d','c','b'};// spend
char b[30] = {'0','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'};

int find(char x){
	for(int i = 0; i <= 26; i++){
		if(a[i] == x) return i;
	}
}

int find2(char x){
	for(int i = 0; i <= 26; i++){
		if(b[i] == x) return i;
	}
}

int main()
{
	int k;
	cin >> s >> k;
	int len = strlen(s);
	bool flag = false;
	for(int i = 0; i < len && flag == false; i++){
		if(s[i] != 'a') flag = true;
	}
	if(flag == false){
		k %= 26;
		s[len-1] = b[find2('a') + k];
		cout << s << endl;
		return 0;
	}
	for(int i = 0; i < len; i++){
		if(s[i] != 'a' && find(s[i]) <= k) k -= find(s[i]), s[i] = 'a';
		else continue;
	}
	if(k >= 26) k %= 26;
	if(k > 0) s[len-1] = b[find2(s[len-1]) + k];
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 384
import sys
from collections import defaultdict
sys.setrecursionlimit(100000)
N, Q = map(int, input().split())

neighbor = defaultdict(list)
counter = [0] * N
pcounter = [None] * N
depth = {0: 0}

for i in range(N-1):
    a, b = map(int, input().split())
    a_deper, b_deeper = False, False
    if a in depth and b not in depth:
        depth[b] = depth[a] + 1
    if b in depth and a not in depth:
        depth[a] = depth[b] + 1
    if a in depth and b in depth:
        if depth[a] < depth[b]:
            neighbor[a-1].append(b-1)
        else:
            neighbor[b-1].append(a-1)
    else:
            neighbor[a-1].append(b-1)
            neighbor[b-1].append(a-1)

for i in range(Q):
    p, x = map(int, input().split())
    counter[p-1] += x

def solve():
    stack = [(0, None)]
    while stack:
        (node, parent) = stack.pop()
        pcounter[node] = counter[node]
        if parent is not None:
            pcounter[node] += pcounter[parent]
        for c in neighbor[node]:
            if pcounter[c] is None:
                stack.append((c, node))

solve()
print(*pcounter, sep=' ')


Measured memory_bytes: 121176
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
    class QQ
    {
        static void Main(string[] args)
        {
            for(int i=1;i<10;i++)
            {
                for(int j=1;j<10;j++)
                {
                    System.Console.WriteLine(i.ToString() + "x" + j.ToString() + "=" +(i*j).ToString());
                }
            }
            System.Console.ReadLine();
        }
    }
}

Measured memory_bytes: 19948
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long   ll;
typedef unsigned long long   ull;
typedef long double ld;
typedef pair<ll, ll>    pll;
typedef pair<ull, ull>    pull;
typedef pair<ll, ll>  pii;
typedef pair<ld, ld>  pld;

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

    ll n;
    string s;
    cin >> n >> s;
    if(n % 2)
        cout << "No";
    else{
        if( s.substr(0, n/2) == s.substr(n/2, n/2))
            cout << "Yes";
        else
            cout << "No";
    }
}

Measured memory_bytes: 256