akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<vector>
#include<cassert>

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

using namespace std;

const int INF=1<<29;

class edge{
public:
	int v,cost;
	edge(int v,int cost):v(v),cost(cost){}
};

int main(){
	for(int n,m,k;scanf("%d%d%d",&n,&m,&k),n;){
		vector<edge> G[100];
		int d[100][100];
		rep(u,n) rep(v,n) d[u][v]=(u==v?0:INF);
		rep(_,m){
			int u,v,cost; scanf("%d%d%d",&u,&v,&cost);
			assert(d[u][v]==0 || d[u][v]==INF);
			d[u][v]=d[v][u]=cost;
			G[u].push_back(edge(v,cost));
			G[v].push_back(edge(u,cost));
		}

		rep(w,n) rep(u,n) rep(v,n) d[u][v]=min(d[u][v],d[u][w]+d[w][v]);

		double dp[100][100]={}; // dp[u][v] := ( u->v 間の最短経路の個数 )
		rep(u,n) rep(i,G[u].size()) {
			int v=G[u][i].v,cost=G[u][i].cost;
			if(d[0][u]+cost+d[v][n-1]==d[0][n-1]) dp[u][v]=1;
		}
		rep(w,n) rep(u,n) rep(v,n) dp[u][v]+=dp[u][w]*dp[w][v];

		rep(_,k){
			int c; scanf("%d",&c);
			printf("%.9f\n",dp[0][c]*dp[c][n-1]/dp[0][n-1]);
		}
		puts("");
	}

	return 0;
}

