akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
vector<int> G[100000];
int dp[100000][11];
int col[100000];
int main() {
	int n, m; cin >> n >> m;
	rep(i, m) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	rep(i, n) {
		rep(j, 11) {
			dp[i][j] = -1;
		}
	}
	int q; cin >> q;
	rep(i, q) {
		int v, d, c; cin >> v >> d >> c; v--;
		dp[v][d] = i;
		col[i] = c;
	}
	per(k, 10) {
		rep(i, n) {
			int len = G[i].size();
			rep(j, len) {
				int v = G[i][j];
				dp[i][k] = max(dp[i][k], dp[v][k + 1]);
			}
			dp[i][k] = max(dp[i][k], dp[i][k + 1]);
		}
	}
	rep(i, n) {
		if (dp[i][0] == -1)cout << 0 << endl;
		else cout << col[dp[i][0]] << endl;
	}
	return 0;
}

Measured memory_bytes: 11128
import java.util.*;
 
class Main {
    public static void main(String[] args) {
 	   Scanner sc = new Scanner(System.in);
		int intA = sc.nextInt();
      	int intB = sc.nextInt();
      	int intC = sc.nextInt();
      	int intD = sc.nextInt();
      	int intE = sc.nextInt();
      

      if (intA == 0 ) {
        System.out.println("1");
      } else if (intB == 0){
        System.out.println("2");
      } else if (intC == 0){
        System.out.println("3");
      } else if (intD == 0){
        System.out.println("4");
      } else if (intE == 0){
        System.out.println("5");
      }
    }
}


