akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main
{
	public static void main (String[] args) throws Exception
	{
		BufferedReader stdReader =
		new BufferedReader(new InputStreamReader(System.in));
		String natural[] = stdReader.readLine().split(" ",0);
		int x = Integer.parseInt(natural[0]);
		int y = Integer.parseInt(natural[1]);
		if (x < y) {
			x = x^y;
			y = x^y;
			x = x^y;
		}
		while (y > 0) {
			int r = x % y;
			x = y;
			y = r;
		}
		System.out.println(x);
	}
}

Measured memory_bytes: 24376
import math
while 1:
    D, E = map(int,raw_input().split(" "))
    if D == E == 0:
        break
    lst = []
    for i in range(D/2+1):
        lst.append(abs(math.sqrt((D-i)*(D-i)+i*i)-E))
    if min(lst) - math.trunc(min(lst)) == 0:
        print math.trunc(min(lst))
    else:
        print min(lst)

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


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

	int N;
	cin >> N;
	VI A(N+1);
	map<ll, ll> mp;
	A[0] = 0;
	mp[0]++;
	ll ans = 0;
	eFOR(i, 1, N) {
		int a;
		cin >> a;
		A[i] = A[i - 1] + a;
		ans += mp[A[i]];
		mp[A[i]]++;
	}
	cout << ans << endl;
	
	return 0;
}




















Measured memory_bytes: 14464
#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define endl "\n"
 
const LD eps=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};


template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}


extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<> void print<string>(const string& container)
{
	cout<<container<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}


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

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}

template<typename Head, typename... Tail>
struct vector_demensions
{
	using type=vector<typename vector_demensions<Tail...>::type>;
};

template<typename Head>
struct vector_demensions<Head> { using type=Head; };

template<typename T>
vector<T> make_vectors(int size, T val)
{
	return vector<T>(size, val);
}

template<typename T=int, typename... Args>
auto make_vectors(int size, Args... tail)
	-> typename vector_demensions<Args..., T>::type
{
	auto val=make_vectors<T>(forward<Args>(tail)...);
	return vector<decltype(val)>(size, val);
}



int main()
{
	int n;
	cin>>n;
	auto a(read<int>(n));
	LL ans=0;
	int v=0;
	bool f=1;
	for(int i=n-1;i>=0;i--)
	{
		if(v<a[i])
		{
			v=a[i];
			ans+=v;
		}
		else if(v>a[i])
		{
			f=0;
			break;
		}
		v--;
		chmax(v,0);
	}
	if(f&&a[0]==0)
	print(ans);
	else
	print(-1);
}


Measured memory_bytes: 1152
import java.util.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int n= sc.nextInt();
			if(n==0) break;
			int[] s, p;
			s = new int[n];
			p = new int[n];
			for(int i=0;i<n;i++) s[i] = sc.nextInt();
			int cnt = 0;
			HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
			for(;;) {
//				debug(s);
//				debug(p);
				for(int i=0;i<n;i++) {
					if(map.containsKey(s[i])) map.put(s[i], map.get(s[i])+1);
					else map.put(s[i], 1);
				}
				for(int i=0;i<n;i++) p[i] = map.get(s[i]);
				
				boolean flg = true;
				for(int i=0;i<n;i++) {
					if(s[i] != p[i]) {
						flg = false;
						break;
					}
				}
				s = p.clone();
				map.clear();
				if(flg) break;
				cnt++;
			}
			System.out.println(cnt);
			System.out.print(s[0]);
			for(int i=1;i<n;i++) System.out.print(" " + s[i]);
			System.out.println();
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <ctime>
#include <cstdlib>
#include <queue>
#include <cstring>
#include <cassert>
#include <bitset>

using namespace std;

#define mp make_pair
#define f first
#define s second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define sqr(x) ((x)*1ll*(x))

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

int dp[123][123];
int u[123][123];
int n;
int a[123];

int calc(int v, int s) {
    if(v == n) {
        if(s > 0) return 0;
        return -1e9;
    }
    if(u[v][s]) return dp[v][s];
    u[v][s] = 1;
    int res = -1e9;
    res = max(res, calc(v+1, (s+a[v+1]) % 10) + a[v+1]);
    res = max(res, calc(v+1, s));
    return dp[v][s] = res;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);

    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    int ans = calc(0, 0);
    if(ans < 0) ans = 0;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
//
// Created by vishal on 7/7/20.
//

//
// Created by vishal on 6/14/20.
//

#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 ff            first
#define ss            second
#define int           long long
#define pb            push_back
#define mp            make_pair
#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 setbits(x)    __builtin_popcountll(x)
#define zrobits(x)    __builtin_ctzll(x)
#define mod           1000000007
#define inf           1e18
#define ps(x,y)       fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr=new type[n];
#define w           int x;cin>>x;while(x--)
#define F10            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
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;
const int mex=3005;
int arr[mex][mex];
int32_t main()
{
    int n;
    cin>>n;
    vi v(n+2);
    v[0]=0;
    for (int i = 1; i <= n; ++i) {
        cin >> arr[i][i];
        v[i]=v[i-1]+arr[i][i];
    }
    for (int dist = 1; dist < n; ++dist) {
        for (int i = 1; i <= n-dist; ++i) {
            arr[i][i+dist]=max(arr[i][i]+(v[i+dist]-v[i])-arr[i+1][i+dist]
                    ,arr[i+dist][i+dist]+(v[i+dist-1]-v[i-1])-arr[i][i+dist-1]);
        }
    }
    cout<<arr[1][n]*2-v[n];


}

















