akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>
#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    string str;
    cin >> str;
    rep(i,str.length()){
        if(i%2==0) cout << str[i];
    }
    cout << endl;
    return 0;
}

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

using namespace std;

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

    vector <int> c(n);

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

    auto lb = total/n;
    auto ub = lb + 1;
    sort(c.begin(), c.end());

    int curr1 = 0, curr2 = 0;
    for (auto jk : c)
    {
        curr1 += (jk - lb)*(jk - lb);
        curr2 += (jk - ub)*(jk - ub);
    }

    if (curr1 < curr2) cout << curr1;
    else cout << curr2;

    return 0;
}



Measured memory_bytes: 3624
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long n = scanner.nextLong();
        long k = scanner.nextLong();
        System.out.println(Math.min(Math.abs(n-n/k*k), Math.abs(n-(n/k+1)*k)));
        return;
    }
}

Measured memory_bytes: 20820
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
struct UnionFind {
  vi d;
  UnionFind(int n): d(n,-1) {}
  int root(int x) {
    if (d[x] < 0) return x;
    return d[x] = root(d[x]);
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y){
    return root(x) == root(y);
  }
  int size(int x){
    return -d[root(x)];
  }
};
int main(){
  int n,m;
  cin >> n >> m;
  UnionFind tree(n);
  rep(i, m){
    int a,b;
    cin >> a >> b;
    a--; b--;
    tree.unite(a, b);
  }
  int ans = 0;
  rep(i, n) ans = max(ans, tree.size(i));
  cout << ans << endl;
}

Measured memory_bytes: 3992
#include<iostream>

using namespace std;

int main(void){

int n,fib[45];
fib[0]=fib[1]=1;

for(int i=2;i<45;i++)fib[i]=fib[i-1]+fib[i-2];

while(cin >> n)cout << fib[n]<<endl;

return 0;
}

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

using namespace std;

#define ll long long 
#define Fastest ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"

ll arr[100005], dp[100005],n;

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


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n ,fives=0;
    cin >> n ;
    if(n&1)
    {
        cout << 0;
        return 0;
    }
    for(ll i =10  ; i<=n ;i*=5 )
    {
        fives+=(n/i);
    }
    cout << fives ;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define F first
#define S second 
#define mp make_pair
#define pb push_back
#define pf push_front
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define debug cerr << "OK\n";
#define ub upper_bound
#define lb lower_bound
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef set <int> si;
typedef set <ll> sll;
typedef multiset <int> msi;
typedef multiset <ll> msll;
typedef map <int, int> mi;
typedef map <ll, int> mll;
 
const int N = 1e5 + 2;
const int M = 1e5 + 2;
const int mod = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e16;
 