Measured memory_bytes: 35652
#include<bits/stdc++.h>
using namespace std;
map<string,bool> q;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	string a,b;
	int n;
	cin>>n;
	int ans=2*n;
	cin>>a>>b;
	int lena=a.size(),lenb=b.size();
	for(int i=0;i<=lena;++i)
		q[a.substr(i,lena)]=1;
	for(int i=lenb;i>=0;--i){
		if(q[b.substr(0,i)]){
			cout<<ans-i<<endl;
			exit(0);
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void)
{
    int n, x, t, s;
    cin >> n >> x >> t;

    s = ((n+(x-1))/x) * t;
    cout << s;
}


Measured memory_bytes: 3636
#include <iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(void) {
  int N;
  int K;
  int l[50];
  cin>>N>>K;
  int ans=0;
  for(int i=0;i<N;i++){
    cin>>l[i];
  }
  sort(l,l+N,greater<int>());
  for(int a=0;a<K;a++){
    ans+=l[a];
  }
  cout<<ans<<endl;
}
    
    
  


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
const int inf = 1 << 30;
const int ma = 1e6 + 1;
using namespace std;
typedef pair< int, int > P;
int n,q;
int s[ma],idx[ma];
vector< P > acs(ma);
main()
{
    cin >> n >> q;
    for( int i = 0; i < n; i++ )
    {
        cin >> s[i];
        acs[i] = P( s[i], i );
    }
    sort( begin(acs), begin(acs) + n );
    for( int i = 0; i<n; i++ )idx[acs[i].second] = i;
    set< int > leader;
    while( q-- )
    {
        string t;
        cin >> t;
        int a, x;

        if( t=="ADD")
        {
            cin >> a;
            leader.insert(a - 1);
        }
        else if(t=="REMOVE")
        {
            cin >> a;
            leader.erase(a - 1);

        }
        else
        {

            int ng = -1,ok = inf;
            bool flag = 0;
            vector< int> pos;
            cin >> x;
            for( auto &d : leader )pos.emplace_back( idx[d] );
            sort( begin(pos), end(pos ) );
            while( abs( ng - ok) > 1)
            {
                int r = ( ng + ok ) / 2;
                int cnt = 0;
                ///何処まで
                int covered = -1;
                for( auto right : pos )
                {
                    int left = lower_bound( begin(acs), begin(acs) + n, make_pair( acs[right].first - r, -inf ) ) - begin(acs);
                    right = upper_bound( begin(acs), begin( acs ) + n, make_pair( acs[right].first , inf ) ) - begin(acs) - 1;

                    left = max( covered + 1, left );
                    cnt += right - left + 1;
                    covered = right;
                }
                if( (n - x) <= cnt )
                {
                    ok = r;
                    flag = 1;
                }
                else
                {
                    ng = r;
                }
                
            }
            if( flag )cout << ok << endl;
            else cout << "NA" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 18328
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

typedef pair<int, int> pii;
#define mp make_pair

const int N = 200200;
int n;
vector<int> g[N];
int col[2][N];
int m, k;
int C;

map<pii, int> a;

void dfs(int v, int it)
{
	col[it][v] = C;
	for (int u : g[v])
		if (col[it][u] == -1)
			dfs(u, it);
	return;
}

int main()
{
	scanf("%d%d%d", &n, &m, &k);
	for (int it = 0; it < 2; it++)
	{
		for (int i = 0; i < n; i++)
			g[i].clear();
		for (int i = 0; i < n; i++)
			col[it][i] = -1;
		C = 0;
		while(m--)
		{
			int v, u;
			scanf("%d%d", &v, &u);
			v--;u--;
			g[v].push_back(u);
			g[u].push_back(v);
		}
		for (int v = 0; v < n; v++)
			if (col[it][v] == -1)
			{
				dfs(v, it);
				C++;
			}
		swap(m, k);
	}
	for (int i = 0; i < n; i++)
		a[mp(col[0][i], col[1][i])]++;
	for (int i = 0; i < n; i++)
		printf("%d ", a[mp(col[0][i], col[1][i])]);

	return 0;
}

Measured memory_bytes: 22272
#include<iostream>

using namespace std;

int a[1000000];

int main(void){
  int n;
  int index;
  int cnt = 1;
  cin >> n;

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


  for(int i = 0; i < n;i++){
    if(index == 2){
      cout << cnt << endl;
      return 0;
    }
    index = a[index];
    cnt++;
  }

  cout << -1 << endl;

  return 0;

}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int N, a[109];
int main() {
	cin >> N;
	for (int i = 0; i < N; i++) cin >> a[i];
	sort(a, a + N, greater<int>());
	int ret = 0;
	for (int i = 0; i < N; i++) ret += a[i] * (i & 1 ? -1 : 1);
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)
c = gets.chomp.split.map(&:to_i)

puts (0...n).inject(0) {|sum, i|
    sum += a[i] + 1 == a[i+1] ? b[a[i]-1] + c[a[i]-1] : b[a[i]-1]
}

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

public class Main {
    
    private static PrintWriter out;
    
    private static <T> void mprintln(T ... ar){
        for(T i: ar) out.print(i + " ");
        out.println();
    }
    
    public static void main(String[] args) throws FileNotFoundException{

        // Input from file
        // File inputFile = new File("JavaFile.txt");
        // File outputFile = new File("JavaOutputFile.txt");
        // FileReader fileReader = new FileReader(inputFile);
        // Here it ends

        MyScanner sc = new MyScanner();
        // MyScanner sc = new MyScanner(fileReader);

        out = new PrintWriter(new BufferedOutputStream(System.out)); // Output to console
        // out = new PrintWriter(new PrintStream(outputFile)); // Output to file

        getAns(sc);

        out.close();
    }
    
    private static void getAns(MyScanner sc){
        String s = sc.nn();
        int first = Integer.parseInt(s.substring(0, 2));
        int second = Integer.parseInt(s.substring(2));
       
        if(first >= 1 && first <= 12){
            if(second >= 1 && second <= 12) out.println("AMBIGUOUS");
            else out.println("MMYY");
        }else{
            if(second >= 1 && second <= 12) out.println("YYMM");
            else out.println("NA");
        }
    }
    
    static class MyScanner{
        BufferedReader br;
	StringTokenizer st;

	MyScanner(FileReader fileReader){
            br = new BufferedReader(fileReader);
	}

	MyScanner(){
            br = new BufferedReader(new InputStreamReader(System.in));
	}

	String nn(){
            while(st == null || !st.hasMoreElements()){
		try{
                    st = new StringTokenizer(br.readLine());
		}catch(IOException e){
                    e.printStackTrace();
		}
            }
            return st.nextToken();
	}
        
        String nextLine(){
            String ans = "";
            try {
                ans = br.readLine();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            return ans;
        }

	char nc(){
            return nn().charAt(0);
	}

	int ni(){
            return Integer.parseInt(nn());
	}

	long nl(){
            return Long.parseLong(nn());
	}

	double nd(){
            return Double.parseDouble(nn());
	}

	int[] niArr0(int n){
            int[] ar = new int[n];
            for(int i = 0; i < n; i++) ar[i] = ni();
            return ar;
	}

        int[] niArr1(int n){
            int[] ar = new int[n + 1];
            for(int i = 1; i <= n; i++) ar[i] = ni();
            return ar;
	}

        long[] nlArr0(int n){
            long[] ar = new long[n];
            for(int i = 0; i < n; i++) ar[i] = nl();
            return ar;
        }

        long[] nlArr1(int n){
            long[] ar = new long[n + 1];
            for(int i = 1; i <= n; i++) ar[i] = nl();
            return ar;
        }
    }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
using namespace std;
#define ALL(a) a.begin(),a.end()


int main(){
    int n;
    cin>>n;
    string s1,s2;
    cin>>s1>>s2;
    vector<int> pat;
    for(int i=0;i<s1.size();i++){
        if(i==s1.size()-1){
            pat.push_back(1);
        }
        else{
            if(s1[i]==s1[i+1]){
                pat.push_back(2);
                i++;
            }
            else{
                pat.push_back(1);
            }
        }
    }
    long long int MOD=1e9+7;
    long long int res;
    if(pat[0]==1){
        res=3;
    }
    else{
        res=6;
    }
    
    for(int i=1;i<pat.size();i++){
        if(pat[i-1]==1){
            res*=2;
        }
        if(pat[i-1]==2 && pat[i]==2){
            res*=3;
        }
        res%=MOD;
    }
    cout<<res<<endl;
    return 0;
}


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

using Graph = vector<vector<int>>;

int main(){
  int n, m;
  cin >> n >> m;
  Graph road(n+1);
  vector<int> shirube(n + 1);
  vector<bool> isDone(n + 1, false);
  
  for(int i = 0; i < m; i++){
    int a, b;
    cin >> a >> b;
    road.at(a).push_back(b);
    road.at(b).push_back(a);
  }
  
  queue<int> q;
  q.push(1);
  while(!q.empty()){
    int num = q.front();
    q.pop();
    for(int v : road.at(num)){
      if(isDone.at(v)){
        continue;
      }
      
      shirube.at(v) = num;
      isDone.at(v) = true;
      q.push(v);
    }
  }
  
  bool isFinish = false;
  for(int i = 2; i < n+1; i++){
    if(i == n){
      isFinish = true;
    }
    
    if(!isDone.at(i)){
      break;
    }
  }
  
  if(isFinish){
    cout << "Yes" << endl;
    for(int i = 2; i < n+1; i++){
      cout << shirube.at(i) << endl;
    }
  }
  else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 10280
s=int(input())

def f(a):
  if a%2==0:
    return a//2
  else:
    return 3*a+1

result=[s]
for i in range(2,10000000):
  s=f(s)
  if s in result:
    print(i)
    exit()
  else:
    result.append(s)

Measured memory_bytes: 3068
#include <bits/stdc++.h>
// #include "ane.cpp"

const int INF  = 1e9;
const long long INFLL = 1e18;
const int NMAX = 100005;
const int MMAX = 100005;
const int KMAX = 1005;
const int MOD  = 1e9 + 7;
using namespace std;

// comment to disable debug functions
#define DEBUG

// frequently used macros

#if __cplusplus >= 201103L
#define ALL(v) begin(v),end(v)
#define SORT(v) sort(begin(v), end(v))
#define FIND(v,x) find(begin(v), end(v), (x))
#else
#define ALL(v) (v).begin(),(v).end()
#define SORT(v) sort(v.begin(), v.end())
#define FIND(v,x) find(v.begin(), v.end(), (x))
#endif

#define MEMNEXT(from, to) do{ memmove((to), (from), sizeof(from)); \
memset((from), 0, sizeof(from)); } while(0)
#ifdef DEBUG
#define DUMP(x) do{ std::cerr << (#x) << ": " << x << std::endl; }while(0)
#else
#define DUMP(x) do{}while(0)
#endif

// frequent used aliases
typedef long long ll;
typedef pair<int, int> p;
typedef pair<ll, int> lp;
typedef pair<ll, ll> llp;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<vec> mat;
typedef vector<vecll> matll;

// frequently used constants
static const int di[] = {-1, 0, 1, -1, 1, -1, 0, 1};
static const int dj[] = {-1, -1, -1, 0, 0, 1, 1, 1};

// frequently used structs
struct edge{
  int to,cost;
};

// printf for debug
#ifndef DEBUG
void debug(const char* format, ...){}
#else
void debug(const char* format, ...){
  va_list arg;
  va_start(arg, format);
  vprintf(format, arg);
  va_end(arg);
}
#endif

// dump vector
#ifdef DEBUG
#define DUMPV(v, c) do{       \
  printf("%s: ", #v);         \
  for (int i = 0; i < (c); ++i) \
  {                           \
  cout << (v)[i] << " ";      \
  }                           \
  cout << endl;               \
} while(0)
#else
#define DUMPV(v,c)
#endif

// std::fill of multi dimensions
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
  std::fill( (T*)array, (T*)(array+N), val );
}

// binary search
ll BSearch(ll _begin, ll _end, bool (*f)(int)){
  ll mid;
  while(_end - _begin > 1LL) {
  mid = (_begin + _end) / 2LL;
  if(f(mid)) {
    debug("BSearch: f(%d) == true\n", mid);
    _end = mid;
  }
  else
  {
    debug("BSearch: f(%d) == false\n", mid);
    _begin = mid;
  }
  }
  return _end;
}


ll N,M,K,A,B,C,D,E;
int dp[NMAX] = {};

string S[3];
vec v;

string ans;

void solve(){
  // main algorithm
  for (int i = 0; i < 3; ++i)
  {
    ans  += S[i][0] - 'a' + 'A';
  }
}
void debug(){
  // output debug information

}
void answer(){
  // output answer
  cout << ans << endl;
}
int main(int argc, char const *argv[])
{
  // operate inputs

  // Fill(dp, -1);
  for (int i = 0; i < 3; ++i)
  {
    cin >> S[i];
  }
  solve();
  #ifdef DEBUG
  debug();
  #endif
  answer();

  return 0;
}

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

int main(){
  int N,K,X,Y,ans; 
  cin >> N >> K >> X >> Y;
  if(K > N){
    ans = N * X;
  }
  else{
    ans = K * X + (N - K) * Y;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#pragma warning(disable:4996)
using namespace std;
char tmp[100000];
int main() {
	int gs = 0, ps = 0, turn = 0;
	cin >> tmp;
	while (tmp[turn] != '\0') {
		if ('g' == tmp[turn]) ++gs;
		if ('p' == tmp[turn++]) ++ps;
	}
	turn = (gs - ps) / 2;
	cout << turn;
	return 0;
}

Measured memory_bytes: 384
import java.io.*;

class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));

			String[] line = br.readLine().split(" ");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			int c = Integer.parseInt(line[2]);

			if(c > b && b > a){
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
	}
}

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

using namespace std;
int n; long long  a[200005];
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    for(int i = 0; i < n; i++){
        cin>>a[i];
    }
    for(int i = 1; i < n; i++){
        a[i]+=a[i-1];
    }
    long long sum = a[n-1],ans=LONG_LONG_MAX;
    for(int i = 0 ; i < n-1; i++){
        ans = min(ans, abs(a[i]-(sum-a[i])));

    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int main(){
    int d,n;
    cin >> d >> n;
    int num=pow(100,d);
    int ans=num*n;
    if(n==100) ans+=num;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template <class T>
using V = vector<T>;
template <class T>
inline void chmin(T &a, const T &b) { a = min(a, b); }
template <class T>
inline void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
inline bool kbit(const T &x, const int &k) { return ((x >> k) & 1LL); }
inline int popcount(const int &n) { return __builtin_popcount(n); }
inline ll popcountll(const ll &n) { return __builtin_popcountll(n); }
inline ll mask(const ll &k) { return (1LL << k) - 1LL; }
template <class T>
void zip(V<T> &v) {
    sort(all(v));
    v.erase(unique(all(v)), v.end());
}
template <class T>
int lwb(V<T> &v, const T &x) { return lower_bound(all(v), x) - v.begin(); }
void dump() {
    cerr << '\n';
}
template <class Head, class... Tail>
void dump(Head &&head, Tail &&... tail) {
    cerr << head << (sizeof...(Tail) == 0 ? " " : ", ");
    dump(std::move(tail)...);
}
template <class T>
void print(const vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cout << v[i] << (i + 1 == v.size() ? '\n' : ' ');
}
template <class T>
void read(vector<T> &v) {
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}
constexpr char sp = ' ', newl = '\n';
constexpr int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll MOD = 1e9 + 7;
//////////////////////////////////////////////INSERT ABOVE HERE
int n, m;
int c[26];
int s[400][26];
int t[400];
void input() {
    cin >> n;
    m = 26;
    for (int i = 0; i < m; i++) cin >> c[i];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> s[i][j];
        }
    }
}
void output() {
    for (int i = 0; i < n; i++) {
        cout << t[i] + 1 << newl;
    }
}
int score(int en) {
    V<int> last(m, -1);
    int res = 0;
    for (int i = 0; i <= en; i++) {
        res += s[i][t[i]];
        last[t[i]] = i;
        for (int j = 0; j < m; j++) {
            res -= c[j] * (i - last[j]);
        }
    }
    return res;
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    input();
    for (int i = 0; i < n; i++) {
        cin >> t[i];
        --t[i];
        cout << score(i) << newl;
    }
}

Measured memory_bytes: 3672
/* Coached by rainboy */
#include <stdio.h>
#include <stdlib.h>

#define N 2000

int compare(const void *a, const void *b) {
	int ia = *(int *) a;
	int ib = *(int *) b;

	return ia - ib;
}

int main() {
	static int ll[N];
	int n, i, j, k, ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &ll[i]);
	qsort(ll, n, sizeof *ll, compare);
	ans = 0;
	for (i = 0; i < n; i++)
		for (j = k = i + 1; j < n; j++) {
			while (k < n && ll[i] + ll[j] > ll[k])
				k++;
			if (j + 1 < k)
				ans += k - j - 1;
		}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func stringifyArray(arr []int) string {
	return strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]")
}

func main() {
	scanner.Split(bufio.ScanWords)

	count := map[int]int{}

	sizeA := nextInt()
	for i := 0; i < sizeA; i++ {
		count[nextInt()]++
	}
	sizeB := nextInt()
	for i := 0; i < sizeB; i++ {
		count[nextInt()]++
	}
	// fmt.Println(count)

	keys := []int{}
	for k := range count {
		keys = append(keys, k)
	}
	sort.Ints(keys)
	for _, k := range keys {
		if count[k] > 1 {
			fmt.Println(k)
		}
	}
}



Measured memory_bytes: 29796
import math
n = int(input())
a_li = [int(w) for w in input().split()]

ans = 10**9
for a in a_li:
    # t = 0
    # while a % 2 == 0:
    #     a //= 2
    #     t += 1

    t = math.log2(a & -a)
    ans = min(ans, t)

print(int(ans))


Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
pair<int,int> r[100005];
int dep[100005],sz[100005];
bool del[100005];
void get(int node,int p)
{
	dep[node]=dep[p]+1;
	r[node]={-1e9,1e9};
	for (int u:v[node])
	{
		if (u!=p)
		get(u,node);
	}
}
int pre(int node,int p)
{
	sz[node]=1;
	for (int u:v[node])
	{
		if (u!=p && !del[u])
		sz[node]+=pre(u,node);
	}
	return sz[node];
}
int find(int node,int p,int nn)
{
	for (int u:v[node])
	{
		if (u!=p && !del[u] && sz[u]>nn/2)
		return find(u,node,nn);
	}
	return node;
}
void update1(int node,int p)
{
	for (int u:v[node])
	{
		if (u!=p && !del[u])
		{
			update1(u,node);
			r[node].first=max(r[node].first,r[u].first-1);
			r[node].second=min(r[node].second,r[u].second+1);
		}
	}
	if (r[node].first>r[node].second)
	{
		printf("No");
		exit(0);
	}
}
void update2(int node,int p)
{
	if (p)
	{
		r[node].first=max(r[node].first,r[p].first-1);
		r[node].second=min(r[node].second,r[p].second+1);
	}
	for (int u:v[node])
	{
		if (u!=p && !del[u])
		update2(u,node);
	}
}
void dfs(int node)
{
	int c=find(node,0,pre(node,0));
	update1(c,0);
	r[c].second=r[c].first;
	update2(c,0);
	del[c]=1;
	for (int u:v[c])
	{
		if (!del[u])
		dfs(u);
	}
}
int main()
{
	int n,q;
	scanf("%d",&n);
	for (int i=1;i<n;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		v[a].push_back(b);
		v[b].push_back(a);
	}
	get(1,0);
	scanf("%d",&q);
	set<int> s;
	while (q--)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		r[a]={b,b};
		s.insert((dep[a]+b)%2);
	}
	if (s.size()!=1)
	{
		printf("No");
		return 0;
	}
	dfs(1);
	printf("Yes");
	for (int i=1;i<=n;i++)
	printf("\n%d",r[i].first);
}

Measured memory_bytes: 12800
#include<iostream>
#include<cstdio>
using namespace std;
long long gcd(long long x,long long y)
{
	if(!y)return x;
	return gcd(y,x%y);
} 
int n;
long long ansx=1LL,ansy=1LL;
int main()
{
	scanf("%d",&n);
	while(n--)
	{
		long long x,y;
		scanf("%lld%lld",&x,&y);
		long long g=gcd(x,y);
		x/=g;y/=g;
		long long res=max((ansx+x-1)/x,(ansy+y-1)/y);
		ansx=x*res,ansy=y*res;
	}
	printf("%lld",ansx+ansy);
	return 0;
}

Measured memory_bytes: 256
import math
while True:
    try:
        n = int(raw_input())
    except EOFError:
        break
    if n == 0:
        break
    ls = map(int,raw_input().split())
    m = sum(ls)/float(n)
    
    tmp_tot = 0
    for k in range(n):
        tmp_tot += (ls[k]-m)**2/float(n)
    a = math.sqrt(tmp_tot)
    print a

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

int main() {
  long long h,w;
  cin>>h>>w;
  if(h==1||w==1)cout<<1<<endl;
  else if(h%2==0)cout<<(h/2)*w<<endl;
  else{long long a=(h+1)/2,b=(w-1)/2;
    if(w%2==0)cout<<(2*a-1)*(w/2)<<endl;
       else{cout<<(2*a-1)*b+a<<endl;
           }
      }
  
}


Measured memory_bytes: 256
#line 1 "/workspaces/compro/lib/template.hpp"


#line 1 "/workspaces/compro/lib/io/vector.hpp"
#include <iostream>
#include <vector>

#ifndef IO_VECTOR
#define IO_VECTOR

template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
  int size = v.size();
  for (int i = 0; i < size; i++) {
    std::cout << v[i];
    if (i != size - 1)
      std::cout << " ";
  }
  return out;
}