Measured memory_bytes: 49712
#include<iostream>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;

typedef pair<int,int> P;

int dp[15][1<<15];
P prv[15][1<<15];
bool g[15][15];
int n,m,s,t,k[15],l;
vector<int> r[15];
int INF = (1<<10);

string itos(int a){
  if(!a)return "0";
  string res;
  while(a){
    res += a%10+'0';
    a/=10;
  }
  for(int i=0;i<(int)res.size()/2;i++)swap(res[i],res[(int)res.size()-1-i]);
  return res;
}

int main(){
  while(cin >> n >> m && (n || m)){
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)g[i][j] = false;

    for(int i=0;i<m;i++){
      cin >> s >> t;
      s--;t--;
      g[s][t] = g[t][s] = true;
    }

    l = 0;
    for(int i=0;i<n;i++){
      int tmp;
      cin >> tmp;
      l += (tmp<<i);
    }

    for(int i=0;i<n;i++){
      cin >> k[i];
      r[i].clear();
      r[i].resize(k[i]);
      for(int j=0;j<k[i];j++){
	cin >> r[i][j];
	r[i][j]--;
      }
      sort(r[i].begin(),r[i].end());
    }

    for(int i=0;i<n;i++)
      for(int j=0;j<(1<<n);j++){
	dp[i][j] = INF;
	prv[i][j] = make_pair(-1,-1);
      }
    dp[0][l] = 0;

    queue<P> q;
    q.push(make_pair(0,l));
     
    if(!(l&1)){
      cout << "Help me!\n";
      continue;
    }
    
    while(q.size()){
      P p = q.front();q.pop();
      int room = p.first, state = p.second;

      for(int i=0;i<k[room];i++){
	if(r[room][i]==room)continue;
	int tmp = 1<<r[room][i];
	int hoge = state;
	if(state & tmp)hoge -= tmp;
	else hoge += tmp;
	if(dp[room][hoge] > dp[room][state]+1){
	  dp[room][hoge] = dp[room][state]+1;
	  prv[room][hoge] = P(room,state);
	  q.push(P(room,hoge));
	}
      }

      for(int j=0;j<n;j++){
	if(g[room][j] && (state & (1<<j))){
	  if(dp[j][state] > dp[room][state]+1){
	    dp[j][state] = dp[room][state]+1;
	    prv[j][state] = P(room,state);
	    q.push(P(j,state));
	  }
	}
      }
    }
    
    int m = INF;
    for(int i=0;i<(1<<n);i++)m = min(m,dp[n-1][i]);
    if(m==INF)cout << "Help me!\n";
    else if(dp[n-1][1<<(n-1)]==INF)cout << "You can not switch off all lights.\n";
    else{
      cout << "You can go home in " << dp[n-1][1<<(n-1)] << " steps.\n";

      vector<string> ans;
      int room = n-1,state = 1<<(n-1);
      for(;;){
	int prvr = prv[room][state].first;
	int prvs = prv[room][state].second;
	if(prvr<0 && prvs<0)break; 
	if(prvr != room)ans.push_back("Move to room " + itos(room+1) + ".\n");
	else{
	  for(int i=0;i<n;i++){
	    if( (prvs & (1<<i)) && !(state & (1<<i)) ){
	      ans.push_back("Switch off room " + itos(i+1) + ".\n");
	      break;
	    }else if( !(prvs & (1<<i)) && (state & (1<<i)) ){
	      ans.push_back("Switch on room " + itos(i+1) + ".\n");
	      break;
	    }
	  }
	}
	room = prvr;
	state = prvs;
      }
      for(int i=(int)ans.size()-1;i>=0;i--)cout << ans[i];
    }
  }
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    string s;
    cin >> s;
    bool ans = true;

    if (s[0] != 'A')ans = false;
    string s_ = s.substr(2, s.size() - 3);
    int cnt = 0;
    for (auto sr : s_)if (sr == 'C')cnt++;
    if (cnt != 1)ans = false;
    cnt = 0;
    for (auto sr : s)if (sr >= 'a')cnt++;
    if (cnt != s.size() - 2)ans = false;
    if (ans) {
        cout << "AC" << endl;
    }
    else {
        cout << "WA" << endl;
    }
    return 0;
}

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

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

    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='?')
        {
            s[i]='D';
        }
    }
    cout<<s;
    exit(0);
}


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