void data() {
    #ifdef PC
        freopen("main.in", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
}
 
void scerr(vi nums) {
	for (auto it : nums)
		cerr << it << " | ";
	cerr << "\n";
}
 
int n;
ll w, dp[N], arr[N], brr[N];
 
int main() {
	data();
	for (int i = 0; i < N; ++i)
		dp[i] = INF;
	dp[0] = 0;
	scanf("%d %lld", &n, &w);
	for (int i = 1; i <= n; ++i)
		scanf("%lld %d", &arr[i], &brr[i]);
	for (int i = 1; i <= n; ++i)
		for (int j = N - 1; j >= brr[i]; --j)
			dp[j] = min(dp[j], dp[j - brr[i]] + arr[i]);
	for (int i = N - 1; i >= 0; --i)
		if (dp[i] <= w) {
			printf("%d", i);
			return 0;
		}
	return 0;
}
 
/*
	Timus: 288481RF
	CodeForces: __fractal
*/


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
	int N;
	int a[100000];
	
	int x=0;
	int ans=0;
	int i,j,k;
	
	cin>>N;
	for(i=0;i<N;i++){
		cin>>a[i];
	}
	for(i=0;i<N-1;i++){
		if(a[i]==i+1){
			x=a[i];
			a[i]=a[i+1];
			a[i+1]=x;
			ans=ans+1;
		}
	}
	if(a[N-1]==N){ ans++;}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#define MIN(a,b) (a)<(b)?(a):(b)
std::string s;
signed main()
{
	std::cin>>s;int l(s.length()),t1(0),t2(0),ans(0);
	for(register int i(0);i<l;i++)
	{
		s[i]==83?t1++:t2+=(t1>0),
		t1>=t2?ans+=MIN(t1,t2)<<1,t1-=MIN(t1,t2),t2=0:8;
	}
	return std::cout<<l-ans<<std::endl,0;
}

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

#define pb push_back
const int len = 1e5+5;
int dep[len];
vector<int> adj[len];

bool comp(int a, int b){
    return (dep[a] > dep[b]);
}

int solve(int u){
    dep[u] = 0;

    for (int j = 0; j < adj[u].size(); j++)
        solve(adj[u][j]);
    sort(adj[u].begin(), adj[u].end(), comp);

    for (int j = 0; j < adj[u].size(); j++)
        dep[u] = max(dep[u], j + dep[adj[u][j]] + 1);
}

int main(){
    int n;
    scanf("%d", &n);
    for (int i = 2; i <= n; i++){
        int temp;
        scanf("%d", &temp);
        adj[temp].pb(i);
    }

    solve(1);
    printf("%d\n", dep[1]);
    return 0;
}


Measured memory_bytes: 10752
#include "bits/stdc++.h"
#include <chrono>
#include <tuple>
#include <string>
#include <random>
#include <cstdio>
#define ll long long int
// #define endl '\n'
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
const int N = 100001;
vector<int> adj[N];
ll mod = 1000000007;

void solve() 
{
    string s;
    cin>>s;

    if(s[s.size() - 1] != 's') 
    {
        s.pb('s');
        cout<<s<<endl;
        return;
    }

    s.pb('e'), s.pb('s');
    cout<<s<<endl;
    return;
}

int main()
{
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }

    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 6144
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int k;

signed main() {
	cin >> k;
	
	int i;
	int hoge = 0;
	for (i = 1; i < 20000000; i++) {
		hoge *= 10;
		hoge += 7;
		hoge %= k;
		if (hoge == 0) break;
	}
	if (i < 20000000) cout << i << endl;
	else cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e,n,ans = 0;
  string s,ss,sss;
  cin>>s;
  for(auto a:s)cout<<'x';
  cout<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};

int N, M, X, Y;
vector<int> x, y;

bool check(int Z)
{
    for(int i = 0; i < N; i++)
        if(x[i] >= Z) return false;
    for(int i = 0; i < M; i++)
        if(y[i] < Z) return false;
    return true;
}

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    cin >> N >> M >> X >> Y;
    for(int i = 0; i < N; i++)
    {
        int t; cin >> t; x.push_back(t);
    }
    for(int i = 0; i < M; i++)
    {
        int t; cin >> t; y.push_back(t);
    }
    
    for(int z = X + 1; z <= Y; z++)
        if(check(z))
        {
            cout << "No War"; return 0;
        }
    

    cout << "War";
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String S = scan.next();
    String T = scan.next();
    String[] split = S.split("");
    String[] splits = T.split("");
    int N = S.length();
    for(int i = 0; i < N; i++)
    if (!(split[i].equals(splits[i]))) {
      System.out.println("No");
      return;
    }
    System.out.println("Yes");
  }
}

Measured memory_bytes: 35648
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    ll x,y,a,b,c; cin >> x >> y >> a >> b >> c;
    vector<ll> A(a),B(b),C(c);
    for(int i=0;i<a;i++) cin >> A[i];
    for(int i=0;i<b;i++) cin >> B[i];
    for(int i=0;i<c;i++) cin >> C[i];
    sort(A.rbegin(),A.rend());
    sort(B.rbegin(),B.rend());

    for(int i=0;i<x;i++) C.push_back(A[i]);
    for(int i=0;i<y;i++) C.push_back(B[i]);
    sort(C.rbegin(),C.rend());

    ll ans = 0;
    for(int i=0;i<x+y;i++){
        ans += C[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6512
#include<stdio.h>
#include<math.h>
int main(){
    double a,b,C,h,D,rad,PI=3.14159265359;
    scanf("%lf %lf %lf",&a,&b,&C);
    C *= PI/180.0;
    h=b*sin(C);
    printf("%lf\n%lf\n%lf\n",h*a*0.5,a+b+sqrt(a*a+b*b-2*a*b*cos(C)),h);
    return 0;
}


Measured memory_bytes: 2088
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		String mass = sc.nextLine();

		int count = 0;

		for (int i = 0; i < mass.length(); i++) {
			if (mass.charAt(i) == '1') {
				count++;
			}
		}

		System.out.println(count);

	}

}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>

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

int main(){

    vector<ll> num(MAX_A,0);
    ll n,k,a,b;
    cin >> n >> k;
    //cout << n << k << endl;
    REP(n){
        cin >> a >> b;
        //cout << a << b << endl;
        num[a] += b;
        //cout << num[a] << endl;
    }
    /*REP(n+1){
        cout << num[i];
    }
    cout << endl;*/

    for(ll i = 1;i < MAX_A;i++){
        //cout << num[i];
        //cout << k << endl;
        if(k <= num[i]){
            cout << i << endl;
            return 0;
        }
        k-=num[i];
       
    }

    
     
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

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

    public static void solve(Scanner sc) {
        long n = sc.nextLong();
        long k = sc.nextLong();
        System.out.println((int)(k * Math.pow(k - 1, n - 1)));
    }
}