template <class T> std::istream &operator>>(std::istream &in, std::vector<T> &v) {
  for (auto &el : v) {
    std::cin >> el;
  }
  return in;
}

#endif
#line 4 "/workspaces/compro/lib/template.hpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes, T no) { cout << (val ? yes : no) << "\n"; }

void say(bool val, string yes = "Yes", string no = "No") { say<string>(val, yes, no); }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}

// C++ 17に完全移行したら消す
// 最大公約数を求める
template <class T> T gcd(T n, T m) { return n ? gcd(m % n, n) : m; }

// 最小公倍数を求める
template <class T> T lcm(T n, T m) {
  int g = gcd(n, m);
  return n * m / g;
}

// 重複を消す。計算量はO(NlogN)
template <class T> void unique(std::vector<T> &v) {
  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
}


#line 2 "aising2020_a.cpp"

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

  int l, r, d;
  cin >> l >> r >> d;
  int ans = 0;
  FOR(i, l, r + 1) {
    if (i % d == 0)
      ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)1e9+7;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,x,tmp,ans=1,cnt=0;
    cin>>n>>x;
    for(int i=0;i<n&&cin>>tmp;i++)
        cnt+=tmp,ans+=(cnt<=x);
    cout<<ans;
    return 0;
}



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

int main() {
	int wordcount[50][26];
	int minwordcount[26];
	int n; cin >> n;
	string s;
	for (int i = 0; i < 50; i++) {
		for (int j = 0; j < 26; j++) {
			wordcount[i][j] = 0;
		}
	}
	for (int j = 0; j < 26; j++) {
		minwordcount[j] = 1e9;
	}
	for (int i = 0; i < n; i++) {
		cin >> s;
		for (int j = 0; j < s.length(); j++) {
			wordcount[i][s[j] - 'a']++;
		}
	}
	for (int j = 0; j < 26; j++) {
		for (int i = 0; i < n; i++) {
			minwordcount[j] = min(wordcount[i][j], minwordcount[j]);
		}
	}
	vector<char>ans;
	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < minwordcount[i]; j++) {
			ans.push_back((unsigned char)i + 'a');
		}
	}
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(){
  int i,j,n,m,k,a[50],b[50],c[50],d[50];
  scanf("%d%d",&n,&m);
  for(i=0;i<n;i++) scanf("%d%d",&a[i],&b[i]);
  for(i=0;i<m;i++) scanf("%d%d",&c[i],&d[i]);
  for(i=0;i<n;i++){
    int r=4e8;
    for(j=0;j<m;j++){
      if(r>abs(a[i]-c[j])+abs(b[i]-d[j])){
        r=abs(a[i]-c[j])+abs(b[i]-d[j]);
        k=j;
      }
    }
    printf("%d\n",k+1);
  }
  return 0;
}