int main() {
    int w, h, x, y;
    cin >> w >> h >> x >> y;

    double res = (double) w * h / 2;
    cout << res << endl;
    if (x == w / 2 && y == h / 2 && w % 2 == 0 && h % 2 == 0) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main(void) {
	char S[16] = "";
	char T[16] = "";
	if (scanf("%15s", S) != 1) return 1;
	if (scanf("%15s", T) != 1) return 1;
	S[strlen(S)] = T[strlen(T) - 1];
	puts(strcmp(S, T) == 0 ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 1644
//om namah shivaaay//
#include <bits/stdc++.h>
#define Om_namah_Shivaay ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long
 using namespace std;
 int main()
 {
	 Om_namah_Shivaay;
	 string str;
	 cin>>str;
	 
	 if(str=="AAA" || str=="BBB")
	 {
		 cout<<"No";
		 }
	 else{
		 cout<<"Yes";
		 }
	 }


Measured memory_bytes: 256
N, T = map(int, input().split(" "))
result = 1001

while N > 0:
    c, t = map(int, input().split(' '))
    if t <= T and c < result:
        result = c
    else:
        pass
    N = N - 1

if result == 1001:
    print('TLE')
else:
    print(result)


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

int main() {
  char b, c;
  cin >>  b;
  if(b == 'A'){
 c = 'T';
}
else if(b == 'T'){
 c = 'A';
}
else if( b == 'C'){
 c = 'G';
}
else if(b == 'G'){
 c = 'C';
}
else {
}
  cout << c << endl;
}

Measured memory_bytes: 256
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=998244353;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}

signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int k;
    cin>>k;
    rep(i,k)cout<<"ACL";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
#include<ios>
#include<iomanip>
//#include <boost/multiprecision/cpp_int.hpp>

//namespace mp = boost::multiprecision;
using namespace std;
typedef unsigned long long ll;
typedef pair<int,int>P;
//using Bint = mp::cpp_int;

vector<int>A;
vector<int>res;

ll lcm(ll _c,ll _d)
{
	ll a=_d,b=_c;
	ll c=b;
	for(;;)
	{
		c=a%b;
		if(c==0)
		{
			break;
		}
		a=b;
		b=c;
	}
	return (_c/b*_d/b)*b;
}

int main()
{
	ll A,B,C,D;
	cin>>A>>B>>C>>D;
	ll mc=(B/C)-((A-1)/C);
	ll md=(B/D)-((A-1)/D);
	ll l=lcm(C,D);
	ll mcd=(B/l)-((A-1)/l);
	cout<<(B-A+1)-(mc+md-mcd)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, D;
  cin >> N >> D;
  long x, y, ans = 0;
  for(int i = 0; i < N; i++){
    cin >> x >> y;
    if(D * D >= x * x + y * y){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3636
while True:
	H,W=map(int,input().split())
	if H==0 and W==0:
		break
	for i in range(H):
		for j in range(W):
			if i==0 or i==H-1:
				print("#", end="")
			else:
				if j==0 or j==W-1:
					print("#", end="")	
				else:
					print(".", end="")
		print()
	print()




Measured memory_bytes: 7000
#include <bits/stdc++.h>
using namespace std;
int x[5],y[5],a,b;
int main() {
    cin>>x[1]>>y[1]>>x[2]>>y[2];
    a=x[1]-x[2];
    b=y[1]-y[2];
    x[3]=x[2]+b;
    y[3]=y[2]-a;
    x[4]=x[3]+a;
    y[4]=y[3]+b;
    cout<<x[3]<<" "<<y[3]<<" "<<x[4]<<" "<<y[4];
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String[] n;
		int sum=0;
		while(true) {
			n = sc.nextLine().split("");
			if(n[0].equals("0")) break;
			sum=0;
			for(int i=0;i<n.length;i++) {
				sum += Integer.parseInt(n[i]);
			}
			System.out.println(sum);
		}

		
		sc.close();

	}

}


Measured memory_bytes: 27172
#include <iostream>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std;
signed main() {
	int n; double a[123], b[123];
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < n; i++)cin >> b[i];
	for (int p = 1; p <= 3; p++) {
		double qw = 0;
		for (int i = 0; i < n; i++)qw += pow(abs(a[i] - b[i]), p);
		printf("%.10f\n", pow(qw, (double)1 / p));
	}
	double qw = 0;
	for (int i = 0; i < n; i++)qw = max(abs(a[i] - b[i]), qw);
	printf("%.10f\n", qw);
}


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

using namespace std;

const int nax=1e5+5;
int a[nax];
int dp[nax];

int main()
{
    int n; cin>>n;
    int k; cin>>k;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=2;i<=n;i++)
    {
        dp[i]=dp[i-1]+abs(a[i]-a[i-1]);
        for(int j=2;j<=k;j++)
        {
            if(j>=i) break;
            dp[i]=min(dp[i],dp[i-j]+abs(a[i-j]-a[i]));
        }
    }
    cout<<dp[n];
    return 0;
}


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

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

  ll b_cnt = 0;
  ll ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'B') {
      b_cnt++;
    } else {
      ans += b_cnt;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
using namespace std;
int main(void) {
	int sx, sy, tx, ty;
	string str;
	cin >> sx >> sy >> tx >> ty;
	for (int i = 0; i < tx - sx; i++)
	{
		std::cout << 'R' ;
	}
	for (int i = 0; i < ty - sy; i++)
	{
		std::cout << 'U' ;
	}
	for (int i = 0; i < tx - sx; i++)
	{
		std::cout << 'L' ;
	}
	for (int i = 0; i < ty - sy + 1; i++)
	{
		std::cout << 'D' ;
	}
	for (int i = 0; i < tx - sx + 1; i++)
	{
		std::cout << 'R' ;
	}
	for (int i = 0; i < ty - sy + 1; i++)
	{
		std::cout << 'U' ;
	}
	std::cout << "LU" ;
	for (int i = 0; i < tx - sx + 1; i++)
	{
		std::cout << 'L' ;
	}
	for (int i = 0; i < ty - sy + 1; i++)
	{
		std::cout << 'D' ;
	}
	std::cout << 'R' << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0), cin.tie(0) 
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
const int inf = ~0u >> 1;
ll h[maxn];
bool flag[maxn];
int main() {
    IO;
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        cin >> h[i];
    }
    int ans = n;
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        if (h[a] < h[b] && !flag[a]) {
            ans--;
            flag[a] = true;
        }
        else if (h[b] < h[a] && !flag[b]) {
            ans--;
            flag[b] = true;
        }
        else if (h[b] == h[a]){
            if (!flag[b])
                ans--;
            if (!flag[a])
                ans--;
            flag[b] = true;
            flag[a] = true;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4476
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
Mod = 1000000007




def main(): #startline-------------------------------------------
    S = input()
    N = len(S)
    flag = 0
    p = []
    i = 0
    ans = 0
    while S:
        if len(S) != 1:
            if S[i+1] == S[i]:
                if len(S) != 2:
                    S = S[3:]
                    ans += 2
                else:
                    ans += 1
                    S = S[2:]
            else:
                S = S[1:]
                ans += 1
        else:
            ans += 1
            S = S[1:]
    print(ans)


if __name__ == "__main__":
    main() #endline===============================================





def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

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

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

  string s;
  cin >> s;
  
  string res;
  int size = s.size();
  for(int i = 0; i < size; i++){
    if((i + 1) % 2 == 1) res += s.at(i);
  }

  cout << res << endl;
}


Measured memory_bytes: 592
// Winners don't quit and Quitters don't win
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define mod 998244353
#define MAX 100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll k,n,i,j,sum=0,x;
    cin>>k>>n;
    vll v,ans;
    for(i=0;i<n;++i){
    	cin>>x;
    	v.pb(x);
	}
	for(i=0;i<n;++i){
		if(i==(n-1)){
			ans.pb(k-v[i]+v[0]);
		}
		else{
			ans.pb(v[i+1]-v[i]);
		}
	}
	sort(ans.begin(),ans.end());
	for(i=0;i<ans.size()-1;++i){
		sum+=ans[i];
	}
	cout<<sum;
}

Measured memory_bytes: 4848
#include <iostream>

using namespace std;

int main()
{
    int H1, M1, S1, H2, M2, S2, H, M, S;
    
    for(int i = 0; i < 3; i++)
    {
        cin >> H1 >> M1 >> S1 >> H2 >> M2 >> S2;
        
        H = H2 - H1;
        M = M2 - M1;
        S = S2 - S1;
        
        if(S < 0) { S += 60; M--; }
        if(M < 0) { M += 60; H--; }
        
        cout << H << ' ' << M << ' ' << S << endl;
    }
    
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const long double PI = acos(-1);
const long long INF = (1 << 30);
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;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  ll a, b, c;
  cin >> a >> b >> c;
  if(a + b >= c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
def gcm(a,b):
    if a==0 or b==0:
        return a
    else:
        [a,b]=[max(a,b),min(a,b)]
        return gcm(b,a%b)

def lcf(a,b,g):
    return a*b/g
    
while(1):
    n=int(raw_input())
    if n==0:
        break
    else:
        cdata=[]
        ratio=[]
        for i in range(n):
            cdata.append([int(x) for x in raw_input().split()])
        for i in range(n-1):
            a=cdata[0][0]*cdata[i+1][1]
            b=cdata[i+1][0]*cdata[0][1]
            g=gcm(a,b)
            ratio.append([b/g,a/g])
        ll=ratio[0][0]
        for r in range(n-2):
            g=gcm(ll,ratio[r+1][0])
            ll=lcf(ll,ratio[r+1][0],g)
        print ll
        for r in ratio:
            print r[1]*ll/r[0]

Measured memory_bytes: 4280
#include <iostream>
using namespace std;
int main(void) {
    // insert code here...
    int n;
    cin >> n;
    int two = 0;
    for(int i = 0; i < 4; i++){
        if(n % 10 == 2){
            two ++;
        }
        n = n / 10;
    }
    
    cout << two << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

#include <vector>
#include <list>
#include<stack>
#include<queue>
#include<array>

#include <set>
#include<map>

#include<string>
#include<stdlib.h>

#include<algorithm>
#include <functional>
#include<math.h>

#include<fstream>
#include<iomanip>

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int,int>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7


//変数
ll N;






//サブ関数
//入力
void input()
{
	cin >> N;
}

int len(ll num) {
	int res = 0;
	while (num != 0) {
		num /= 10;
		res++;
	}
	return res;
}

int sum_ll(ll s) {
	int res = 0;
	while (s > 0) {
		res += (s % 10);
		s /= 10;
	}
	return res;
}

//計算
void calc()
{

	int res = sum_ll(N);
	REP(i, len(N)) {
		ll tmp = N;
		REP(j, i)tmp /= 10;
		tmp--;
		REP(j, i) {
			tmp *= 10;
			tmp += 9;
		}
		res = max(res, sum_ll(tmp));
	}
	cout << res << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


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

void solve(long long N, long long K, std::vector<long long> h)
{
    long long M = 0;
    for (size_t i = 0; i < N; i++)
    {
        if (h[i] >= K)
        {
            M++;
        }
    }
    cout << M << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    std::vector<long long> h(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &h[i]);
    }
    solve(N, K, std::move(h));
    return 0;
}


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

int main(){
  string n;
  int cnt=0;
  cin>>n;
  if(n[0]!='A'){
    cout<<"WA"<<endl;
    return 0;
  }
  for(int i=2;i<n.size()-1;i++){
    if(n[i]=='C')cnt++;
  }
  if(cnt!=1){
    cout<<"WA"<<endl;
    return 0;
  }
  cnt=0;
  for(int i=0;i<n.size();i++){
    if((n[i]-'Z')<=0)cnt++;
  }
  if(cnt!=2){
    cout<<"WA"<<endl;
    return 0;
  }
  cout<<"AC"<<endl;
  return 0;
}

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

using namespace std;

typedef unsigned long long ull;
typedef pair<int, int> P;


int main(){
    int H, W, A, B; cin >> H >> W >> A >> B;
    stringstream ss;
    rep(i, H) {
        rep(j, W) {
            if (W-A > j && H-B > i) {
                ss << 0;
            } else if(W-A <= j && H-B > i) {
                ss << 1;
            } else if(W-A > j && H-B <= i) {
                ss << 1;
            } else {
                ss << 0;
            }
        }
        ss << "\n";
    }

    cout << ss.str();

}

Measured memory_bytes: 3332
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  cout << setprecision(10);
  long N, sum=0;
  cin >> N;
  for(int i=1; i<=N; i++){
    if (i%3>0 && i%5>0) sum+=i;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3580
/* Akshat Sharma @akshat98 */
#include <iostream>
#include <bits/stdc++.h>
#define IOS  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mp   make_pair
#define pb   push_back
#define F    first
#define S    second
#define ll   long long
#define MOD  1000000007
#define MAX  1000000001
#define vi 	 vector<ll>
#define vl   vector<ll>
#define vpi  vector<pair<ll,ll> >
#define vpl  vector<pair<ll,ll> >
#define rep(i,a,b) for(i=a;i<b;i++)
#define reqp(i,a,b) for(i=a;i<=b;i++)
#define ren for(i=0;i<n;i++)
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;
#define int long long

int32_t main()
{
	#ifndef ONLINE_JUDGE
	//freopen("input_file.txt", "r", stdin);
	//freopen("output_file.txt", "w", stdout);
	#endif
	int i,j,k,l,n,test_case,m,r;
	test_case=1;
	//cin>>test_case;
	while(test_case--){
		cin>>n>>m;
		vi vec(n);
		priority_queue<int>pq;
		for(auto &it:vec){
			cin>>it;
			pq.push(it);
		}
		// sort(ALL(vec));
		vi b(m),c(m);
		priority_queue<pii>pqp;
		rep(i,0,m){
			cin>>b[i]>>c[i];
			pqp.push({c[i],b[i]});
		}
		
		ll sum=0;
		rep(i,0,n){
			if(!pqp.empty()){
				if(pq.top()>pqp.top().F){
					sum+=pq.top();
					pq.pop();
				}else{
					pii tp=pqp.top();
					pqp.pop();
					tp.S--;
					sum+=tp.F;
					if(tp.S){
						pqp.push(tp);
					}
				}
			}else{
				sum+=pq.top();
				pq.pop();
			}
		}
		cout<<sum;






	}
	
	return 0;
}

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

#define endl '\n'

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define BUFF ios::sync_with_stdio(0);

typedef long long int ll;
typedef long double ld;
typedef vector < int > vi;
typedef vector < vi > vvi;
typedef pair < int, int > ii;
typedef vector < ii > vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const int MOD = 1e9+7;
const ld pi = acos(-1);

int n, m, x;
int grid[15][15] = {0};
int main() { BUFF
  cin >> n >> m >> x;
  for(int i=1; i<=n; i++) {
    for(int j=0; j<=m; j++) cin >> grid[i][j];
  }
  ll min_cost = LINF;
  for(int i=0; i<pow(2, n); i++) {
    vi score(m+1, 0);
    ll cur_cost = 0;
    for(int j=1; j<=i; j = j<<1) {
      int pos = (int)log2(j) + 1;
      if(i & j) {
        cur_cost += grid[pos][0];
        for(int k=1; k<=m; k++) score[k] += grid[pos][k];
      }
    }

    bool fail = false;
    for(int j=1; j<=m; j++) {
      if(score[j] < x) fail = true;
    }
    if(!fail && cur_cost < min_cost) min_cost = cur_cost;
  }
  if(min_cost == LINF) cout << -1 << endl;
  else cout << min_cost << endl;
  return 0;
}


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

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

    for (int i = 1; i <= n; ++i) {
        int x = i;
        if (x % 3 == 0) {
            cout << " " << i;
            continue;
        }
        if (x % 10 == 3) {
            cout << " " << i;
            continue;
        }
        x /= 10;
        for (;;) {
            if (x) {
                if (x % 10 == 3) {
                    cout << " " << i;
                    break;
                }
                x /= 10;
            } else {
                break;
            }
        }
    }
    cout << endl;
}

Measured memory_bytes: 1164
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

from collections import defaultdict

n, t = getMN()
nums = getlist()
ans = defaultdict(int)
cur = nums[0]
upper = cur
profits = defaultdict(int)
n_low = 1
n_up = 1

for num in nums[1:]:
    if cur > num:
        profits[upper-cur] += min(n_low, n_up)
        cur = num
        n_low = 1
        n_up = 1
        upper = cur
    elif cur == num:
        n_low += 1
    elif num == upper:
        n_up += 1
    elif num > upper:
        upper = num
        n_up = 1
profits[upper-cur] += min(n_low, n_up)

maxkey = max(profits.keys())
print(profits[maxkey])


Measured memory_bytes: 14628
#include <iostream>
#include <utility>
#include <functional>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define REV(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define setp(x) setprecision(x)
using LL = long long;
using ULL = unsigned long long;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> c(m + 1, 0);
	rep(i, 0, n) {
		int k;
		cin >> k;
		rep(j, 0, k) {
			int a;
			cin >> a;
			c[a]++;
		}
	}

	int count = 0;
	for (auto& x : c) {
		if (x == n) count++;
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int[][][] a = new int[4][3][10];

        int n = sc.nextInt();

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

            int b = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            int v = sc.nextInt();

            a[b - 1][f - 1][r - 1] += v;
        }

        printHouse(a);

        sc.close();
    }

    static void printHouse(int[][][] a) {

        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 3; j++) {
                for (int k = 0; k < 10; k++) {
                    System.out.print(" " + a[i][j][k]);
                }
                System.out.print("\n");
            }
            if (i != 3) {
                for (int l = 0; l < 20; l++) {
                    System.out.print("#");
                }
                System.out.print("\n");
            }

        }
    }
}


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