Measured memory_bytes: 21332
N, L = [int(x) for x in input().split()]
if L >= 0:
    print(L * N + sum(list(range(N))) - L)
elif L < 0 and N <= abs(L):
    print(sum(list(range(L, L + N -1))))
elif L < 0 and N > abs(L):
    print( L * N + sum(list(range(N))) )

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((int)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;

void print(Vl v){
    rep(i, 0, sz(v)){
        if(i) cout << " ";
        cout << v[i];
    }
    cout << endl;
}

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


int main() {
	string s, t;
	cin >> s >> t;
	bool f = true;
	rep(i, 0, s.size()){
		if(s[i] != t[i]) f = false;
	}
	if(f) co("Yes");
	else co("No");

    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <array>

using namespace std;

char grade(array <int, 3> grades) {
	if (grades[0] == -1 || grades[1] == -1) {
		return 'F';
	}
	int sum = grades[0] + grades[1];
	if (80 <= sum) {
		return 'A';
	}
	if ((65 <= sum) && (sum < 80)) {
		return 'B';
	}
	if ((50 <= sum) && (sum < 65)) {
		return 'C';
	}
	if ((30 <= sum) && (sum < 50)) {
		if ((grades[2] != -1) && (grades[2] >= 50)){
			return 'C';
		}
		return 'D';
	}
	if (sum < 30) {
		return 'F';
	}
}
int main() {
	vector <array <int, 3>> grades;
	array <int, 3> pusher;
	int mid = 0;
	int fin = 0;
	int re = 0;
	int size = 0;

	while (true) {
		cin >> mid >> fin >> re;
		if ((mid == -1) && (fin == -1) && (re == -1)) {
			break;
		}
		pusher[0] = mid;
		pusher[1] = fin;
		pusher[2] = re;
		grades.push_back(pusher);
	}
	size = grades.size();
	for (int i = 0; i < size; i++) {
		cout << grade(grades[i]) << endl;
	}
}



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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define int long long
#define all(v) v.begin() , v.end()
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{   fastio;

    string a , b;
    cin>>a>>b;
    map<char , set<char>>mp;
    map<char , set<char>>ap;
    for(int i=0; b[i]; i++)
    {
        mp[b[i]].insert(a[i]);
    }
    for(int i=0; b[i]; i++)
    {
        ap[a[i]].insert(b[i]);
    }
    int fl=0;
    for(char i='a'; i <= 'z'; i++)
    {
        if(mp[i].size() <= 1 && ap[i].size() <= 1) continue;
        else fl=1;
    }
    if(fl)cout<<"No\n";
    else cout<<"Yes\n";

}

Measured memory_bytes: 3744
# -*- coding:utf-8 -*-
import sys

N = int(input())
Sn = sorted([int(input()) for i in range(N)])
total = sum(Sn)
if total % 10 != 0:
    print(total)
    sys.exit()
else:
    i = 0
    while True:
        if (total - Sn[i]) % 10 != 0:
            print(total - Sn[i])
            sys.exit()
        i += 1
        if i == N:
            break
print(0)


Measured memory_bytes: 3060
#include <cmath>
#include <iostream>
#include <utility>
#include <vector>

using dbl = long double;
static constexpr dbl eps = 1e-9;
struct Point {
  dbl x;
  dbl y;
  dbl length2() const { return x * x + y * y; }
  dbl length() const { return sqrt(length2()); }

  Point normalize() const {
    auto d = length();
    if (d < eps) {
      return {0, 0};
    }
    return {x / d, y / d};
  }

  Point rotate(Point other) const {
    return {x * other.x - y * other.y, x * other.y + y * other.x};
  }
  Point sub(Point other) const { return {x - other.x, y - other.y}; }
  Point add(Point other) const { return {x + other.x, y + other.y}; }
};

struct Circle {
  Point c;
  dbl r;
  dbl r2() const { return r * r; }
  bool in(Point x) const { return x.sub(c).length2() < r2() + eps; }
};

void guess(const Circle &first, const Circle &second,
           std::vector<Point> &dest) {
  auto dir = second.c.sub(first.c);
  auto d = dir.length();
  if (d < eps) {
    return;
  }
  dbl x = (first.r2() + d * d - second.r2()) / (2 * d);
  dbl y2 = first.r2() - x * x;
  if (y2 < -eps) {
    return;
  }
  if (y2 < eps) {
    y2 = 0;
  }
  dbl y = sqrt(y2);
  auto rot = dir.normalize();
  dest.push_back(Point{x, y}.rotate(rot).add(first.c));
  dest.push_back(Point{x, -y}.rotate(rot).add(first.c));
}

struct Task {
  bool run() {
    int n, k;
    if (scanf("%d%d", &n, &k) != 2) {
      return false;
    }
    std::vector<Circle> meats(n);
    for (auto &meat : meats) {
      std::cin >> meat.c.x >> meat.c.y >> meat.r;
    }

    dbl l = 0, r = 10000000;
    for (int t = 0; t < 200; t++) {
      dbl R = (l + r) / 2;
      std::vector<Circle> circles = meats;
      std::vector<Point> points;
      for (auto &circle : circles) {
        circle.r = R / circle.r;
        points.push_back(circle.c);
      }
      for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
          guess(circles[i], circles[j], points);
        }
      }
      bool ok = false;
      for (auto point : points) {
        int cnt = 0;
        for (auto &circle : circles) {
          cnt += circle.in(point);
        }
        // printf("%lf %lf: %d\n", point.x, point.y, cnt);
        if (cnt >= k) {
          ok = true;
          break;
        }
      }
      if (ok) {
        r = R;
      } else {
        l = R;
      }
      // break;
    }
    printf("%.10lf\n", (double)r);

    return true;
  }
};