Measured memory_bytes: 128
import sys
input = sys.stdin.readline


def read():
    N = int(input().strip())
    A = map(int, input().strip().split())
    return N, A


def solve(N, A):
    b = [0 for i in range(10**5+2)]
    for a in A:
        b[a-2] += 1
        b[a-1] += 1
        b[a] += 1
    return max(b)


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))


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

using namespace std;

int main()
{
	int N;	cin >> N;
	vector<long long int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
	}

	long long int total = 0;
	long long int n = A.at(0);

	for (int i = 1; i < N; i++) {
		
		if (n > A.at(i)) {
			total += n - A.at(i);
		}
		n = max(n, A.at(i));
	}

	cout << total << endl;
	return 0;
}

Measured memory_bytes: 4844
import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	String line = sc.nextLine();
      	String[] num = line.split("");
      	
      	int count = 0;
      	if(num[0].equals("1")){
        	count++;
        }
      	if(num[1].equals("1")){
        	count++;
        }
      	if(num[2].equals("1")){
        	count++;
        }
      System.out.println(count);
    }
}

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

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  rep(i,n){cin >> x[i];}
  
  int min = 0;
  for(int i = 1; i <= 100; i++){
    int tmpMin = 0;
    rep(j,n){
      tmpMin += pow((x[j]-i),2);
    }
    if(i==1){
      min = tmpMin;
    }else{
      if(min>tmpMin) min = tmpMin;
    }
  }
  cout << min << endl;
}


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