Measured memory_bytes: 1316
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int A,B;
 int ans = 0;
  cin >> A >> B;
  for(int i = A;i<=B;i++){
   if(i/10000 == i%10000%1000%100%10){
    if(i%10000/1000 == i%10000%1000%100/10){
      ans +=1;
    }
   }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
from sys import stdin


def main():
    _ = int(stdin.readline().rstrip())
    Hs = [int(x) for x in stdin.readline().rstrip().split()]
    print(len([x for i, x in enumerate(Hs) if i == 0 or max(Hs[:i]) <= x]))


if __name__ == "__main__":
    main()


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

int main(){
  int a,b;
  cin >> a >> b ;
  if(a%3==0 || b%3==0){
    cout << "Possible" << endl;
  }
  else if((a+b)%3==0){
    cout << "Possible" << endl;
  }
  else{
    cout << "Impossible" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
from collections import deque
h, w = map(int, input().split())
map = [ list(input()) for _ in range(h) ]
ans = 0
for i in range(h):
    l = map[i]
    ans += l.count(".")

def bfs(x, y):
    for (next_x, next_y) in [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]:
        if 0 <= next_x < h and 0 <= next_y < w and map[next_x][next_y] == ".":
            map[next_x][next_y] = 1 + map[x][y]
            q.append([next_x, next_y])

map[0][0] = 1
q = deque([[0, 0]])
while True:
    if len(q) == 0:
        break
    x, y = q.popleft()
    bfs(x, y)

if map[h-1][w-1] == ".":
    ans = -1
else:
    ans -= map[h-1][w-1]

print(ans)

Measured memory_bytes: 3316
N=input()
h=list(map(int,input().split()))

def par(l):
    res=[]
    tmp=[]
    for i in range(len(l)):
        if l[i]==0 and len(tmp)>0:
            res.append(tmp)
            tmp=[]
        if l[i]>0:
            tmp.append(l[i])
    if len(tmp)>0:
        res.append(tmp)
    return res

l=par(h)
ans=0

while len(l)>0:
    tmp=[]
    for block in l:
        m = min(block)
        ans+=m
        tmp+=par([e-m for e in block])
    l=tmp
print(ans)


Measured memory_bytes: 39152
n,m=map(int,input().split())
x=[list(input().split()) for i in range(m)]
a=0
p=0
x.sort(key=lambda x:x[0])
t='a'
for i in range(m):
  if t!=x[i][0]:
    w=0
    t=x[i][0]
    f=1
  if f:
    if x[i][1]=='AC':
      a+=1
      p+=w
      f=0
    else:
      w+=1
print(a,p)

Measured memory_bytes: 27560
// Problem : 
// 			B - Choose Integers
// 			Editorial
// 		
// Contest : AtCoder - AtCoder Beginner Contest 060
// URL : https://atcoder.jp/contests/abc060/tasks/abc060_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define sz(x)             (int)x.size()
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define gcd(a,b)        __gcd(a,b)
#define lcm(a,b)        (a*(b/gcd(a,b)))
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
#define watch(x)         cout << #x << " = " << x << endl
#define trace(x)         cerr << #x << " = " << x << endl
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void angshuGod()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){
    
	int a,b,c; cin>>a>>b>>c;
	bool flag = false;
	for(int i = 1;i<=a*b;i++){
		int x = a*i;
		if(x%b==c){
			flag = true;
			break;
		}
	}
	cout<<(flag?"YES":"NO");
}

 
int32_t main()
{
    angshuGod();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

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

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

	while (S.length() != 1) {
		S.pop_back();

		if (S.substr(0, S.length() / 2) == S.substr(S.length() / 2)) {
			cout << S.length() << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3628
using System;
using static System.Console;

namespace abc177
{
    class Program
    {
        static int keyNum = (int)1e9 + 7;
        static void Main()
        {
            var n = int.Parse(ReadLine());
            var aList = ReadNumList();
            WriteLine(SumOfProd(aList));
        }
        static int[] ReadNumList()
        {
            var line = Console.ReadLine().Split(' ');
            if (line.Length == 1 && string.IsNullOrEmpty(line[0]))
            {
                return new int[0];
            }
            var numList = new int[line.Length];
            for (var i = 0; i < line.Length; ++i)
            {
                numList[i] = int.Parse(line[i]);
            }
            return numList;
        }
        static int SumOfProd(int[] aList)
        {
            var rui = GetRui(aList);
            var total = 0L;
            for (var i = 1; i < aList.Length; ++i)
            {
                total = (total + (aList[i] * rui[i]) % keyNum) % keyNum;
            }
            return (int)total;
        }
        static long[] GetRui(int[] aList)
        {
            var rui = new long[aList.Length + 1];
            var tmp = 0;
            for (var i = 0; i < aList.Length; ++i)
            {
                tmp = (tmp + aList[i]) % keyNum;
                rui[i + 1] = tmp;
            }
            return rui;
        }
    }
}


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

int main(){
  int n, m;
  cin >> n >> m;
  vvi g(n);
  rep(i,m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int ans = 0;
  queue<int> q;
  vi dist(n, -1);
  
  //dist[0] = 1;
  //q.push(0);
  
  queue<int> kai;
  rep(i,n) kai.push(i);
  vector<bool> ok(n, true);
while(!kai.empty()){
  int st;
  while(1){
    st = kai.front();
    if(!ok[st]) kai.pop();
    if(ok[st]) break;
  }
  
  kai.pop();
  ok[st] = false;
  
  dist[st] = 1;
  q.push(st);
  
  int cnt = 0;
  while(!q.empty()){
    int v = q.front();
    q.pop();
    for(int nv : g[v]){
      if(dist[nv] != -1) continue;
      dist[nv] = 1;
      q.push(nv);
      //ok[nv] = false;
    }
    cnt++;
  }
  ans = max(ans, cnt);
}
  cout << ans << endl;
}


Measured memory_bytes: 16372
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<map>
#include<utility>
#include<algorithm>

using namespace std;

bool mycomp1(pair<int,int> a, pair<int,int>b){
	return a.second>b.second;	
}

bool mycomp2(pair<int,int> a, pair<int,int>b){
	return a.first<b.first;
}

map<int, int> update;
int main(){
	int n,m;
	scanf("%d %d", &n, &m);

	for(int i=0;i<m;i++){
		int r;
		scanf("%d", &r);
		update[r] = i;
	}

	vector<pair<int,int> > requests;
	for(map<int, int>::iterator it=update.begin(); it!=update.end(); it++){
		requests.push_back(pair<int,int>(it->first, it->second));
	}

	std::sort(requests.begin(), requests.end(), mycomp1);

	for(int i=0;i<requests.size();i++){
		printf("%d\n", requests[i].first);
	}


	std::sort(requests.begin(), requests.end(), mycomp2);
	int now = 1;

	for(int i=0;i<requests.size();i++){
		int exclude = requests[i].first;
		for(int j=now;j<exclude;j++){
			printf("%d\n", j);
		}
		now = exclude+1;
	}
	for(int j=now;j<=n;j++){
		printf("%d\n", j);
	}

}

Measured memory_bytes: 8084
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

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






std::vector<long long> fact_inv, fact;

long long power(long long a, unsigned long long b, long long m){
    long long ret(1);
    while(b){
        if(b & 1) ret = (ret * a) % m;
        a = (a * a) % m;
        b /= 2;
        if(ret < 0) ret += m;
        if(a < 0) a += 0;
    }
    return ret;
}

long long power(long long a, unsigned long long b) {
    return power(a, b, MOD);
}

long long inv(long long a, long long m){ // GCD(a, m) = 1
    return power(a, m-2, m);
}

long long inv(long long a){
    return inv(a, MOD);
}

long long comb(long long a, long long b, long long m){
    if(a < b) return 0;
    if(a < 0 || b < 0) return 0;
    long long ret = fact[a];
    ret = ret * fact_inv[b] % m;
    ret = ret * fact_inv[a-b] % m;
    return ret;
}

long long comb(long long a, long long b){
    return comb(a, b, MOD);
}

void precom(int n, long long m){
    fact.resize(n);
    fact_inv.resize(n);
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    for(int i = 2; i < n; ++i) fact[i] = fact[i-1] * i % m;
    for(int i = 2; i < n; ++i) fact_inv[i] = inv(fact[i], m);
    return;
}

void precom(int n){
    precom(n, MOD);
    return;
}


int main(){
    int K; std::cin >> K;
    std::string S; std::cin >> S;
    int N(S.length());
    long long ans(0);
    precom(K+N+4);
    for(int i(0); i <= K; ++i){
        long long c(power(25, K-i) * power(26, i) % MOD);
        ans += c * comb(K-i+N-1, N-1) % MOD;
        ans %= MOD;
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 35548
//c++ テンプレ
#include<bits/stdc++.h>
using namespace std;

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve(){
    int h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int x1=h1*60+m1;
    int x2=h2*60+m2;
    int x=x2-x1-k;
    cout << x << endl;
}

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


Measured memory_bytes: 3632
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var a = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var x = Array.ConvertAll(line, int.Parse);
        var dp = new long[n + 1, n + 1, n * 50 + 1000];
        dp[0, 0, 0] = 1;
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                for (int k = 0; k <= n * 50 + 1; k++)
                {
                    dp[i + 1, j, k] += dp[i, j, k];
                    dp[i + 1, j + 1, k + x[i]] += dp[i, j, k];
                }
        var rep = 0L;
        for (int i = 1; i < n + 1; i++)
            rep += dp[n, i, i * a];
        Console.WriteLine(rep);
    }
}

Measured memory_bytes: 80608
n = gets.chomp!.to_i
s = gets.chomp!.to_s
#n = 6
#s = "abcabc"
ls = s.split("")
if n%2 == 0
  r = n / 2 -1
  second = []
  for i in 0..r do
    second << ls[i]
  end
  #p second
  #p ls
  third = []
  for j in r+1..n-1 do
    third << ls[j]
  end
#p second
#p third
if third == second
  print("Yes\n")
else
  print("No\n")
end

else
  print("No\n")
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int N = 1e5 + 10;
int n, del[N];
pii br[N], bl[N];
inline long long Solve1() {
	memset(del, 0, sizeof del);
	long long ans = 0;
	int np = 0, lp = n, rp = 1, flag = 1;
	while (flag) {
		flag = 0;
		while (lp && del[bl[lp].second]) --lp;
		if (lp && np < bl[lp].first) {
				ans += bl[lp].first - np;
				np = bl[lp].first;
				del[bl[lp].second] = 1;
				flag = 1;
		}
		while (rp <= n && del[br[rp].second]) ++rp;
		if (rp <= n && np > br[rp].first) {
				ans += np - br[rp].first;
				np = br[rp].first;
				del[br[rp].second] = 1;
				flag = 1;
		}
	}
	return ans + abs(np);
}
inline long long Solve2() {
	memset(del, 0, sizeof del);
	long long ans = 0;
	int np = 0, lp = n, rp = 1, flag = 1;
	while (flag) {
		flag = 0;
		while (rp <= n && del[br[rp].second]) ++rp;
		if (rp <= n && np > br[rp].first) {
				ans += np - br[rp].first;
				np = br[rp].first;
				del[br[rp].second] = 1;
				flag = 1;
		}
		while (lp && del[bl[lp].second]) --lp;
		if (lp && np < bl[lp].first) {
				ans += bl[lp].first - np;
				np = bl[lp].first;
				del[bl[lp].second] = 1;
				flag = 1;
		}
	}
	return ans + abs(np);
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d%d", &bl[i].first, &br[i].first);
		bl[i].second  = br[i].second = i;
	}
	sort(bl + 1, bl + n + 1);
	sort(br + 1, br + n + 1);
	printf("%lld\n", max(Solve1(), Solve2()));
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<60);

void failed(){
    cout<<"No"<<endl;
    exit(0);
}

void solve(vector<string> &s){
    vec pn(0), p(0);
    rep(i,N){
        ll need = 0, plus = 0;
        for(char c : s[i]){
            plus += (c == '(' ? 1 : -1);
            need = max(need, -plus);
        }
        if(plus >= 0){
            pn.push_back(need);
            p.push_back(plus);
        }
    }
    vec op(p.size());
    int nump = p.size();
    rep(i,nump) op[i] = i;
    sort(ALL(op), [&](int x, int y){return pn[x] < pn[y];});
    ll adv = 0, id = 0;
    while(id != nump && pn[op[id]] <= adv){
        adv += p[op[id]];
        ++id;
    }
    if(id != nump) failed();
    return;
}
int main() {
    cin>>N;
    vector<string> s(N);
    rep(i,N) cin>>s[i];
    ll num = 0;
    rep(i,N){
        for(char c : s[i]) num += (c == '(' ? 1 : -1);
    }
    if(num != 0)failed();
    solve(s);
    rep(i,N) {
        reverse(ALL(s[i]));
        int n = s[i].size();
        rep(j, n){
            s[i][j] = "()"[s[i][j] == '('];
        }
    }
    solve(s);
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 47476
#include <iostream>

using namespace std;

int main(void)
{
    int N, W;
    cin >> N >> W;

    unsigned long dp[W+1];
    for (int i = 0; i <= W; i++) {
        dp[i] = 0;
    }

    for (int i = 1; i <= N; i++) {
        int weight, value;
        cin >> weight >> value;

        for (int j = W; j >= weight; j--) {
            dp[j] = max(dp[j], dp[j - weight] + value);
        }
    }

    cout << dp[W] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 100005

int main(){

    int n;
    int two=0,four=0;
    cin >> n;
    vector<int> a(n,0);
    REP(n){
        cin >> a[i];
    }

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

        if(a[i]%4 == 0){
            four++;
        }else if(a[i]%2 == 0){
            two++;
        }
    }
    //cout << two << " " << four << endl;

    if(two/2 + four >= n/2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <set>
using namespace std;
int main(){
  int n;
  cin >> n;
  set<int> s;
  for(int i=0; i<n; i++){
    int a;
    cin >> a;
    s.insert(a);
  }
  if(n==s.size()) cout << "YES";
  else cout << "NO";
  return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;


signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  int sum[N+1];
  rep(i, N) cin >> A[i];
  int ans = 0;
  sort(A.begin(), A.end());
  sum[0] = 0;
  for(int i=1;i<=N;i++) sum[i] = sum[i-1] + A[i-1];

  int left = 0, right = 2 * A[N-1] + 1, middle;

  while(right - left > 1){
    middle = (left+right)/2;
    int res = 0;
    for(int i=0;i<N;i++){
      int W = middle - A[i];
      auto itr_a = lower_bound(A.begin(), A.end(), W);
      int ab = A.end() - itr_a;
      res += ab;
    }
    if(res >= M) left = middle;
    else right = middle;
  }

  int count = 0;
  for(int i=0;i<N;i++){
    int W = left - A[i];
    auto itr_a = lower_bound(A.begin(), A.end(), W);
    int ab = A.end() - itr_a;
    if(ab == 0) continue;
    ans += A[i] * ab + sum[N] - sum[N-ab];
    count += ab;
  }
  ans -= left * (count - M);

  cout << ans << endl;
}

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

int main() {
  int k;
  string s;
  cin >> k >> s;
  
  if(s.size() <= k) {
    cout << s << endl;
  } else {
    for(int i = 0; i < k; i++) {
      cout << s[i];
    }
    cout << "..." << endl;
  }
  
  
}  


Measured memory_bytes: 3632
#include <stdio.h>
#define N 200000
 
int main(void){
    long n,i,x,j;
    long R[N],max=-1000000000,min;
 
    scanf("%ld", &n);
 
    for(i=0; i<n; i++) scanf("%ld", &R[i]);
 
    min=R[0];
 
    for(i=1; i<n; i++){
        x=R[i]-min;
        if(max<x) max = x;
        if(min>R[i]) min = R[i];
    }
 
    printf("%ld\n",max);
    return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string S;
    cin >> S;
    int n = 0;
    REP(i, S.length())
    {
        if (S[i] == 'o')
            n++;
    }
    cout << 700 + 100 * n << endl;
    return 0;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<ll,ll> pii;
const int MD = 1e9+7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

struct UF{
	vector<int> p;
	UF() {}
	UF(int n) : p(n, -1) {}
	int find(int a){ return p[a] < 0 ? a : p[a] = find(p[a]); }
	bool unite(int a, int b) {
		a = find(a); b = find(b);
		if(a == b) return false;
		if(-p[a] < -p[b]) swap(a, b);
		p[a] += p[b]; p[b] = a;
		return true;
	}
	bool root(int a){ return p[a] < 0; }
	bool same(int a, int b){ return find(a) == find(b); }
	int size(int a){ return -p[find(a)]; }
};

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m;

	cin >>n >>m;
	VI x(m), y(m),z(m); 
	rep(i, m) cin >>x[i] >>y[i] >>z[i];
	UF ufa(n);
	rep(i, m) ufa.unite(x[i]-1, y[i]-1);
	int ans = 0;
	rep(i, n) if(ufa.root(i)) ans++;
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 1792
/*  ex3_4
    potter0723sw  */

//方針：Nを１〜９で割ってみて商が１〜９かつ余りが０か調べる

#include <stdio.h>

int main(void) {
	int number,quotient,remainder,d;//dはdevide
	scanf("%d", &number);
	d = 1;
	while(d <= 9){//1~9まで調べる
		quotient = number / d;//商
		remainder = number % d;//余り
    	if(quotient >= 1 && quotient <= 9 && remainder == 0){//商が１〜９かつ余りが０
			printf("Yes\n");
			break;//Yesを出力してwhile脱出
		}
		d += 1;
	}
	if(d == 10){//１〜９まで試してダメだった場合d=10なのでその時にNoを出力
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 128
from bisect import bisect_left as bl
N, K = map(list, input().split())
D = list(map(int, input().split()))
D = [i for i in range(10) if not i in D]
res = []
big = 0
if int("".join([str(D[-1])] * len(N))) < int("".join(N)):
  if int(K[0]) < 9:
    if D[0] == 0:
      res = [D[1]] + [0] * len(N)
    else:
      res = [D[0]] * (len(N) + 1)
  else:
    res = [D[0]] * (len(N) + 1)
else:
  for i in range(len(N)):
    if big == 0:
      res.append(D[bl(D, int(N[i]))])
    else: res.append(D[0])
    if res[i] > int(N[i]): big = 1
print("".join(list(map(str, res))))

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

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

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// 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();
}

//
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;
}
//

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

  int h, w;
  while (cin >> w >> h, h || w) {
    bool board[40][40][4];
    rep(i, h) rep(j, w) rep(k, 4) board[i][j][k] = true;

    rep(i, h) board[i][0][3] = false;      // left
    rep(i, h) board[i][w - 1][1] = false;  // right
    rep(i, w) board[0][i][2] = false;      // up
    rep(i, w) board[h - 1][i][0] = false;  // down

    int in;
    rep(i, 2 * h - 1) {
      int l;
      if (i % 2 == 0)
        l = w - 1;
      else
        l = w;
      rep(j, l) {
        cin >> in;
        if (in == 1) {
          if (i % 2 == 0) {
            board[i / 2][j][1] = false;      //右に行けない
            board[i / 2][j + 1][3] = false;  //左に行けない
          } else {
            board[i / 2][j][0] = false;      //下に行けない
            board[i / 2 + 1][j][2] = false;  //上に行けない
          }
        }
      }
    }

    int dist[40][40];
    rep(i, h) rep(j, w) dist[i][j] = INF;
    dist[0][0] = 1;
    queue<P> q;
    q.push(P(0, 0));

    while (!q.empty()) {
      P t = q.front();
      q.pop();

      rep(i, 4) {
        if (!board[t.second][t.first][i]) continue;
        int x = t.first + dx[i];
        int y = t.second + dy[i];

        if (dist[y][x] <= dist[t.second][t.first] + 1) continue;
        dist[y][x] = dist[t.second][t.first] + 1;
        q.push(P(x, y));
      }
    }

    if (dist[h - 1][w - 1] == INF)
      cout << 0 << "\n";
    else
      cout << dist[h - 1][w - 1] << "\n";
  }

  return 0;
}


Measured memory_bytes: 3228
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      static long MOD = 998244353L;
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int M = Integer.parseInt(st.nextToken());
         int K = Integer.parseInt(st.nextToken());
         //solve
         long[] fac = new long[200001];
         fac[0] = 1L;
         for(int i=1; i <= 200000; i++)
            fac[i] = (fac[i-1]*i)%MOD;
         long res = power(M, N, MOD);
         for(int i=N-K-1; i > 0; i--)
         {
            long temp = power(M-1, i-1, MOD);
            temp = (temp*M)%MOD;
            //dont double count
            temp = (temp*fac[N-1])%MOD;
            temp = (temp*power(fac[N-i], MOD-2, MOD))%MOD;
            temp = (temp*power(fac[i-1], MOD-2, MOD))%MOD;
            res = (res-temp+MOD)%MOD;
         }
         System.out.println(res);
      }
      public static long power(long x, long y, long p) 
      { 
          long res = 1L;      
          x = x % p;  
          while (y > 0) 
          { 
              if((y & 1)==1) 
                  res = (res * x) % p; 
              y = y >> 1;  
              x = (x * x) % p;  
          } 
          return res; 
      } 
   }

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

int main(){
    int n, m;
    cin >> n >> m;
    int h[n]; rep(i,n) cin >> h[i];
    vector<int> G[n];
    rep(i,m){
        int a,b; cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    bool is_good[n]; rep(i,n) is_good[i] = true;
    rep(i,n) {
        for(int v : G[i]){
            if (h[v] >= h[i]) is_good[i] = false;
        }
    }
    int ans = 0;
    rep(i,n){
        if(is_good[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9192
//Created Time:2019年12月17日 星期二 18时41分06秒
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define N 200005
#define mod 1000000007

using namespace std;

int n, x, y, mn = 999999999, cnt;
int c[N], a[N], ifac[N], fac[N];

struct Ball{
	int col, w;
}b[N];

int read();
int quick_pow(int ,int);

int main(){
	n = read(), x = read(), y = read();
	memset(c, 127, sizeof c); fac[0] = ifac[0] = 1;
	int pos = 1, poss = 1;
	for(int i = 1; i <= n; ++i){
		int col = read(), w = read();
		c[col] = min(c[col], w); b[i] = (Ball){col, w};
		fac[i] = 1ll * fac[i - 1] * i % mod;
	}
	for(int i = 1; i <= n; ++i)
		if(c[i] < c[pos]) poss = pos, pos = i;
		else if(c[i] < c[poss]) poss = i;
	ifac[n] = quick_pow(fac[n], mod - 2);
	for(int i = n - 1; i; --i)
		ifac[i] = 1ll * ifac[i + 1] * (i + 1) % mod;
	for(int i = 1; i <= n; ++i){
		int col = b[i].col, w = b[i].w;
		if((pos != col && (w + c[pos] <= y || (w + c[col] <= x && c[col] + c[pos] <= y))) || (col == pos && (w + c[pos] <= x || (w + c[poss] <= y && c[poss] + c[pos] <= y))))
			++cnt, ++a[col];
	}
	int ans = fac[cnt];
//	cout << cnt << endl;
	for(int i = 1; i <= n; ++i)
		ans = 1ll * ans * ifac[a[i]] % mod;
	cout << ans << endl;
	return 0;
}

int read(){
	int x = 0; char ch = getchar();
	for(; !isdigit(ch); ch = getchar());
	for(; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
	return x;
}

int quick_pow(int x, int y){
	int sum = 1;
	for(; y; y >>= 1, x = 1ll * x * x % mod) if(y & 1) sum = 1ll * sum * x % mod;
	return sum;
}


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

Measured memory_bytes: 584
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
using namespace std;

int main()
{
	int x,maxNum = -1,tmp=0;
	cin >> x;
	for (int b = 2; b < x; b++) {
		for (int p = 2;; p++) {
			if (x == pow(b, p)) {tmp = pow(b, p); break; }
			else if (x < pow(b, p)) {tmp = pow(b, p - 1)*(p-1!=1); break;}
		}
		maxNum = max(tmp, maxNum);
	}
	cout << (x==1 ? 1 : maxNum) << endl;
}



Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
using namespace std;

typedef struct _data{
    int t;
    int x;
    int y;
}data;

int main(){
    int N;
    scanf("%d", &N);

    data *in;
    in = (data *)malloc(sizeof(data) * (N+1));

    int i, d;
    int flag;
    int res_t; 
    in[0].t = 0;
    in[0].x = 0;
    in[0].y = 0;
    flag = 0;
    for(i=1; i<N+1; i++){
        scanf("%d %d %d", &in[i].t, &in[i].x, &in[i].y);
        d = abs(in[i].x - in[i-1].x) + abs(in[i].y - in[i-1].y);
        res_t = in[i].t - in[i-1].t;
        if(d > res_t || res_t%2 != d%2){
            flag = 1;
        }
    }

    if(flag == 0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }


    return 0;
}


Measured memory_bytes: 1408
n = int(input())
h = [int(x) for x in input().split()]

cnt = 0
ans = 0

for i in range(n-1):
    if h[i] >= h[i+1] or i == n-1:
        cnt += 1
        if cnt > ans:
            ans = cnt
    else:
        cnt = 0
print(ans)

Measured memory_bytes: 14252
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}

const int INF = 1e9;

int mincost(int bit, int nown, int &n, int &m, int &x, vector<vector<int>> &a, vector<int> &c){
    if(nown == n){
        int cost = 0;
        vector<int> rikai(m, 0);
        REP(i, n){
            if((bit >> i) & 1){
                cost += c[i];
                REP(j, m){
                    rikai[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        REP(i, m)
            if(rikai[i] < x) ok = false;
        return (ok ? cost : INF);
    }
    else{
        int ans = INF;
        ans = min(ans, mincost(bit, nown+1, n, m, x, a, c));
        bit = (bit | (1 << nown));
        ans = min(ans, mincost(bit, nown+1, n, m, x, a, c));
        return ans;
    }
}

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<vector<int>> a(n, vector<int>(m));
    vector<int> c(n);
    REP(i, n){
        cin >> c[i];
        REP(j, m)
            cin >> a[i][j];
    }

    int ans = mincost(0, 0, n, m, x, a, c);

    cout << (ans == INF ? -1 : ans) << endl;
    return 0;
}

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

public class Main {

	public static class WeightedUnionFind{
	    int[] par; // 親の番号
	    int[] ws;  // 親との重みの差
	    
	    public WeightedUnionFind(int n){
	        par = new int[n];
	        ws  = new int[n];
	        for(int i = 0; i < n; i++){ 
	        	par[i] = -1;
	        	ws[i]  = 0;
	        }
	    }
	    
	    public int find(int x){
	    	if(par[x] < 0){
	    		return x;
	    	}else{
	    		final int parent = find(par[x]);
	    		ws[x] += ws[par[x]];
	    		par[x] = parent;
	    		return parent;
	    	}
	    }
	    
	    public int weight(int x){
	    	find(x);
	    	return ws[x];
	    }
	    
	    public boolean union(int x, int y, int w){ // x <-(w)- y (x + w = y)
	    	w += weight(x);
	    	w -= weight(y);
	        x = find(x);
	        y = find(y);
	        
	        if(x != y){
	            if(par[y] < par[x]) {  // 多い方が根になるようにスワップする.
	                int tmp = x; x = y; y = tmp;
	                w = -w;
	            }
	            par[x] += par[y];
	            par[y] = x;
	            ws[y] = w;
	            
	            return true;
	        }else{
	            return false;
	        }
	    }
	    
	    public boolean same(int x, int y){
	        return find(x) == find(y);
	    }
	    
	    public Integer diff(int x, int y){ // x - y を求める. 比較不能ならnull.
	    	if(!same(x, y)){
	    		return null;
	    	}else{
	    		return this.weight(x) - this.weight(y);
	    	}
	    }
	    
	    public int size(int x){
	        return -par[find(x)];
	    }
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while(true){
			final int n = sc.nextInt();
			final int m = sc.nextInt();
			
			if(n == 0 && m == 0){
				break;
			}
			
			WeightedUnionFind uf = new WeightedUnionFind(n);
			
			for(int i = 0; i < m; i++){
				final String ops = sc.next();
				
				if("?".equals(ops)){
					final int r = sc.nextInt() - 1;
					final int l = sc.nextInt() - 1;
					final Integer ret = uf.diff(r, l);
					System.out.println(ret == null ? "UNKNOWN" : -ret);
				}else{
					final int r = sc.nextInt() - 1;
					final int l = sc.nextInt() - 1;
					final int w = sc.nextInt();
					
					uf.union(r, l, w);
				}
			}
		}
		
		sc.close();
	}

}

Measured memory_bytes: 291740
N = int(input())
m = float("inf")
 
for A in range(1,N):
  summ = 0
  B = N-A
  
  while A >0:
    summ += A%10
    A //=10
  while B >0:
    summ += B%10
    B//=10
  if summ < m:
    m = summ

print(m)

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

int main() {
 int n,sum;
  cin >>n>>sum;
  int a=0;
  vector<int> vec(1000000);
  
  if(sum==1){
    cout <<1<<endl;}
  else{
   for(int i=1;i*i<=sum;i++){
    if(sum%i==0){
      vec.at(a)=i;
        vec.at(a+1)=sum/i;
      a+=2;}
   }
    
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
      
    for(int j=0;j<vec.size();j++){
      if(vec.at(j)<=sum/n){
        cout << vec.at(j)<<endl;
        break;}
    }
      
    
  }
    
  
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int saidai=max({a,b,c});
  int all=a+b+c-saidai;
  for(int i=0;i<k;i++){
    saidai*=2;
  }
  cout<<all+saidai<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}

fun solve() {
    val x = readInteger()
    val ans = (x / 500) * 1000 + ((x % 500) / 5) * 5
    out.println(ans)
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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

void solve()
{
    int n;
    cin>>n;

    vector<double> dp(n+1);
    dp[0]=1;

    for(int i=0;i<n;i++){
        double p;
        cin>>p;

        for(int j=i+1;j>=0;j--){
            dp[j]=dp[j]*(1-p)+(j==0?0:dp[j-1]*p);
        }
    }

    double ans=0;
    for(int i=0;i<=n;i++){
        int tails=n-i;
        if(i>tails)ans+=dp[i];
    }

    printf("%.10lf",ans);
}

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

    // while(n--)
    solve();

    return 0;
}

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

int main() {
  vector<int> price(3);
  for (int i = 0; i < 3; i++) {
    cin >> price.at(i);
  }
  sort(price.begin(), price.end());
  cout << price.at(0) + price.at(1) << endl;
}

Measured memory_bytes: 256
import sys
S = input()
s = S[::-1]
i = 0
n = len(s)-i
while n>0:
  if s[i:i+5] == "maerd" or s[i:i+5] == "esare" :
    i += 5
    n = len(s)-i
  elif s[i:i+6] == "resare":
    i += 6
    n = len(s)-i
  elif s[i:i+7] == "remaerd":
    i += 7
    n = len(s)-i
    pass
  else:
    print("NO")
    sys.exit()
    
print("YES")

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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int L, R, d;
    cin >> L >> R >> d;
    cout << R/d - (L-1)/d << "\n";
}

Measured memory_bytes: 3648
# include <iostream>
using namespace std;
int main(){
	int a,b;
  	cin >> a >> b;
  	int res;
  ((b-a)%(a-1)==0)? res  = (b-a)/(a-1) +1 : res  = (b-a)/(a-1) +2;
  if (b==1) cout << 0 <<'\n';
  else (b > a)? cout << res << '\n' : cout << 1 <<'\n';

	return 0;
}

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

int main(){
	ll n,y;
	cin >> n >> y;
	for (int i = 0; i <= 2000; ++i) {
		for (int j = 0; j <= 2000; ++j) {
			int k = n - i - j;
			if(10000*i + 5000*j + 1000*k == y && k >= 0){
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
}



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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int

typedef long long ll;
typedef pair<ll,ll> p;


int main()
{
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  for(int i = 0; i < tx - sx; i++)
    cout << "R";
  for(int i = 0; i < ty - sy; i++)
    cout << "U";
  for(int i = 0; i < tx - sx; i++)
    cout << "L";
  for(int i = 0; i < ty - sy; i++)
    cout << "D";
  cout << "LU";
  for(int i = 0; i < ty - sy; i++)
    cout << "U";
  cout << "R";
  for(int i = 0; i < tx - sx; i++)
    cout << "R";
  cout << "DRD";
  for(int i = 0; i < ty - sy; i++)
    cout << "D";
  cout << "L";
  for(int i = 0; i < tx - sx; i++)
    cout << "L";
  cout << "U" << endl;
  
  

}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
using namespace std;
int n, m, v, p; 

bool check(int *a, int i) {
    if (a[i] + m < a[n-p]) return false;
    else if (v <= i+p) return true;
    long long amt = (long long)m * (v - (i + p));
    for (int j = i+1; j <= n-p; j++) {
        if (a[i] + m < a[j]) return false;
        amt -= a[i] + m - a[j];
        if (amt <= 0) return true;
    }
    return false;
}

int main() {
    cin >> n >> m >> v >> p;
    int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    int lb = -1, ub = n-p;
    while (ub - lb > 1) {
        int i = (ub + lb) / 2;
        if (check(a, i)) ub = i;
        else lb = i;
    }
    cout << n-ub << endl;
}


Measured memory_bytes: 640
import itertools
import math
n=int(input())
empty_list=[]
a=[i for i in range(n)]
permutations_list=[list(b) for b in itertools.permutations(a)]
coordinate_list=[list(map(int,input().split())) for _ in range(n)]
for i in range(math.factorial(n)):
  for j in range(n-1):
    empty_list.append(math.sqrt((coordinate_list[(permutations_list[i][j]-1)][0]-coordinate_list[(permutations_list[i][j+1]-1)][0])**2+(coordinate_list[(permutations_list[i][j]-1)][1]-coordinate_list[(permutations_list[i][j+1]-1)][1])**2))
b=int(math.factorial(n))
c=sum(empty_list)
print(c*(n-1)/((n-1)*b))

Measured memory_bytes: 19376
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (s.charAt(0) == s.charAt(2)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define REPZ(i, z, n) for(decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for(decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(all(v)))
#define MIN(v) (*min_element(all(v)))
#define INF 1000000000000 //1E+12
#define MOD 1000000007    //合同式の法

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<

typedef long long ll;
typedef unsigned long long ul;
// 1s間で可能なループ回数2E+8回
// intの最大値2147483647~2E+9
// long longの最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<> push_back
// 連想配列map<key,value> insert,
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 setprecision()
// to_string<->stoi
// stoll(longlong)
// stod(double)
// 大文字65-90(-32)
// 小文字97-122(+32)
using namespace std;
int main(){
  // faster
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n,p; cin >> n >> p;
  vector<ll> s(n);
  vector<ll> mod(p,0);
  ll time2,time5=0;

  rep(i,n){
    char temp;
    cin >> temp;
    s[i] = temp-'0';
  }

  reverse(ALL(s));

  if(p==2 or p==5){
    ll res25=0;
    rep(i,n){
      if(s[i]%p==0) res25+=n-i;
    }
    cout << res25 << endl;
    return 0;
  }

  ll digit=1;
  ll sum=0;
  rep(i,n){
    sum+=s[i]*digit; 
    sum%=p;
    mod[sum]++;
    digit*=10;
    digit%=p;
  }
  ll res=mod[0];
  for(ll i:mod) res+=i*(i-1L)/2L;
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define m 1000000007 
#define endl "\n"    
#define int long long

int modpow(int x, int n) 
{ 
    if (n == 0) 
    return 1%m; 
    long long u = modpow(x,n/2); 
    u = (u*u)%m; 
    if (n%2 == 1) 
    u = (u*x)%m; 
    return u; 
}


int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin>>t;
  string s;
  cin>>s;
  if(t<3200)
  {
      cout<<"red";
  }
  else
  {
      cout<<s;
  }

  

}


Measured memory_bytes: 256
import sys
from fractions import gcd

N = int(input())

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


if len(A) < 3:
    print(max(A))
    sys.exit()


left_side = [0 for _ in range(N)]
left_side[0] = A[0]

right_side = [0 for _ in range(N)]
right_side[-1] = A[-1]



for i in range(N -1):
    left_side[i + 1] = gcd(left_side[i], A[i + 1])

for i in range(1, N):
    right_side[-1* (i + 1)] = gcd(right_side[-1* i], A[ -1 *(i + 1)])


max_gcd = 1 

# left 
max_gcd = max(max_gcd, right_side[1])
# right
max_gcd = max(max_gcd, left_side[-2])

for i in range(1, N -1 ):
    left = left_side[i - 1]
    right = right_side[i + 1]
    max_gcd = max(max_gcd, gcd(left, right))




print(max_gcd)






Measured memory_bytes: 90208
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;
  
int main() {
    string w;
    cin >> w;
    vector<int> A(26, 0);
    for (int i = 0; i < w.size(); i++){
        A.at(w.at(i) - 'a')++;
    }
    for (int i = 0; i < 26; i++){
        if (A.at(i) % 2 == 1) {
            cout << "No" << endl;
            return 0;
        } 
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,ans=0;
    cin>>n;
    vector<int>G(n);
    for(int i=0;i<n;i++)
		cin>>G[i];
    sort(G.begin(),G.end());
    for(int i=0;i<n;i++)
		for(int j=0;j<i;j++)
		{
	        int t=G[j]+G[i];
	        int right=lower_bound(G.begin(),G.end(),t)-G.begin();
	        int left=i+1;
	        ans+=max(0,right-left);
	    }
    cout<<ans;
    return 0;
}

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

#define whole(f, x, ...)                                 \
  ([&](decltype((x)) whole) {                            \
    return (f)(begin(whole), end(whole), ##__VA_ARGS__); \
  })(x)

using namespace std;
using ll = long long;

void solve() {
  string s;
  cin >> s;
  deque<string> a;
  a.push_back(s);
  int q;
  cin >> q;
  bool rev = false;
  for (int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      rev = !rev;
    } else {
      int f;
      string c;
      cin >> f >> c;
      if (rev) {
        if (f == 1) {
          a.push_back(c);
        } else {
          a.push_front(c);
        }
      } else {
        if (f == 1) {
          a.push_front(c);
        } else {
          a.push_back(c);
        }
      }
    }
  }
  if (rev) {
    reverse(a.begin(), a.end());
    for (string &st : a) {
      reverse(st.begin(), st.end());
      cout << st;
    }
  } else {
    for (string &st : a) {
      cout << st;
    }
  }
  cout << endl;
}

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

  solve();
  return 0;
}


Measured memory_bytes: 11728
import java.util.Scanner;

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

    private static void solve(Scanner in) {
        int n = in.nextInt();
        System.out.println(n * n * n);
    }
}

Measured memory_bytes: 26376
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define pii pair<int,int>
using namespace std;
int n,m;
vector<int> g[100005];
int len[100005];
int ru[100005];
int main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int a,b;
		cin>>a>>b;
		--a,--b;
		g[a].push_back(b);
		ru[b]++;
	}
	stack<int> s;
	REP(i,n) if(ru[i]==0) s.push(i);
	while(s.size()){
		int p=s.top();
		s.pop();
		for(int i=0;i<g[p].size();i++){
			int to=g[p][i];
			if(len[p]+1>len[to]){
				len[to]=len[p]+1;
			}
			ru[to]--;
			if(ru[to]==0) s.push(to);
		}
	}
	int res=1;
	for(int i=0;i<n;i++){
		res=max(res,len[i]);
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 6528