int main(void) {
  // std::vector<Point> p;
  // guess(Circle{{-1, 0}, 0.8}, Circle{{1, 0}, 1.2}, p);
  //// guess(Circle{{1, 1}, 1}, Circle{{2, 2}, 1}, p);
  // for (auto x : p) {
  // printf("%lf %lf\n", x.x, x.y);
  //}
  // return 0;
  while (true) {
    Task task;
    if (!task.run()) {
      break;
    }
  }
}



Measured memory_bytes: 436
import Data.List
import Data.Array.IArray
import Control.Monad

main :: IO ()
main = do
    n <- readLn :: IO Int
    x <- map read . words <$> getLine :: IO [Int]
    let x' = listArray (0,n-1) $ sort x :: Array Int Int
        m1 = n `div` 2 - 1
        m2 = m1 + 1
    forM_ x $ \i -> print $ if i >= x'!m2 then x'!m1 else x'!m2

Measured memory_bytes: 107004
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
//#define N 110
//#define M 61
//#define MOD 100003
//vector <pair<int,int> > edge[M];
//int d[N][N];
//priority_queue <pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > >q;
//queue <int> q;
//ll cnte[N];
//int ans=0;
//vector <int> edge[N];
//int arr[N];
void solve()
{
	ll a,v,b,w,t;
	cin>>a>>v>>b>>w>>t;
	if ((v-w)*t>=abs((b-a)))
		cout<<"YES";
	else
		cout<<"NO";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
//	int t;
//	cin>>t;
//	while (t--)
		solve();
	return 0;
} 

Measured memory_bytes: 3636
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int s1 = int.Parse(s);
            int m1 = s1 / 100;
            int m2 = s1 % 100;
            if(((0<=m1 && m1<=99)&&(1<=m2&&m2<=12))&& ((0 <= m2 && m2 <= 99) && (1 <= m1 && m1 <= 12)))
            {
                Console.WriteLine("AMBIGUOUS");
            }else if((0 <= m1 && m1 <= 99) && (1 <= m2 && m2 <= 12)){
                Console.WriteLine("YYMM");
            }else if((0 <= m2 && m2 <= 99) && (1 <= m1 && m1 <= 12)){
                Console.WriteLine("MMYY");
            }
            else
            {
                Console.WriteLine("NA");
            }
        }
    }
}


Measured memory_bytes: 27516
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define ld long double
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout<< #x << '=' << x <<endl
#define MOD 1000000007

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

    string s , t;
    cin>>s>>t;
    int m = sz(t);
    int n = sz(s);
    int ans = INT_MAX;
    for(int i = 0; i < n - m + 1; i++){
        int c = 0;
        for(int j = i; j < i + m; j++){
            if(s[j] == t[j - i]){
                continue;
            }
            c++;
        }
        ans = min(ans , c);
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 3656
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <limits>//setprecision
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set,multiset
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#include <numeric> //accumulate,,,
#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
long long MOD = 1000000007;
typedef pair<long long,long long> P;

void chmax(long long &a,long long b){if(a < b) a = b;}
void chmin(long long &a,long long b){if(a > b) a = b;}

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //When end-of-a bit is 1, times simple N.
    if (M & 1) res = (res * N) % MOD;
    return res %= MOD;
}
long long gcd(long long a, long long b) {
    if (b == 0) return a; else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int N;cin >> N;
    long long maxiX = -INF,maxiY = -INF;
    long long miniX = INF,miniY = INF;
    for(int i = 0;i<N;i++){
        long long x,y;cin >> x >> y;
        miniX = min(miniX,x+y);
        maxiX = max(maxiX,x+y);
        miniY = min(miniY,x-y);
        maxiY = max(maxiY,x-y);
    }
    cout << max(maxiX-miniX,maxiY-miniY) << endl;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) ((int)(c).size())