int main(){
    int m1, d1, m2, d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if(m1 != m2) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <typeinfo>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <chrono>
using namespace::std;

int main()
{

    //x, yを受け取る
    int x, y;
    cin >> x >> y;

    //cout << x << " " << y << endl;

    //x + (y/2) の値段を出力する
    cout << x + (y / 2) << endl;


    return 0;
}

Measured memory_bytes: 256
// Gaurav Nuti
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii > vii;
typedef vector<pll > vll;
#define pb push_back
#define mp make_pair 
#define ar array
#define mod 1000000007
#define F first
#define S second
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
#define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define debug_arr(a,n) {{for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}cout<<"\n";}}
#define INF 1e9 

ll power(ll x, ll y) 
{ 
    ll res = 1;   
    while (y > 0) { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1;
        x = (x*x)%mod; 
    } 
    return res%mod; 
}

ll power_without_mod(ll x, ll y) 
{ 
    ll res = 1;   
    while (y > 0) { 
        if (y & 1) 
            res = (res*x); 
        y = y>>1;
        x = (x*x); 
    } 
    return res; 
}

bool comparep(pair<ll, ll> i1, pair<ll, ll> i2){
	return (i1.S < i2.S);
} 

ll modInverse(ll a)
{
    return power(a , mod - 2);
}

vector< vector<ll>> graph;
vector<ll> num;
vector<bool> visited;
vector<ll> dist;

void bfs(int u){
    queue<ll> q;
    q.push(u);
    visited[u] = 1;
    while(!q.empty()){
        int u1 = q.front();
        q.pop();
        for(auto i = graph[u1].begin();i!=graph[u1].end();i++){
            num[*i]--;
            dist[*i] = max(dist[u1] + 1,dist[*i]);
            if(!visited[*i] && num[*i] == 0){
                visited[*i] = 1;
                q.push(*i);
            }
        }
    }
}

// int next_lunlun(ll n){
//     vector<int> digits;
//     while(n){
//         digits.pb(n%10);
//         n /= 10;
//     }
//     // reverse(digits.begin(),digits.end());
//     ll num_digits = digits.size(); 
//     int count_9 = 0;
//     for(int i: digits)
//         if(i == 9)
//             count_9++;
//     if(count_9 == num_digits)
//         return ;
//     for(int i=0;i<(num_digits-1);i++){
//         if(digits)
//     }
// }

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
    #endif  
	
    ll t;
    // cin>>t;
    t = 1;
    for(ll z=0;z<t;z++){
        ll n,m;
        cin>>n>>m;
        graph.assign(n,vector<ll>());
        num.assign(n,0);
        visited.assign(n,0);
        dist.assign(n,0);
        for(ll i=0;i<m;i++){
            ll a,b;
            cin>>a>>b;
            a--;b--;
            num[b] ++;
            graph[a].pb(b);
        }
        for(ll i = 0;i<n;i++){
            if(num[i] == 0 && !visited[i])
                bfs(i);
        }
        ll ans = 0;
        for(ll i=0;i<n;i++){
            ans = max(ans,dist[i]);
        }
        cout<<ans;
    }
}