int main(){
  int n,t,a;
  int min=1000000,point=0;
  cin >> n >> t >> a;
  
  vector<int> vec(n);
  
  for(int i=0; i<n; i++){
    cin >> vec.at(i);
    vec.at(i) = (t - vec.at(i) * 0.006 - a)*1000;
    if(vec.at(i) < 0){
      vec.at(i) = -vec.at(i);
    }
    if(min > vec.at(i)){
      min = vec.at(i);
      point = i+1;
    }
  } 
  
  cout << point << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
using namespace std;
const int mod = 998244353, maxn = 1e5+10;
int N, M;
int h[maxn], dp[maxn];

int main()
{
    memset(dp, 0x3f,sizeof(dp));
    scanf("%d", &N);
    for(int i = 1; i <= N; i++)
        scanf("%d", &h[i]);
    dp[1] = 0;
    for(int i = 2; i <= N; i++) {
        if(i > 1)
            dp[i] = min(dp[i], dp[i-1]+abs(h[i]-h[i-1]));
        if(i > 2)
            dp[i] = min(dp[i], dp[i-2]+abs(h[i]-h[i-2]));
    }
    printf("%d\n", dp[N]);
    return 0;
}


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

using namespace std;

#define IO ios_base::sync_with_stdio(0);cin.tie(0);

int main()
{
  IO;
	int a, b; cin >> a >> b;
	cout << (1 + (b - a)) * (b - a) / 2 - b << endl;
 
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a[10];
int main()
{
    ll n,t,x,y=0,i,j,c=0;
    cin>>n;
    for(i= 0 ; i<n ; i++)
    {
        cin>>x;
        if(x>=3200)
            c++;
        else if(x>=2800)
            a[0]++;
        else if(x>=2400)
            a[1]++;
        else if(x>=2000)
            a[2]++;
        else if(x>=1600)
            a[3]++;
        else if(x>=1200)
            a[4]++;
        else if(x>= 800)
            a[5]++;
        else if(x>= 400)
            a[6]++;
        else if(x>=1)
            a[7]++;
    }
    for(i = 0 ; i<9 ; i++)
    {
        if(a[i]>0)
            y++;
    }
    if(y>0)
        cout<<y<<" ";
    else{
        cout<<1<<" ";
        
    }
    if(c==0)
        cout<<y<<endl;
    else
    {
        y+=c;
            cout<<y<<endl;
    }
    return 0;
}

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

using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
const int M = 10000001;
ll a[M];
int main() {
    int N;
    cin >> N;
    fill(a, a + M, 1);
    for (ll i = 2; i < M; i++) {
        for (ll j = 1; i * j < M; j++) {
            a[i * j]++;
        }
    }
    ll ans = 0;
    for (ll i = 1; i <= N; i++) {
        ans += i * a[i];
    }
    cout << ans << "\n";
    return 0;
}

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

const int maxn = 1e5+1;
int a[maxn];
void answer_for_4k_0() {
}

int main() {
  int N;
  cin>>N;
  for(int i = 1; i <= N; i++) a[i] = i;
  if(N % 4 == 3) {
    cout<<"Yes"<<endl;
    for(int i = 1; i < N; i++) {
      cout<<i<<" "<<i + 1<<endl;
      cout<<N + i<<" "<<N + i + 1<<endl;
    }
    cout<<N<<" "<<N+1<<endl;
  } else if(N % 4 == 0) {
    if(__builtin_popcount(N) == 1) {
      cout<<"No"<<endl; // no for such case
    } else {
      int target_value = N ^(N - 1); // this value always less
      swap(a[target_value], a[N - 2]); 
      cout<<"Yes"<<endl;
      for(int i = 1; i < N - 1; i++) {
        cout<<a[i]<<" "<<a[i + 1]<<endl;
        cout<<N + a[i]<<" "<<N + a[i + 1]<<endl;
      }
      cout<<a[N - 1]<<" "<<N + a[1]<<endl;
      cout<<N<<" "<<N - 1<<endl;
      cout<<N + N<<" "<<a[N-2]<<endl;
    }
  } else if(N % 4 == 1 && N > 1) {
    cout<<"Yes"<<endl;
    for(int i = 1; i < N - 2; i++) {
      cout<<i<<" "<<i + 1<<endl;
      cout<<N + i<<" "<<N + i + 1<<endl;
    }
    cout<<N - 2<<" "<<N + 1<<endl;
    cout<<N<<" "<<N - 1<<endl;
    cout<<N - 1<<" "<<1<<endl;
    cout<<1<<" "<<N + N<<endl;
    cout<<N + N<<" "<<N + N - 1<<endl;
  } else if(N % 4 == 2 && N > 2) {
    cout<<"Yes"<<endl;
    int n = N - 3;
    for(int i = 1; i < n; i++) {
      cout<<i<<" "<<i + 1<<endl;
      cout<<N + i<<" "<<N + i + 1<<endl;
    }
    cout<<n<<" "<<N + 1<<endl;
    cout<<(N - 2)<<" "<<(N - 1)<<endl;
    cout<<(N - 1)<<" "<<(1)<<endl;
    cout<<(2 * N - 2)<<" "<<(1)<<endl;
    cout<<(2 * N - 2)<<" "<<(2*N - 1)<<endl;
    cout<<N << " " << N - 1 <<endl;
    cout<<2 << " " << 2 * N <<endl;
  } else {
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3200
#include <iostream>
using namespace std;
int main() {
  long long A, B, r, x;
  cin >> A >> B;
  x = A * B;
  
  if(A<B){
      int tmp = A;
      A = B;
      B = tmp;
  }
  
  r = A%B;
  while(r!=0){
      A = B;
      B = r;
      r=A%B;
  }
  cout << x/B;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int i,counter=0,maxi=0;
    for(i=0;i<3;i++)
    {
        if(s[i]=='R') counter++;
        else counter=0;
        maxi=max(maxi,counter);
    }
    cout << maxi << endl;
}

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

using namespace std;

#define MAX_N 1010
#define MAX_V 3010
#define INF 1e9
typedef pair<int,int> pii;

struct edge{
  int to,cap,cost,rev;
};

int V,h[MAX_V],dist[MAX_V];
int prevv[MAX_V],preve[MAX_V];
vector<edge> G[MAX_V];

void add_edge(int from,int to,int cap,int cost){
  G[from].push_back((edge){to,cap,cost,G[to].size()});
  G[to].push_back((edge){from,0,-cost,G[from].size()-1});
}

int min_cost_flow(int s,int t,int f){
  int res = 0;
  fill(h,h+V,0);
  while(f > 0){
    priority_queue<pii,vector<pii>,greater<pii> > Q;
    fill(dist,dist+V,INF);
    dist[s] = 0;
    Q.push(pii(0,s));
    while(!Q.empty()){
      pii p = Q.top(); Q.pop();
      int v = p.second;
      if(dist[v] < p.first){ continue; }
      for(int i = 0 ; i < (int)G[v].size() ; i++){
        edge &e = G[v][i];
        if(e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]){
          dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
          prevv[e.to] = v; preve[e.to] = i;
          Q.push(pii(dist[e.to],e.to));
        }
      }
    }
    if(dist[t] == INF){ return -1; }
    for(int v = 0 ; v < V ; v++){
      h[v] += dist[v];
    }
    int d = f;
    for(int v = t ; v != s ; v = prevv[v]){
      d = min(d,G[prevv[v]][preve[v]].cap);
    }
    f -= d;
    res += d * h[t];
    for(int v = t ; v != s ; v = prevv[v]){
      edge &e = G[prevv[v]][preve[v]];
      e.cap -= d;
      G[v][e.rev].cap += d;
    }
  }
  return res;
}

void init(){
  for(int i = 0 ; i < MAX_V ; i++){
    G[i].clear();
  }
}

int main(){
  set<int> st;
  int N,A[MAX_N],B[MAX_N];
  cin >> N; init();
  for(int i = 0 ; i < N ; i++){
    cin >> A[i] >> B[i];
    st.insert(A[i]); st.insert(B[i]);
  }
  int size = st.size();
  int s = N+size,t = s+1;
  V = N + size + 2;
  set<int>::iterator it;
  vector<int> vec;
  for(it = st.begin() ; it != st.end() ; ++it){
    vec.push_back(*it);
  }
  add_edge(s,t,size,0);
  for(int i = 0 ; i < N ; i++){
    int j = lower_bound(vec.begin(),vec.end(),A[i])-vec.begin();
    add_edge(j,size+i,1,-B[i]);
    j = lower_bound(vec.begin(),vec.end(),B[i])-vec.begin();
    add_edge(j,size+i,1,-A[i]);
  }
  for(int i = 0 ; i < size ; i++){
    add_edge(s,i,1,0);
  }
  for(int i = 0 ; i < N ; i++){
    add_edge(size+i,t,1,0);
  }
  cout << -min_cost_flow(s,t,size) << endl;
  return 0;
}

Measured memory_bytes: 1744
n = int(input())
f = True
ans_2 = []
for i in range(n):
    d,d_1 = map(int,input().split())
    if f:
        ans = 0
    if d == d_1:
        ans += 1
        f = False
    else:
        f = True
        ans_2.append(ans)
ans_2.append(ans)

f_2 = False
for j in ans_2:
    if j >= 3:
        f_2 = True
    
if f_2:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 62300
#include<iostream>
#include<vector>
int main(){
  long long a,b=1,kotae=0;
  std::cin>>a;
  std::vector<std::vector<int> >ans(11,std::vector<int>(11,0));
  for(int i=0;i<=a;i++){
    if(i>=b*10)b=b*10;
   ans[i-i/10*10][i/b]=ans[i-i/10*10][i/b]+1;
  }
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      kotae=kotae+ans[i][j]*ans[j][i];
    }
  }
  std::cout<<kotae<<std::endl;
  return 0;
}

Measured memory_bytes: 256
K = gets.to_i

N = 10_000_000_000_000_000_000

def calc(i)
  j = i
  tot = 0
  while j > 0
    tot += j % 10
    j /= 10
  end
  i.to_f / tot
end

ans = []
n = N
while n > 1
  x = n / 10000
  x = 1 if x < 1
  localmin = calc(n - 1)
  (n - 1).step(n / 10, -x) do |i|
    tmp = calc(i)
    if tmp <= localmin 
      ans << i   
      localmin = tmp 
    end 
  end 
  n /= 10
end

puts ans.sort.take(K)

Measured memory_bytes: 1916
#include <iostream>
#include<bits/stdc++.h>
#include<string.h>
#include <cstdlib>
#include <sstream>  
#include <vector>
#include <set>
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define mlim 10000000
#define br break
#define pb push_back
#define pi 3.14159265358979323846
#define pob pop_back
#define pf pop_front
#define cc continue
#define ll long long int
#define vl vector<long long int>
#define pll pair<long long int,long long int>
#define sll set<long long int>
#define l length()
#define tc ll t;cin>>t; while(t--)
#define f(i,a,b) for(ll i=a; i<b; i++)
#define g(i,b,a) for(ll i=b-1; i>=a; i--)
 
using namespace std;
void solve()
{
   ll n;
   cin>>n;
   ll x=0;
   n/=5;
   x=(n/100)*1000;
   n-=(n/100)*100;
   x+=n*5;
   cout<<x;
}
int main() {
	fio;
	    solve();
	return 0;
}


Measured memory_bytes: 256
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

main :: IO ()
main = do
  before <- readInt
  after <- readInt
  print $ 2*after - before

------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"


Measured memory_bytes: 508
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <list>
#include <cstdlib>
#include <memory>
#include <cstring>
#include <sstream>
#include <list>
#include <deque>
#include <bitset>
#include <vector>

using namespace std;

#define INF 0x3f3f3f3f
#define PI 3.141592653579
#define FRER() freopen("input.txt" , "r" , stdin);
#define FREW()  freopen("output.txt" , "w" , stdout);
#define  QIO std::ios::sync_with_stdio(false)
#define mem(a , b) memset(a , b , sizeof(a))
const double eps = 1e-8;
typedef long long ll;
const int maxn = 1e5+1000;
//ll C[maxn][maxn];
//ll res[maxn];
ll num[maxn];
ll maxx[maxn];
int main()
{
    ll n , t;
 int c;
    scanf("%lld %lld" , &n , &t);
    for(int i = 0 ; i <n ; i++)
    {
        scanf("%lld" , &num[i]);
        if(i == 0) maxx[i] = num[i];
        else maxx[i] = max(maxx[i-1] , num[i]);
    }
    ll uptime = 0;
//    for(int i = 0 ; i < n ; i++)
//        cout << maxx[i] << " "<< endl;
    for(int i = 0 ; i < n ; i++)
    {
        uptime += num[i];
        if(i == 0)
            printf("%lld\n" , t/num[i] + 1);
        else
        {
            if(uptime > t) printf("1\n");
            else
                printf("%lld\n" , (t - uptime)/maxx[i]+2);
        }
    }
    return 0;
}


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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	map<string, int> s;
	int n, m;
	cin >> n;
	for (int i = 0; i < n; i++) {
		string a;
		cin >> a;
		s[a]++;
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		string a;
		cin >> a;
		s[a]--;
	}
	int ans;
	for (auto iter = s.begin(); iter != s.end(); ++iter) {
		if (iter == s.begin()) {
			ans = iter->second;
			continue;
		}
		if (iter->second > ans) {
			ans = iter->second;
		}
	}
	if (ans <= 0) {
		cout << 0;
		return 0;
	}
	cout << ans;
}

Measured memory_bytes: 256