#define all(c) (c).begin(),(c).end()
#define m0(a) memset(a,0,sizeof(a))
#define unq(v) v.erase(unique(v.begin(),v.end()),v.end());
#define mp make_pair
#define write(x) cout<<(x)<<endl
#ifdef LOCAL
#define debug(...) debug_vars(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
const int INF = 1 << 28;
const double EPS = 1e-8;
const int MOD = 1e9 + 7;
const int MAX = 1e5 + 10;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

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

int H, W;
bool c[55][55];
int d[55][55];

void bfs(int sy, int sx) {
    d[sy][sx] = 0;
    std::queue<pair<int, int>> que;
    que.push(mp(sy, sx));
    while (!que.empty()) {
        auto fr = que.front();
        que.pop();
        if (fr.first == H && fr.second == W) continue;

        rep(i, 4) {
            int ny = fr.first + dy[i];
            int nx = fr.second + dx[i];
            if (!c[ny][nx]) continue;
            if (d[fr.first][fr.second] + 1 < d[ny][nx]) {
                d[ny][nx] = d[fr.first][fr.second] + 1;
                que.push(mp(ny, nx));
            }
        }
    }
}

int main()
{
    cin >> H >> W;
    int white = 0;
    rep(i, 1, H + 1) {
        rep(j, 1, W + 1) {
            char ch;
            cin >> ch;
            if (ch == '.') {
                c[i][j] = true;
                white++;
            }
            d[i][j] = INF;
        }
    }
    bfs(1, 1);
    if (d[H][W] > H * W) {
        write(-1);
    }
    else {
        write(white - d[H][W] - 1);
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Rushia_mywife ios::sync_with_stdio(0);cin.tie(0);
#define rep(i,head,n) for(int i=(head);i<n;i++)
#define int long long
#define F first
#define S second
#define pb push_back
#define p2(n) (1<<(n))
#define lg2(n) __lg(n)
using namespace std;
using ll = long long;
using pii = pair<long long,long long>;
using ld = long double;
mt19937 mt_rand(time(0));
const int mod = 1000000007;
const int hnum = 998244353;
const ld PI = acos(-1);
const int N = 2e5+10;

int n;
int a[N];
int s[N];

void solve(){
    cin >> n;
    rep(i,1,n+1)
        cin >> a[i];
    for(int i=n;i>0;i--)
        s[i] = (s[i+1]+a[i])%mod;
    int ans = 0;
    rep(i,1,n)
        ans = (ans+a[i]*s[i+1]%mod)%mod;
    cout << ans << '\n';
}

signed main(){
    Rushia_mywife
    //int t; cin >> t;
    //while(t--)
    solve();
}

Measured memory_bytes: 6728
#include <iostream>
using namespace std ;
int main ()
{
	int i=0 , a=0 ;
	while (true)
	{
		i++ ;
		cin >> a ;
		if (! a==0)
		{
			cout << "Case" << " " << i <<":" << " " << a << endl ;
		}
		else
		{
			break ;
		}
	}
}



Measured memory_bytes: 3080
//In the name of God
#include<bits/stdc++.h>
using namespace std;
int main()
{long long int n;
 cin>>n;
 unordered_map<long long int,long long int>mp;
 for(long long int i=0;i<(n-1);i++)
 {long long int k;
  cin>>k;
  mp[k]++;}
 for(int i=1;i<=n;i++)
   cout<<mp[i]<<"\n";
}

Measured memory_bytes: 11432
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);

#define dbg1(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
	os << "{";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << *it;
	}
	return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin()) os << ", ";
		os << *it;
	}
	return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
	os << "[";
	for (auto it = v.begin(); it != v.end(); ++it) {
		if ( it != v.begin() ) os << ", ";
		os << it -> first << " = " << it -> second ;
	}
	return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () { cerr << endl; }

template <typename T>
void faltu( T a[], int n ) {
	for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
	cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) { cerr << arg << ' '; faltu(rest...); }
// Program showing a policy-based data structure.
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less 
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
// GNU link : https://goo.gl/WVDL6g
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

/**___________________________________________________**/



int main()
{
	FASTIO
	/*
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
//*/
	bool flag = false;
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a == 2) {
		if (b == 28) flag = true;
	}
	else if (a < 8) {
		if (a & 1 && b == 31)flag = true;
		if (a % 2 == 0 && b == 30) flag = true;
	}
	else {
		if (a & 1 && b == 30)flag = true;
		if (a % 2 == 0 && b == 31) flag = true;
	}
	cout << flag << endl;
}

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

template <typename T> inline void read(T& x)
{
    int f = 0, c = getchar(); x = 0;
    while (!isdigit(c)) f |= (c == '-'), c = getchar();
    while (isdigit(c)) x = x * 10 + c - 48, c = getchar();
    if (f) x = -x;
}
template <typename T, typename... Args>
inline void read(T& x, Args&... args)
{
    read(x); read(args...);
}
template <typename T> void write(T x)
{
    if (x < 0) x = -x, putchar('-');
    if (x > 9) write(x / 10);
    putchar(x % 10 + 48);
}
template <typename T> void writeln(T x) { write(x); puts(""); }
template <typename T> inline bool cmin(T& x, const T& y)
{ return y < x ? (x = y, true) : false; }
template <typename T> inline bool cmax(T& x, const T& y)
{ return x < y ? (x = y, true) : false; }