Measured memory_bytes: 10200
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<bitset>
#include<map>
#include<math.h>
#include<cstring>
#include<string>
#include<stack>
#include<algorithm>
typedef long long LL; 
using namespace std;
const int maxn=10005;
const int INF=999999999;
bitset<1000000001> a;

int main(){
	int n;
	cin>>n;
	int t;
	while(n--){
		cin>>t;
		a[t]=a[t]==1?0:1;
	}
	cout<<a.count()<<endl;
	return 0;
}            

Measured memory_bytes: 122112
#include <bits/stdc++.h>
using namespace std;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
void shot(const int ax,const int ay,vector<string>&field,int way){
    int nextx=ax;
    int nexty=ay;
    while(true){
        nextx+=dx[way];
        nexty+=dy[way];
        char& ch(field[nexty][nextx]);
        if(ch=='.')continue;
        else if(ch=='*'){
            ch='.';
            return;
        }else if(ch=='#'){
            return;
        }else if(ch=='-')continue;
        else{
            assert(false);
        }
    }
}
int main(){
    int T;cin>>T;
    while(T--){
        int H,W;cin>>H>>W;
        H+=2;
        W+=2;
        vector<string>field(H);
        field[0]=string(W,'#');
        for(int i=0;i<H-2;++i){
            string st;cin>>st;
            field[i+1]="#"+st+"#";
        }
        field[H-1]=string(W,'#');
        int way;
        int tank_x,tank_y;
        string way_mp="<v>^";
        {
            for(int y=0;y<H;++y){
                for(int x=0;x<W;++x){
                    char ch=field[y][x];
                    if(way_mp.find(ch)!=-1){
                        way=way_mp.find(ch);
                        field[y][x]='.';
                        tank_x=x;
                        tank_y=y;
                    }
                }
            }
        }
        int N;cin>>N;
        string move_st;
        cin>>move_st;

        for(auto ch:move_st){
            string move_mp("LDRUS");
            int k=move_mp.find(ch);
            if(k==4){
                shot(tank_x,tank_y,field,way);
            }else{
                way=k;
                int next_tank_x=tank_x+dx[way];
                int next_tank_y=tank_y+dy[way];
                if(field[next_tank_y][next_tank_x]=='.'){
                    tank_x=next_tank_x;
                    tank_y=next_tank_y;
                }
            }
        }
        field[tank_y][tank_x]=way_mp[way];
        for(int i=1;i<H-1;++i){
            cout<<field[i].substr(1,W-2)<<endl;
        }
        if(T)cout<<endl;
        
    }
    return 0;

}

Measured memory_bytes: 3160
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,q;
	string s;
	cin>>n>>q;
	cin>>s;
	int l[n],r[n];
	for(int i=0;i<q;i++){
		cin>>l[i];
		cin>>r[i];
	}
	int a[100000],k=0;
	a[0]=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='A'&&s[i+1]=='C'){
			a[i+1]=a[i]+1;
		}
		else{
			a[i+1]=a[i];
		}
	}
	for(int i=0;i<q;i++){
		cout<<a[r[i]-1]-a[l[i]-1]<<endl;
	}
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    int x,y; cin >> x >> y;

    int ans = 0;

    if(x == 1) ans += 300000;
    if(x == 2) ans += 200000;
    if(x == 3) ans += 100000;

    if(y == 1) ans += 300000;
    if(y == 2) ans += 200000;
    if(y == 3) ans += 100000;

    if(x == 1 && y == 1) ans += 400000;

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 892
#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 <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
using namespace std;
int main(){
    int n;
    cin >> n;
    if(n<2) cout << 1 << endl;
    else if(n<4) cout << 2 << endl;
    else if(n<8) cout << 4 << endl;
    else if(n<16) cout << 8 << endl;
    else if(n<32) cout << 16 << endl;
    else if(n<64) cout << 32 << endl;
    else cout << 64 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
// 素集合データ構造
struct UnionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
    rep(i,n) par[i] = i;
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // 既に同じ木に属しているならマージしない
    if (x == y) return;

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
  }

  // 2つのデータx, yが属する木が同じならtrueを返す
  bool same(int x, int y) {
    return find(x) == find(y);
  }

  // データxが含まれる木の大きさを返す
  ll size(ll x) {
    return sizes[find(x)];
  }
};

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll n, m;
  cin >> n >> m;
  UnionFind tree(n);
  ll ans = 0;
  rep(i,m) {
    ll x, y;
    cin >> x >> y;
    tree.unite(x-1,y-1);
  }
  rep(i,n) {
    ans = max(ans, tree.size(i));
  }
  cout << ans << '\n';

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

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

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

  string s;
  rep(i, h) {
    cin >> s;
    cout << s << endl;
    cout << s << endl;
  }
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){

  int ox,oy,nx,ny;
  cin >> ox >> oy >> nx >> ny;
  string s = "";
  REP(i,ny-oy)s += 'U';
  REP(i,nx-ox)s += 'R';
  REP(i,ny-oy)s += 'D';
  REP(i,nx-ox)s += 'L';
  s += 'L';
  nx++,ny++;
  REP(i,ny-oy)s += 'U';
  REP(i,nx-ox)s += 'R';
  s += 'D';
  s += 'R';
  REP(i,ny-oy)s += 'D';
  REP(i,nx-ox)s += 'L';
  s += 'U';
  cout << s << endl;





  

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

string t, ans;

int main(void) {
    cin >> t;
    int n = sz(t);
    rep(i, 0, n) {
        if (t[i]=='?') t[i] = 'D';
    }

    cout << t << "\n";
    return 0;
}



Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define LL long long

using namespace std;

int a[100005],dp[100005],k;
int solve(int x) {
    if (x<1) return MOD;
    if (x==1) return 0;
    if (dp[x]!=-1) return dp[x];
    int ans=MOD;
    for (int i=1;i<=k;i++) {
        if ((x-i)>=1) ans=min(ans,solve(x-i)+abs(a[x]-a[x-i]));
    }
    return dp[x]=ans;
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n >> k;
    for (int i=1;i<=n;i++) cin >> a[i];
    memset (dp,-1,sizeof(dp));
    cout << solve(n) << endl;
    return 0;
}


Measured memory_bytes: 5760
import math

while True:
    n = int(raw_input())
    if n == -1:
        break
    r, theta = 1.0, 0.0
    for i in range(n-1):
        r = math.sqrt(r**2 + 1.0)
        theta += math.asin(1.0/r)
    print r*math.cos(theta)
    print r*math.sin(theta)

Measured memory_bytes: 4464
#include <stdio.h>
#define n 4
#define m 2
int main(void)
{
	int a[n],b[m],c=0;
	int i,j;
	int temp;
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	for(i=0;i<m;i++)scanf("%d",&b[i]);
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			if(a[i]<a[j]){
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
			}
		}
	}
	if(b[0]<b[1])b[0]=b[1];
	for(i=0;i<n-1;i++)c+=a[i];
	c+=b[0];
	printf("%d\n",c);
	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector < long long > vll;