#define LL long long
#define rep(i, a, b) for (int i = a; i <= b; ++ i)
#define dwn(i, a, b) for (int i = a; i >= b; -- i)
#define ptc putchar
#define pii pair<int, int>
#define fi first
#define se second

using namespace std;

const int N = 2e5 + 5;
const double eps = 1e-20;
const int INF = 0x7fffffff;
const LL mod = 1e9 + 7;
const double PI = acos(-1.0);

double a, b, x;

double args(double ar)
{
    return ar * 180 / PI;
}

void main_solve()
{
    scanf("%lf %lf %lf", &a, &b, &x);
    double base = a * a * b;
    if (base <= x * 2)
    {
        printf("%.10f\n", args(atan(2.0 * (base - x) / (a * a * a))));
    }
    else
    {
        printf("%.10f\n", args(PI / 2 - atan(2 * x / (a * b * b))));
    }
    return ;
}

signed main()
{
    int T = 1;
    while (T --)
    {
        main_solve();
    }
    return 0;
}


Measured memory_bytes: 256
import sys
import math
from collections import Counter

n = int(sys.stdin.readline())
a = sys.stdin.readline().split()
c = Counter(a)

total_comb_num = sum(map(lambda v: max(v*(v-1)//2, 0), c.values()))
for num in a:
    x = c[num]
    print(total_comb_num + max((x-1)*(x-2)//2, 0) - max((x*(x-1)//2, 0)))


Measured memory_bytes: 80204
s=int(input())
l=[s]
count=0
i=0
while l[-1] not in l[:-2]:
  if l[i]%2==0:
    l.append(l[i]//2)
  else:
    l.append(3*l[i]+1)
  count+=1
  i+=1
print(count+1)



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

using namespace std;





int main() {
 string a;
  cin>>a;
 int b=a.size(); 
  int y=0;
  int z=0;
  for(int i=0;i<b;i++)
  {
  if(a.at(i)=='A')  y=y+1;
    else if(a.at(i)=='G')  y=y+1;
    else if(a.at(i)=='C' ) y=y+1;
    else if( a.at(i)=='T') y=y+1;
    else y=0;
    z=max(y,z);
  }
  cout<<z;
}


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

using namespace std;

#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}


int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    if(n>=400 && n<=599) cout << 8;
    else if(n>=600 && n<=799) cout << 7;
    else if(n>=800 && n<=999) cout << 6;
    else if(n>=1000 && n<=1199) cout << 5;
    else if(n>=1200 && n<=1399) cout << 4;
    else if(n>=1400 && n<=1599) cout << 3;
    else if(n>=1600 && n<=1799) cout << 2;
    else if(n>=1800 && n<=1999) cout << 1;
    return 0;
}

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

int main()
{
    int n,p;
    cin>>n;
    int ans = 0;
    int m = 10000000;
    for (size_t i = 0; i < n; i++)
    {
        cin>>p;
        m=min(m,p);
        if(p==m){
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

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

int n;
string a;
int main() {
	cin >> a;
	n = a.size() - 3;
	if (a[0] != a[a.size() - 1]) n++;
	if (n % 2 == 0) cout << "Second";
	else cout << "First";
	return 0;
}


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

using namespace std;

main(){
	while(true){
	int a,b;
	cin >> a >> b;
	if(a==0&&b==0){
		break;
	}
	else if(a<=b){
		printf("%d %d\n",a,b);
	}
	else if(a>=b){
		printf("%d %d\n",b,a);
	}
}
}


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

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

using namespace std;

template<class T> T gcd(const T& a,const T& b){ return b==0?a:gcd(b,a%b); }

int main(){
	int n,k; scanf("%d%d",&n,&k);
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]);

	int g=a[0];
	rep(i,n-1) g=gcd(g,a[i+1]);

	puts(k%g==0&&k<=*max_element(a.begin(),a.end())?"POSSIBLE":"IMPOSSIBLE");

	return 0;
}


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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

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

char alpha[26] = {'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 dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(){
    int h, w, n; cin >> h >> w >> n;
    int x, y; cin >> x >> y;
    string s, t; cin >> s >> t;
    int f = 0;
    int ny = y;
    REP(i, 0, n){
        if(s[i] == 'L'){
            ny--;
        }
        if(ny <= 0){
            f = 1;
        }
        if(t[i] == 'R'){
            ny = min(ny+1, w);
        }
        if(ny <= 0){
            f = 1;
        }
    }
    ny = y;
    REP(i, 0, n){
        if(s[i] == 'R'){
            ny++;
        }
        if(ny > w){
            f = 1;
        }
        if(t[i] == 'L'){
            ny = max(ny-1, 1);
        }
        if(ny > w){
            f = 1;
        }
    }
    int nx = x;
    REP(i, 0, n){
        if(s[i] == 'U'){
            nx--;
        }
        if(nx <= 0){
            f = 1;
        }
        if(t[i] == 'D'){
            nx = min(nx+1, h);
        }
        if(nx <= 0){
            f = 1;
        }
    }
    nx = x;
    REP(i, 0, n){
        if(s[i] == 'D'){
            nx++;
        }
        if(nx > h){
            f = 1;
        }
        if(t[i] == 'U'){
            nx = max(nx-1, 1);
        }
        if(nx > h){
            f = 1;
        }
    }
    if(f == 1){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
}

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


using namespace std;
 
int main(){
    int N,M;
    vector<int> a(60);
    vector<int> b(60);

    cin >> N >> M;

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

    vector<int> c(N);
    for(int i = 0; i < M; i++){
        c[a[i] - 1] += 1;
        c[b[i] - 1] += 1; 
    }

    for(int i = 0; i < N; i++){
        cout << c[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n,x = map(int,input().split())

while n != 0:
    
    count = 0

    for i in range(1,n+1):
        for j in range(i+1,n+1):
            for k in range(j+1,n+1):
                sum_num = i + j + k
                if sum_num == x :
                    count += 1
    print(count)
    n,x = map(int,input().split())



Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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

    string X, Y;
    int m_cnt = 0;
    rep(i, N) {
        X = S.substr(0, i);
        Y = S.substr(i, N-i);
        sort(X.begin(), X.end());
        X.erase(unique(X.begin(), X.end()), X.end());
        sort(Y.begin(), Y.end());
        Y.erase(unique(Y.begin(), Y.end()), Y.end());
        int cnt = 0;
        rep(j, X.size()) {
            rep(k, Y.size()) {
                if (X[j] == Y[k]) cnt++;
            }
        }
        m_cnt = max(m_cnt, cnt);

    }

    cout << m_cnt << endl;
}



Measured memory_bytes: 256
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

h,w,n = inm()
srow,scol = inm()
s = input().strip()
t = input().strip()
t = t[:-1] + 'M'
l = r = u = d = 0
for i in range(n-1,-1,-1):
    if s[i]=='D' and (t[i-1]!='U' or d==h-1):
        d += 1
    elif s[i]!='D' and t[i-1]=='U' and d>0:
        d -= 1

    if s[i]=='U' and (t[i-1]!='D' or u==h-1):
        u += 1
    elif s[i]!='U' and t[i-1]=='D' and u>0:
        u -= 1

    if s[i]=='L' and (t[i-1]!='R' or l==w-1):
        l += 1
    elif s[i]!='L' and t[i-1]=='R' and l>0:
        l -= 1

    if s[i]=='R' and (t[i-1]!='L' or r==w-1):
        r += 1
    elif s[i]!='R' and t[i-1]=='L' and r>0:
        r -= 1

    if l+r>=w or u+d>=h:
        print('NO')
        exit()

if 1+l<=scol<=w-r and 1+u<=srow<=h-d:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 51116
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(i=a; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define foreach(it,x) for(typeof(x.begin()) it=x.begin(); it!=x.end(); it++)


int main(){
    int run=0, out=0, point=0;
    int t; cin >> t;
    string in;

    while ( cin >> in ){
        if( in == "HIT" ){
            run++;
            if( run >= 4 ){
                run--; point++;
            }
        }
        else if( in == "OUT" ){
            out++;
        }
        else if( in == "HOMERUN" ){
            point += run + 1;
            run = 0;
        }

        if( out == 3 ){
            printf("%d\n",point);
            run = out = point = 0;
        }
    }

    return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main(){
int sum=0,ave,x,y,k=0,i=0;
double a,b,c;
while(scanf("%d,%d\n",&x,&y)!=EOF){
sum=sum+x*y;
k=k+y;
i++;
}
b=k,c=i;
a=b/c;
a=a+0.5;
ave=a;
printf("%d\n%d\n",sum,ave);
return 0;
}


Measured memory_bytes: 2048
import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)

for _ in range(m):
    tmp_win = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_win//2))

print(-sum(a))

Measured memory_bytes: 14180
#include<stdio.h>
#include<algorithm>
using namespace std;
   int n;
   int a[205];
   int main()
   {
   while(scanf("%d",&n)!=EOF)
      {
      n=n*2;	
      for(int i=0;i<n;i++)
         scanf("%d",&a[i]);
      sort(a,a+n); 
      int sum=0;
	  for(int i=0;i<n;i=i+2)
	     {
	     sum+=a[i];
		 }
	  printf("%d\n",sum);   
      }	
   } 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 2*1e13;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,m,q;
ll const XMAX=1010;
ll const YMAX=1010;
ll _sum[XMAX][YMAX];
ll ary[XMAX][YMAX]; //arry
void set_sum(ll x,ll y){
    rep(i,XMAX)rep(j,YMAX)_sum[i][j]=0;
    rep(i,y+1)rep(j,x+1){
        _sum[j+1][i+1] += _sum[j+1][i] + _sum[j][i+1] - _sum[j][i] + ary[j][i];
    }
}
ll get(ll x,ll y,ll x2,ll y2){//[x,y] ~ (x2,y2)
    if(x>=x2 || y>=y2){
        return -1;
    }else{
        return _sum[x2][y2] - _sum[x2][y] - _sum[x][y2] + _sum[x][y];
    }
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>n>>m>>q;
    ll le,ri;
    rep(i,m){
        cin>>le>>ri;
        ary[le][ri]++;
    }
    ll pp,qq;
    set_sum(n,n);
    rep(i,q){
        cin>>pp>>qq;
        print(get(pp,pp,qq+1,qq+1));
    }
    return 0;
}

Measured memory_bytes: 14592
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int score;
		int scoreA, scoreB;
		
		scoreA = 0;
		scoreB = 0;
		
		
		for(int i = 0; i < 4; i++){
			score = scan.nextInt();
			
			scoreA += score;
		}
		
		for(int i = 0; i < 4; i++){
			score = scan.nextInt();
			
			scoreB += score;
		}
		
		if(scoreA >= scoreB)System.out.println(scoreA);
		else System.out.println(scoreB);
	}
}

Measured memory_bytes: 26140
#include <stdio.h>
#define MAX 1000000000
#define max 500001


int count = 0;

void merge(int *A,int left,int mid,int right){

  int i,j,k,n1,n2,L[max],R[max];

  n1 = mid - left;
  n2 = right - mid;

  for(i = 0; i < n1; i++) L[i] = A[left + i];
  for(i = 0; i < n2; i++) R[i] = A[mid + i];
  L[n1] = MAX;
  R[n2] = MAX;

  i = 0;
  j = 0;

  for(k = left; k < right; k++){

    if(L[i] <= R[j]){
      A[k] = L[i];
      i++;
    }
    else{ 
      A[k] = R[j];
      j++;
    }
    count++;
  }
}

void mergeSort(int *A,int left,int right){

  int mid;

  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}


int main(){

  int i,n,A[max];

  scanf("%d",&n);
  for(i = 0; i < n; i++) scanf("%d",&A[i]);
  mergeSort(A,0,n);
  for(i = 0; i < n-1; i++) printf("%d ",A[i]);
  printf("%d\n",A[n-1]);
  printf("%d\n",count);


  return 0;
}


Measured memory_bytes: 5644
#include<iostream>
#include<math.h>
using namespace std;

int d, n;

int main() {
	cin >> d >> n;
	int ans;
	ans = pow(100, d)*n;
	if (n == 100) {
		ans += pow(100, d);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  int n;
  cin >> n;
  vector<vector<pair<int, int> > > data(n);
  for (int i = 0; i < n; i++) {
    int sz;
    cin >> sz;
    data[i].resize(sz);
    for (int j = 0; j < sz; j++) {
      cin >> data[i][j].first >> data[i][j].second;
      data[i][j].first--;
    }
  }
  int mask = (1 << n) - 1;
  while (mask) {
    int ppl = mask, i = n - 1;
    bool poss = true;
    while (ppl) {
      if (ppl & 1) {
        for (pair<int, int> p : data[i]) {
          int id = n - 1 - p.first;
          if (p.second && !((1 << id)&mask) || !p.second && (1 << id)&mask)
            poss = false;
        }
      }
      ppl /= 2;
      i--;
    }
    if (poss)
      break;
    mask--;
  }
  cout << __builtin_popcount(mask);
  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef vector<long long> vll;
typedef vector<pii> pxx;
typedef vector<int> vi;
#define pb push_back
#define mod  1000000007
#define PI 2*acos(0.0)
#define REP(i,a,b)  for(i = a; i <= b; i++)
#define f(a,b)  for(a=0 ; a<b; a++)



main()
{
    ll t=1;//cin>>t;
    while(t--)
    {
            string s;
            cin >> s;
            if(s[1]=='S')
            {
                if(s[0]=='R' || s[2]=='R') cout << 1 << endl;
                else cout << 0 << endl;
            }
            else{
                if(s[0]=='S' && s[2]=='S') cout << 1 << endl;
                else if(s[0]=='R' && s[2]=='R') cout << 3 << endl;
                else cout << 2 << endl;

            }



    }
}


Measured memory_bytes: 3628