typedef pair < long long, long long > pll;
typedef pair < int, int > pii;
typedef vector < int > vi;
typedef vector<vector<int>> vvi;
#define deb(x) cout << #x << " : " << x << endl
#define deb2(x , y) cout << #x << " : " << x << " , "<< #y << " : " << y << endl
#define debv(x) for(auto i=x.begin();i!=x.end();i++) cout<<*i<<' ';cout<<endl
#define debvv(x) for(auto j=x.begin();j!=x.end();j++) { for(auto i=(*j).begin();i!=(*j).end();i++) cout<<*i<<' ';cout<<endl;}cout<<endl
#define debp(x) for(auto i=x.begin();i!=x.end();i++) cout<<i->first<<':'<<i->second<<' ';cout<<endl
#define rsz(x,n) x.clear(); x.resize(n)
#define rrsz(x,a,n) x.clear(); x.resize(n,a)
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,a,n) for(int i = a; i < n; i++)
#define wt while(true)
#define all(x) x.begin(),x.end()
#define pb push_back
#define csl ios_base::sync_with_stdio(false); cin.tie(NULL)
#define INF (1e9 + 7)
#define endl '\n'

void solve() {
	string s,t,ans="";
	cin>>s>>t;
	int n=s.size(),m=t.size();
	vvi dp(n+1,vi(m+1,0));
	reps(i,1,n+1){
		reps(j,1,m+1){
			if(s[i-1]==t[j-1]){
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
    //debvv(dp);
  	int x=n,y=m;
  	while(x!=0 && y!=0){
  		if(dp[x-1][y]==dp[x][y]){
  			--x;
  		}
  		else if(dp[x][y-1]==dp[x][y]){
  			--y;
  		}
  		else{
  			ans=t[y-1]+ans;
          	x--;
          	y--;
  		}
  	}
  	cout<<ans;
}

int main() {
	csl;
	int testcase=1;
//	cin >> testcase;
	for (int i = 0; i < testcase; i++) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 38852
#include<bits/stdc++.h>
using namespace std;
int kai(int n){
  if(n==0)return 1;
  if(n==1)return 1;
  if(n==2)return 2;
  if(n==3)return 6;
  if(n==4)return 24;
  if(n==5)return 120;
  if(n==6)return 720;
  if(n==7)return 5040;
  else return 40320;
}

int main(){
  int n;
  cin >> n;
  vector<int>p(n);
  vector<int>q(n);

  int i,j;
  for(i=0;i<n;i++){
    cin >> p[i];
  }
  for(j=0;j<n;j++){
    cin >> q[j];
  }
   long a,b;
   a = 0;
   b = 0;
   vector<bool>pdeta(n+1,false);
   vector<bool>qdeta(n+1,false);

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

     for(j=1;j<p[i];j++){
       if(!pdeta[j])tmp++;
     }

     a += tmp * kai(n-i-1);
     tmp = 0;
     pdeta[p[i]] = true;

     for(j=1;j<q[i];j++){
       if(!qdeta[j])tmp++;
     }
     b += tmp * kai(n-i-1);
     tmp = 0;

     qdeta[q[i]] = true;





   }
   cout << abs(a-b) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long int
pair<ll,ll> p[101];
long long int dp[101][100007];
int main(){
  int n,w;
  cin >> n >> w;
  for(int i=0;i<n;i++){
    cin >> p[i].f >> p[i].s;
  }
  memset(dp,0,sizeof(dp));
  for(int i=1;i<=n;i++){
    for(int j=0;j<=w;j++){
      if(j>=p[i-1].f){
        dp[i][j] = max(dp[i-1][j], dp[i-1][j-p[i-1].f]+p[i-1].s);
      }
      else{
        dp[i][j] = dp[i-1][j];
      }
    }
  }
  cout << dp[n][w] << endl;
}


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

int main(){
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B;
  int a;
  for(int j=0; j<M; j++){
    scanf("%d", &a);
    B.push_back(a);
  }
  int correct=0;
  for(int i=0; i<N; i++){
    int sum=0;
    for(int j=0; j<M; j++){
      scanf("%d", &a);
      sum += a*B[j];
    }
    if(sum + C > 0){
      correct++;
    }
  }
  cout << correct << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int n;
double dp[4096][4096], p[4096];
int vis[4096][4096];
 
double calc(int pos, int heads) {
    if(heads < 0) return 0;
    double &y = dp[pos][heads];
    if(vis[pos][heads]) return y;
    vis[pos][heads] = 1;
    if(pos == 0) return y = (heads == 0);
    return y = p[pos] * calc(pos-1, heads-1) + (1-p[pos])*calc(pos-1, heads);
}
 
int main() {
	cin >> n;
	for(int i=1; i<=n; ++i) {
	    cin >> p[i];
	}
	double ans = 0;
	for(int i=(n+1)/2; i<=n; ++i) {
	    ans += calc(n, i);
	}
	cout << fixed << setprecision(11) << ans << endl;
	return 0;
}

Measured memory_bytes: 126752
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define m 1000000007
int main()
{
	ll a,b;
	cin>>a>>b;
	if(a>b)
		swap(a,b);
	ll x=2;
	ll val=b;
	while(1)
	{
		if(val%a==0)
			break;
		 val=b*x;
		x++;
		//cout<<x<<endl;

	}
	cout<<val<<endl;

}

Measured memory_bytes: 256