akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
   int n;cin>>n;
   vector<vector<int>> t(n,vector<int>(n,-1));
   rep(i,n){
       int a;cin>>a;
       rep(j,a){
           int x,y;cin>>x>>y;x--;
           t[i][x]=y;
       }
   }
   int res=0;
   for(int tmp=0;tmp<(1<<n);tmp++){
       vector<bool> f(n,false);
       int x=tmp,now=0;
       rep(i,n){
           if(x%2!=0){
               f[i]=true;
               now++;
           }
           x/=2;
       }
       bool ok=true;
       rep(i,n){
           if(!f[i])continue;
           rep(j,n){
               if(f[j]&&t[i][j]==0)ok=false;
               if(!f[j]&&t[i][j]==1)ok=false;
           }
       }
       if(ok){
           //rep(i,n)cout<<f[i]<<endl;
           chmax(res,now);
       }
   }
   cout<<res<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n, i, count[] = new int[26];
        String str = "", str1="", eng = "abcdefghijklmnopqrstuvwxyz";
        char c;
        
        while(scan.hasNext()){
            str1=scan.next();
            str+=str1;
        }
        str = str.toLowerCase();
        n = str.length();
        for (i = 0; i < 26; i++){
            count[i] = 0;
        }
        for (i = 0; i < n; i++){
            c = str.charAt(i);
            switch(c) {
            case 'a':
                count[0]++;
                    break;
                    case 'b':
                count[1]++;
                    break;
                    case 'c':
                count[2]++;
                    break;
                    case 'd':
                count[3]++;
                    break;
                    case 'e':
                count[4]++;
                    break;
                    case 'f':
                count[5]++;
                    break;
                    case 'g':
                count[6]++;
                    break;
                    case 'h':
                count[7]++;
                    break;
                    case 'i':
                count[8]++;
                    break;
                    case 'j':
                count[9]++;
                    break;
                    case 'k':
                count[10]++;
                    break;
                    case 'l':
                count[11]++;
                    break;
                    case 'm':
                count[12]++;
                    break;
                    case 'n':
                count[13]++;
                    break;
                    case 'o':
                count[14]++;
                    break;
                    case 'p':
                count[15]++;
                    break;
                    case 'q':
                count[16]++;
                    break;
                    case 'r':
                count[17]++;
                    break;
                    case 's':
                count[18]++;
                    break;
                    case 't':
                count[19]++;
                    break;
                    case 'u':
                count[20]++;
                    break;
                    case 'v':
                count[21]++;
                    break;
                    case 'w':
                count[22]++;
                    break;
                    case 'x':
                count[23]++;
                    break;
                    case 'y':
                count[24]++;
                    break;
                    case 'z':
                count[25]++;
                    break;
                default:
                    break;
            }
        } 
        for (i = 0; i < 26; i++) {
            System.out.println(eng.charAt(i) + " : " + count[i]);
        }
    }
}



Measured memory_bytes: 26748
#include <bits/stdc++.h>
using namespace std;
#define int long long   // aaaaaaaaaaaaaaaaaa
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define in(s,x) s.find(x) != s.end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<pair<int,int>> VPII;
const ll mod=1000000007;
const ll INF= 1LL<<60-1;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
template<class T> 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; }
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var)
{os << pair_var.first << " " << pair_var.second ;return os;}
template<class tContainer>
long long sum(tContainer const& iContainer) {return  std::accumulate(std::begin(iContainer), std::end(iContainer), 0LL);}

// head


int m,n,k,res,tmp,tmp2,tmp3,h,w,x,y;
VI a;
deque<PII> que;
string s;
VI b;
vector<PII> g[2100600];
//int b[2100000];
int c[2100000] = {};
int d[2100000] = {};
int dp[2020]={};
    int dp2[2020] = {};
//set<int> ch;


signed main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>s;
  n = s.length();
  res = 0;
  rep(i,0,n){
    dp[0] += 1;
    rep(j,0,2019){
      dp2[(j*10+((int)s[i]-(int)'0'))%2019] += dp[j];
    }
    rep(j,0,2019){
      dp[j] =  dp2[j];
      dp2[j] = 0;
    }
    res += dp[0];
  }
  cout << res << '\n';
}



Measured memory_bytes: 53020
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a.at(i);
	}

	sort(a.begin(), a.end());

	int x = a.at(0);
	int y = inf;
	while (1)
	{
		for (int i = 0; i < n; i++)
		{
			if (a.at(i) % x > 0)
			{
				if (y > a.at(i) % x)
				{
					y = a.at(i) % x;
				}
			}
		}

		if (x == y)
		{
			break;
		}

		x = y;
	}
	cout << x << endl;
}

Measured memory_bytes: 640
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif
using namespace std;

int main() {
  int a, b, t;
  cin >> a >> b >> t;
  cout << b * (t/a) << "\n";
    return 0;
}


Measured memory_bytes: 3488
#include<iostream>
#include<cstdio>


using namespace std;

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


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


int main(){
    string s;cin>>s;
    int size=s.size();
    int num_A,num_Z;
    for(int i=0;i<size;i++){
        if(s[i]=='A'){
            num_A=i;
            break;
        }
    }
    for(int i=0;i<size;i++){
        if(s[s.size()-1-i]=='Z'){
            num_Z=s.size()-1-i;
            break;
        }
    }
    cout<<num_Z-num_A+1<<endl;

    return 0;
    
}

Measured memory_bytes: 640
//----------------------------おまじない
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")
//----------------------------
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REPN(i,n) for (int i=(n);i>=0;i--)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#define eb(i,j) emplace_back((i),(j))
#include <bits/stdc++.h>
using namespace std;
//------------------------------typedef集
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<vvi> vvvi;
typedef long long ll;
const int mod = 1000000009;

int n,a;
ll tmp,ret;
map<ll,ll> s;

int main(){
    I(n);
    s[0] = 1;
    REP(i,n) {
        I(a);
        tmp += a;
        s[tmp] += 1;
    }
    for (auto j: s){
        ll jv = j.second;
        ret += (jv-1)*jv/2;
    }
    cout << ret << endl;
}



Measured memory_bytes: 12800
/***
**   AUTHOR::ASHUTOSH MOUDGIL
***/


#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define int long long
//#define ll long long
#define all(x) x.begin(),x.end()
#define rsort(x) sort(all(x)); reverse(all(x));
#define endl '\n'
#define vi vector<int>
#define vlli vector<long long>
#define pii pair<int,int>
#define mod 1000000007
#define LMAX 1e18
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define PI 3.141592654
#define deb1(x) cout << #x <<"="<< x <<endl;
#define deb2(x,y) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<endl;
#define deb3(x,y,z) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<<endl;
#define deb4(x,y,z,a) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<< ", "<<#a <<"="<<a << endl;
#define debarr(x) cout << #x<<"::"<<endl;for(int i : x){cout << i <<" ";} cout <<endl;

inline void add(int& a, int b){a = (a+b); if(a>=mod)a-=mod;}
inline void sub(int& a, int b){a = a-b; if(a<0)a+=mod;}
//inline void mul(int& a, int b){a = (a*b)%mod;}

int n,k;
int grid[51][51];

struct M{
    int s;
    vector<vector<int>> t;
    M(int x){
        s = x;
        t.resize(s,vector<int>(s,0));
    }
};

M mul(M& a, M& b){

    M c =  M(a.s);
    int s = a.s;
    for(int i=0;i<s;i++){
        for(int j=0;j<s;j++){
            for(int k=0;k<s;k++){
                c.t[i][j] =(c.t[i][j] +  (a.t[i][k]*b.t[k][j])%mod)%mod;
            }
        }
    }
    //a.t = c.t;
    return c;
}



void mymain(){
    cin >> n >> k;
    M I(n),I1(n);

   // vector<vector<int>> I(n,vector<int>(n,0));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin >> grid[i][j];
            I.t[i][j] = grid[i][j];
        }
    }
 /*   cout << "I :"<<endl;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout << I.t[i][j] <<" ";
        }
        cout << endl;
    }*/
    int kk = k;
    for(int i=0;i<n;i++){
            I1.t[i][i]=1;
    }
    while(kk > 0){
        if(kk&1){
           I1 = mul(I1,I);
        }
        I = mul(I,I);
        kk /= 2;
    }

    vi dp(n,1);
    vi dp1(n);
    for(int i=0; i<n;i++){
        dp1[i]=0;
        for(int j=0;j<n;j++){
            dp1[i] = (dp1[i] + (dp[j]*I1.t[j][i])%mod)%mod;
        }
    }
    /*debarr(dp);
    debarr(dp1);
    cout << "I1 :"<<endl;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout << I1.t[i][j] <<" ";
        }
        cout << endl;
    }

    /*
    for(int i=0;i<k;i++){
        vi dp1(n,0);
        for(int u=0;u<n;u++){
            for(int v=0;v<n;v++){
                if(grid[u][v]){
                  dp1[v] = dp1[v] + dp[u];
                }
            }
        }
        dp = dp1;
    }
    //debarr(dp);*/
    int ans=0;
    for(int i : dp1)
        ans = (ans + i)%mod;
    cout << ans << endl;
}

signed main(){
IOS;
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
int t=1;
//cin>>t;

for(int tt=0;tt<t;tt++){
   ///cout << "Case #" << tt+1 <<": ";
   mymain();
   }
return 0;
}
/*

*/


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int N;
int A[2<<17],B[2<<17];


int main() {
	cin>>N;
	for(int i=0;i++<N;)cin>>A[i];
	int ans=0;
	for (int i=N;i;i--) {
		int cnt=0;
		for (int j=i;j<=N;j+=i) cnt+=B[j];

		if(cnt%2!=A[i]%2) {
			B[i]++;
			ans++;
		}
	}
	cout<<ans<<endl;
	for(int i=0;i++<N;)if(B[i])cout<<i<<" ";
	cout<<endl;
}


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

using namespace std;

int main()
{
    char a[3000];
    char b[3000];
    scanf("%s",a);
    scanf("%s",b);
    
    int m = strlen(a);
    int n = strlen(b);
    int L[m+1][n+1];
    for(int i = 0 ; i <= m ; i++)
    {
        for(int j = 0 ; j <= n ; j++)
        {
            if( i == 0 || j == 0)
                L[i][j] = 0;
            else if(a[i-1] == b[j-1])
                L[i][j] = 1 + L[i-1][j-1];
            else
                L[i][j] = max(L[i-1][j],L[i][j-1]);
        }
    }
    int index = L[m][n];
    char lcs[index+1];
    lcs[index] = '\0';
    
    int i = m;
    int j = n;
    while(i > 0 && j > 0)
    {
        if(a[i-1] == b[j-1])
        {
            i--;
            j--;
            index--;
            lcs[index] = a[i];
        }
        else if(L[i-1][j] > L[i][j-1])
        {
            i--;
        }
        else
            j--;
    }
    printf("%s",lcs);
}

Measured memory_bytes: 35456
a,b = map(int,input().split())

def XOR(x):
  if x%4 == 0:
    return x
  elif x%4 == 1:
    return 1
  elif x%4 == 2:
    return x+1
  else:
    return 0

print(XOR(max(0,a-1))^XOR(b))

Measured memory_bytes: 2940
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define grt() greater<int>()
#define grtl() greater<long long>()

int main()
{
    string s;

    cin >> s;

if(s == "ABC") {
    cout << "ARC" << endl;
} else {
    cout << "ABC" << endl;

}
}

    

Measured memory_bytes: 3624
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
	int h,w,n; scanf("%d%d%d",&h,&w,&n);
	int x=max(h,w),y=n/x;
	if(n%x==0) printf("%d",y);
	else printf("%d",y+1);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#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()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
  int A, B;
  cin >> A >> B;
  cout << A * B << endl;
  return 0;
}

Measured memory_bytes: 3612
length, req = map(int, input().split(" "))
target = []
for i in range(req):
    s, e = map(int, input().split(" "))
    target.append([s, e])
target.sort(key = lambda x: x[1])
answer = 0
before_e = -1
for s, e in target:
    # print(before_e, s, e)
    if s < before_e:
        answer += 1
    else:
        before_e = e
print(req - answer)

Measured memory_bytes: 21336
// ABC_119_A

#include <iostream>
using namespace std;

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

  string tmp = "2019/04/30";

  if (s <= tmp) cout << "Heisei" << "\n";
  else cout << "TBD" << "\n";

  return 0;
  
}


Measured memory_bytes: 3524
#include<bits/stdc++.h>
#define N 100005
#define LL long long
#define mod 1000000007
#define pr pair<int,int>
#define mp(x,y) make_pair(x,y)
using namespace std;

LL read(){
	char c=getchar();
	LL t=0,f=1;
	while(c>'9'||c<'0') f=(c=='-')?-1:1,c=getchar();
	while(c>='0'&&c<='9') t=t*10+c-'0',c=getchar();
	return t*f;
}

int n,Q;
LL a[N],dt[N],t[N],now,tp;

int find(LL v,int lim){
	int l=0,r=lim,mid,ret=0;
	while(l<=r) (a[mid=(l+r)>>1]<=v)?(ret=mid,l=mid+1):(r=mid-1);
	return ret;
}

int main(){
	n=read(),Q=read(),a[++tp]=n;
	for(int i=1;i<=Q;i++){
		LL x=read();
		while(x<=a[tp]) tp--;
		a[++tp]=x; 
	}
	t[tp]=1;
	for(int i=tp;i;i--){
		LL res=a[i],po=find(res,i-1);
		for(;po;po=find(res,po-1)) t[po]+=(res/a[po])*t[i],res%=a[po];
		dt[1]+=t[i],dt[res+1]-=t[i];
	}
	for(int i=1;i<=n;i++) printf("%lld\n",(now+=dt[i]));
}

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

int main() {
    int n; cin >> n;
    vector<int> r(n);
    rep(i, n) cin >> r[i];
    int maxv = r[1]-r[0];
    int minv = r[0];
    for (int i = 1; i < n; i++) {
        maxv = max(maxv, r[i] - minv);
        minv = min(minv, r[i]);
    }
    cout << maxv << endl;
}


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

typedef long long ll;

int comb[1001][1001] = {};
const int mod = 1e6;
vector<int> v[1000];
int csum[1000] = {};
vector<ll> dp(1000, 1);

void f(int u){
    for(int child : v[u]){
        f(child);
        (dp[u] *= comb[csum[u]+csum[child]][csum[u]] * dp[child]) %= mod;
        csum[u] += csum[child];
    }
    csum[u]++;
}

int main(){
    comb[0][0] = 1;
    for(int i = 1; i <= 1000; i++){
        for(int j = 0; j <= i; j++){
            comb[i][j] += comb[i-1][j];
            if(j)   comb[i][j] += comb[i-1][j-1];
            comb[i][j] %= mod;
        }
    }
    int n;
    cin >> n;
    vector<bool> lose(n, 0);
    for(int i = 0; i < n-1; i++){
        int a, b;
        cin >> a >> b;
        a--, b--;
        v[a].push_back(b);
        lose[b] = true;
    }
    for(int i = 0; i < n; i++){
        if(!lose[i]){
            f(i);
            cout << dp[i] << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 7128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>
#include <stack>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator<< (ostream &out, const vector<int> &b) {
    for (auto k : b) out << k << " ";
    return out;
}

istream& operator>> (istream& in, pii& b) {
    in >> b.first >> b.second;
    return in;
}

ostream& operator<< (ostream& out, const pii& b) {
    out << "{" << b.first << ", " << b.second << "}";
    return out;
}

template <typename T1, typename T2> inline bool chkmin(T1 &x, const T2 &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T1, typename T2> inline bool chkmax(T1 &x, const T2 &y) {if (x < y) {x = y; return 1;} return 0;}


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 10;
#else
    #define dbg(x) 57
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 179;
#endif

const ld PI = acos(-1);

#define time clock() / (double) CLOCKS_PER_SEC

// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,sse3,sse4")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("avx2")  
// #pragma GCC optimize("section-anchors")
// #pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
// #pragma GCC optimize("vpt")
// #pragma GCC optimize("rename-registers")
// #pragma GCC optimize("move-loop-invariants")
// #pragma GCC optimize("unswitch-loops")
// #pragma GCC optimize("function-sections")
// #pragma GCC optimize("data-sections")

mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());
 
const int MAXN = 2e5 + 10;
const int K = 20;

int n, l, q;
int a[MAXN], up[MAXN][K];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    cin >> l >> q;
    int ptr = 0;
    for (int i = 0; i < n; i++) {
        while (ptr < n - 1 && a[ptr + 1] - a[i] <= l) {
            ptr++;
        }
        up[i][0] = ptr;
    }
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 1; j < K; j++) {
            up[i][j] = up[up[i][j - 1]][j - 1];
        }
    }
    for (int i = 0; i < q; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        if (x > y) swap(x, y);
        int ans = 0;
        for (int i = K - 1; i >= 0; i--) {
            if (up[x][i] < y) {
                ans += (1 << i);
                x = up[x][i];
            }
        }
        cout << ans + 1 << "\n";
    }
}
/*

*/

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

int main(void) {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  vector<char> s; int i = 0;
  rep(i,ty-sy) s.push_back('U');
  rep(i,tx-sx) s.push_back('R');
  rep(i,ty-sy) s.push_back('D');
  rep(i,tx-sx) s.push_back('L');
  s.push_back('L');
  rep(i,ty-sy+1) s.push_back('U');
  rep(i,tx-sx+1) s.push_back('R');
  s.push_back('D');
  s.push_back('R');
  rep(i,ty-sy+1) s.push_back('D');
  rep(i,tx-sx+1) s.push_back('L');
  s.push_back('U');
  rep(i,s.size()) cout << s.at(i);
  cout   << endl;
}

Measured memory_bytes: 3588
def solve(n, a, b, p):
    v = [0] * 3
    for i in range(n):
        if p[i] <= a:
            v[0] += 1
        elif p[i] <= b:
            v[1] += 1
        else:
            v[2] += 1
    return min(v)

n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
print(solve(n, a, b, p))

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

bool check(int num, set<int> primes) {
  for (auto p: primes) {
    if (num % p == 0) {
      return false;
    }
    if (p * p > num) {
      return true;
    }
  }
  return true;
}
int main() {
  int q;
  cin>>q;

  set<int> numbers;
  set<int> primes;
  primes.insert(2);
  for (int i=3; i<1e5+1; i+=2) numbers.insert(i);
  while (!numbers.empty()) {
    int p = *numbers.begin();
    primes.insert(p);
    int max_n = *numbers.rbegin();
    numbers.erase(p);
    int tmp = 3*p;
    while (tmp <= max_n) {
      if (numbers.find(tmp) != numbers.end()) {
        numbers.erase(tmp);
      }
      tmp += 2*p;
    }
  }
  int acc[(int)1e5+1];
  acc[0] = acc[1] = acc[2] = 0;
  for (int i=0; i<1e5+1; i++) {
    if (i % 2 == 0) {
      acc[i] = acc[i-1];
      continue;
    }
    if (primes.find(i) == primes.end()) {
      acc[i] = acc[i-1];
      continue;
    }
    if (primes.find((i + 1) / 2) == primes.end()) {
      acc[i] = acc[i-1];
      continue;
    }
    acc[i] = acc[i-1] + 1;
  }

  for (int i=0; i<q; i++) {
    int l, r;
    cin>>l>>r;
    cout<<acc[r] - acc[l-1]<<endl;
  }
}

Measured memory_bytes: 3328
ans = []
def dfs(i, pre, now):
    global ans
    ans.append(now)
    if i > 10:
        return
    dfs(i + 1, pre, now * 10 + pre)
    if pre + 1 < 10:
        dfs(i + 1, pre + 1, now * 10 + pre + 1)
    if pre - 1 > -1:
        dfs(i + 1, pre - 1, now * 10 + pre - 1)

k = int(input())
for i in range(1, 10):
    dfs(1, i, i)
ans.sort()

print(ans[k - 1])



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

template<class T>
void print_vec(const vector<T>& v) {
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << " ";
	cout << "\n";
}

vector< pair<int, int> > majority(vector<int>& nums) {
	map<int, int> cnt;
	vector< pair<int, int> > ans;
	ans.push_back(make_pair(0, -1));
	for (int n: nums) {
		if (cnt.find(n) != cnt.end()) cnt[n]++;
		else cnt[n] = 1;
	}
	for (auto it = cnt.begin(); it != cnt.end(); it++) {
		ans.push_back(make_pair(-it->second, it->first));
	}
	sort(ans.begin(), ans.end());
	return ans;
}

int main() 
{
	int n;
	cin >> n;
	vector<int> even, odd;
	for (int i = 1; i <= n; i++) {
		int v;
		cin >> v;
		if (i % 2 == 1) odd.push_back(v);
		else even.push_back(v);
	}
	vector< pair<int, int> > major_even = majority(even);
	vector< pair<int, int> > major_odd = majority(odd);
//	for (int i = 0; i < major_even.size(); i++) {
//		cout << major_even[i].first << " " << major_even[i].second << "\n";
//	}
	int ans = 0;
	if (major_even[0].second != major_odd[0].second) {
		ans = n + major_even[0].first + major_odd[0].first;
	} else {
		ans = min(n + major_even[0].first + major_odd[1].first,
				  n + major_even[1].first + major_odd[0].first);
	}
	cout << ans << "\n";
	
	return 0;
}

Measured memory_bytes: 4088
#!/usr/bin/env python3

from pprint import pprint
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.buffer.readline

N, K = map(int, input().split())

# x (= 10 ** 100) の係数がaのとき、和としてあり得るものの個数は何個あるかを考える
# K <= a <= N + 1

b_list = range(N + 1)

ans = 0
for a in range(K, N + 2):
    # print(f"a = {a}")
    b_min = a * (a - 1) / 2
    b_max = a / 2 * (2 * (N - (a - 1)) + a - 1)
    # print(f"b_min = {b_min}, b_max = {b_max}")
    ans += b_max - b_min + 1

print(int(ans) % (10 ** 9 + 7))


Measured memory_bytes: 69272
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  int N;
  ll W;
  cin >> N >> W;
  vector<ll> w(N), v(N);
  rep(i, N) cin >> w[i] >> v[i];

  vector<vector<vector<ll>>> value(
      N + 1, vector<vector<ll>>(3 * N + 1, vector<ll>(N + 1)));
  rep(n, N) {
    rep(j, 3 * N + 1) {
      rep(k, N + 1) {
        ll V = v[n];
        ll res = w[n] - w[0];
        // Not use
        chmax(value[n + 1][j][k], value[n][j][k]);
        // Use
        if (k + 1 <= N && j + res <= 3 * N)
          chmax(value[n + 1][j + res][k + 1], value[n][j][k] + V);
      }
    }
  }

  ll ans = 0;
  rep(j, 3 * N + 1) {
    rep(k, N + 1) {
      ll temp = j + w[0] * k;
      if (temp <= W)
        chmax(ans, value[N][j][k]);
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 25472
local mmi, mma = math.min, math.max
local r, c, k = io.read("*n", "*n", "*n")
local item_row = {}
for i = 1, r do
  item_row[i] = {}
end
for i = 1, k do
  local ra, ca, v = io.read("*n", "*n", "*n")
  table.insert(item_row[ra], {ca, v})
end
for i = 1, r do
  table.sort(item_row[i], function(a, b) return a[1] < b[1] end)
end

local v1, v2, v3 = 0, 0, 0
local function box_reset(val)
  v1, v2, v3 = val, 0, 0
end
local function box_update(val)
  if val <= v3 then return end
  v3 = val
  if val <= v2 then return end
  v2, v3 = val, v2
  if v1 < val then
    v1, v2 = val, v1
  end
end
local function getboxval()
  return v1 + v2 + v3
end

local tbl, tbl2 = {}, {}
for i = 1, r do
  if i == 1 then
    for j = 1, c do
      tbl[j] = 0
      tbl2[j] = 0
    end
  else
    for j = 1, c do
      tbl[j] = tbl2[j]
    end
  end
  local item = item_row[i]
  for j = 1, #item do
    local col, val = item[j][1], item[j][2]
    box_reset(val)
    local baseval = tbl[col]
    tbl2[col] = mma(tbl2[col], baseval + getboxval())
    for k = j + 1, #item do
      local c2, v2 = item[k][1], item[k][2]
      box_update(v2)
      tbl2[c2] = mma(tbl2[c2], baseval + getboxval())
    end
  end
  for j = 2, c do
    tbl2[j] = mma(tbl2[j], tbl2[j - 1])
  end
end
print(tbl2[c])


Measured memory_bytes: 18080
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  in6 n;
  cin >> n;
  n %= 10;
  if(n == 3) cout << "bon";
  else if(n == 0 || n == 1 || n == 6 || n == 8) cout << "pon";
  else cout << "hon";
  hinata;
}

Measured memory_bytes: 3596
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] strAry = br.readLine().split(" ");
		double a = Double.parseDouble(strAry[0]);
		double b = Double.parseDouble(strAry[1]);
		double c = Double.parseDouble(strAry[2]);
		double d = Double.parseDouble(strAry[3]);
		System.out.println(Math.sqrt(Math.pow(c - a, 2) + Math.pow(d- b, 2)));
	}
}

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

int main()
{
	int n;
	cin >> n;
	vector<pair<int, int>> s_up;				// ポイントが0以上
	vector<pair<int, pair<int, int>>> s_down;	// ポイントが0未満
	for (int i = 0; i < n; i++) {
		string s_in;
		cin >> s_in;
		int point = 0;
		int mini = 0;
		for (auto s_in_ele : s_in) {
			if (s_in_ele == '(') {
				point++;
			} else {
				point--;
				mini = min(mini, point);
			}
		}
		if (point >= 0) {
			s_up.push_back(make_pair(mini, point));
		} else {
			s_down.push_back(make_pair(point - mini, make_pair(mini, point)));
		}
	}

	sort(s_up.begin(), s_up.end());
	reverse(s_up.begin(), s_up.end());		// ポイントが0以上のグループは最小値が大きい順にソート
	sort(s_down.begin(), s_down.end());
	reverse(s_down.begin(), s_down.end());	// ポイントが0未満のグループはポイント－最小値が大きい順にソート

	string ans = "Yes";
	int point = 0;
	for (auto s_up_ele : s_up) {
		int mini = point + s_up_ele.first;
		point += s_up_ele.second;
		if (mini < 0) {
			ans = "No";
			break;
		}
	}
	for (auto s_down_ele : s_down) {
		int mini = point + s_down_ele.second.first;
		point += s_down_ele.second.second;
		if (mini < 0) {
			ans = "No";
			break;
		}
	}
	if (point != 0) {
		ans = "No";
	}

	cout << ans << endl;
}


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

using namespace std;
using ll = long long;

int main() {
  int N,M,K;
  cin >> N >> M >> K;
  vector<ll> a(N+1);
  vector<ll> data1(N);
  vector<ll> b(M+1);
  vector<ll> data2(M);
  a[0] = 0;
  b[0] = 0;

  rep (i,N) cin >> data1[i];
  rep (i,M) cin >> data2[i];

  for (int i = 1; i < N+1; i++) {
    a[i] = a[i-1] + data1[i-1];
  }

  for (int i = 1; i < M+1; i++) {
    b[i] = b[i-1] + data2[i-1];
  }

  ll ans = 0;

  for (int i = 0; i < N+1; i++) {
    ll nokori = K-a[i];
    //nokori < 0の時、それ以上計算する必要なし break!
    if (nokori < 0) break;
    ll Iter = upper_bound(b.begin(), b.end(), nokori)-b.begin();
    Iter -= 1;
    Iter += i;
    ans = max(ans,Iter);
  }

  cout << ans << endl;

}


Measured memory_bytes: 9524
Number=int(input())

times=0

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    
    if n==1:
        return []
    else:
        return arr


Factors=factorization(Number)
#print(Factors)

for i in Factors:
    Power=i[1]
    BiggerThan=0
    MinusPower=1
    
    while Power>BiggerThan:
        times+=1
        Power-=MinusPower
        MinusPower+=1
        BiggerThan+=1

print(times)

Measured memory_bytes: 9408
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;

int main(){
    int S, W;
    cin >> S >> W;
    if(W>=S) cout << "unsafe" << endl;
    else cout << "safe" <<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#define N 36

struct kazu {
  int value;
  char mozi;
};

main(){
  int i,j,n,m,minj;
  struct kazu a[N],d[N],b,e;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c%d",&a[i].mozi,&a[i].value);
    d[i] = a[i];
  }

  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(a[j].value < a[j-1].value){
      b = a[j];
      a[j] = a[j-1];
      a[j-1] = b;
      }
    }
  }
  
  printf("%c%d",a[0].mozi,a[0].value);
  for(i=1;i<n;i++){
    printf(" %c%d",a[i].mozi,a[i].value);
  }
  printf("\n");
  printf("Stable\n");
  
  
  
  
  
  
  
  for(i=0;i<n-1;i++){
    minj = i;
    for(j=i;j<n;j++){
      if(d[j].value < d[minj].value){
	minj = j;
      }
    }
    e = d[i];
    d[i] = d[minj];
    d[minj] = e;
  }

  printf("%c%d",d[0].mozi,d[0].value);  
  for(i=1;i<n;i++){
    printf(" %c%d",d[i].mozi,d[i].value);
  }

  for(i=0;i<n;i++){
    if(a[i].mozi != d[i].mozi){
      m=0;
      break;
    }
    else if(a[i].mozi == d[i].mozi){
      m=1;
    }
  }
  printf("\n");
    if(m==1)printf("Stable\n");
    if(m==0)printf("Not stable\n"); 
    return 0;
}

   

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

 
using namespace std;
 
typedef long long ll;
#define pi   acos(-1) 
#define endl "\n"
const int mod = 1000000007; 

int main()
{
	int a;
	cin >> a ;
	if ( a % 2 == 0){
		cout << a / 2  << endl;
	}
	else 
		cout << (a /2) + 1 << endl;
		
    return 0;
}

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

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

using namespace std;
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

int main() {
	int a; cin >> a;
	cout << a + a * a + a * a * a;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    string ans = "";
    ans += string(d-b, 'U') + string(c-a, 'R');
    ans += string(d-b, 'D') + string(c-a, 'L');
    ans += string(1, 'L') + string(d-b+1, 'U') + string(c-a+1, 'R') + string(1, 'D');
    ans += string(1, 'R') + string(d-b+1, 'D') + string(c-a+1, 'L') + string(1, 'U');
    cout << ans << endl;
    //printf("%.12f", ans);
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sq(x) ((x)*(x))
#define fo(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<n;i++)
#define Fo(i,n) for(int i=1;i<=n;i++)
#define all(x) x.begin(),x.end()
#define fi first
#define se second
const double pi = 3.14159265358979323846;
#define uni(c) (c).resize(unique(all(c))-(c).begin())
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
//pair <int, int> w[4] = {mp(-1, 0), mp(0, -1), mp(1, 0), mp(0, 1)};   // for matrix movement:
void cp()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
void solve()
{
	// ull n;cin>>n;
	// ull a[n];
	// fo(i,n)cin>>a[i];
	// ull ans=1;
	// for(int i=0;i<n;i++)
	// {
	// 	ans*=a[i];
	// 	if(to_string(ans).size()>18)
	// 	{
	// 		cout<<-1;
	// 		return;
	// 	}
	// }
	// cout<<ans;
	long double a, b; cin >> a >> b;
	ll ans = a * b;
	cout << ans;










}
int main()
{
	fast;
	//cp();
	ll t = 1;
	//cin >> t;
	while (t--)
		solve();


	return 0;
}

Measured memory_bytes: 3748
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;


int main() {

	int n,c;
	
	cin >> n>>c;
	if (n == 1)n = 100;
	if (c == 1)c = 100;
	if (n < c)cout << "Bob" << endl;
	else if (n == c)cout << "Draw" << endl;
	else cout << "Alice" << endl;

	

	return 0;

}




Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

int main() {

	int K;
	cin >> K;

	vector<int> used(K);
	int r = 0, cnt = 1;
	while (!used[r]) {
		used[r] = 1;
		((r *= 10) += 7) %= K;
		if (r == 0) {
			cout << cnt << "\n";
			return 0;
		}
		cnt++;
	}

	cout << -1 << "\n";

	return 0;
}



Measured memory_bytes: 7060
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int sum, x , y, z;
    scanf("%d", &sum);
    x=sum/3600;
    y=(sum-(x*3600))/60;
    z=(sum-(x*3600)-(y*60));
    printf("%d:%d:%d\n",x, y, z);
    return 0;
}



Measured memory_bytes: 2144
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	int tmp = 0; tmp += abs(a[0]); tmp += abs(a[n - 1]);
	rep(i, n - 1) {
		tmp += abs(a[i] - a[i + 1]);
	}
	rep(i, n) {
		int ans = 0;
		if (i == 0) {
			ans = abs(a[i + 1]) - (abs(a[i]) + abs(a[i] - a[i + 1]));
		}
		else if (i == n - 1) {
			ans = abs(a[i - 1]) - (abs(a[i - 1] - a[i]) + abs(a[i]));
		}
		else {
			ans = abs(a[i - 1] - a[i + 1]) - (abs(a[i - 1] - a[i]) + abs(a[i] - a[i + 1]));
		}
		cout << ans + tmp << endl;
	}
	return 0;
}

Measured memory_bytes: 2048
#include <stdio.h>
#include <iostream>
using namespace std;

int main(){
  int num;cin >> num;
  int a = num/100;
  int b = num - num/100*100;
  bool A,B;
  A = 0<a&&a<13;
  B = 0<b&&b<13;
  
  if(A&&B) cout << "AMBIGUOUS";
  else if(A && !B) cout << "MMYY";
  else if(!A && B) cout << "YYMM";
  else cout << "NA";
  return 0;
}


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

typedef long long LL;

const int MAXN = 500005;
int a[MAXN];

int main() {
	LL n, a, b, c, d;
	scanf("%lld%lld%lld%lld%lld", &n, &a, &b, &c, &d);
	n--;
	for (register int i = 0; i <= n; i++)
	{
		LL minv = a + i * c - (n-i) * d;
		LL maxv = a + i * d - (n-i) * c;
		if (minv <= b && b <= maxv) {
			printf("YES");
			return 0;
		}
	}
	printf("NO");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  string t;
  //文字列s,tを受け取ります
  cin >> s >> t;
  vector<string> ls(s.size()-t.size()+1);
  // |s|-|t| + 1のサイズのstring配列を作成します。
  //部分文字列を列挙し配列lsに挿入します
  for (int i = 0; i < s.size()-t.size()+1; i++){
    ls.at(i) = s.substr(i,t.size());
  }
  int now = 0; //同じ文字の数
  int minimum = t.size(); //出力する答え
  for (int i = 0; i < s.size()-t.size()+1; i++){
    now = 0; //初期化
    for (int j = 0; j < t.size(); j++){
      if (t.at(j) == ls.at(i).at(j)){
        now++;
      }
    }
    if (t.size() - now < minimum){
      // |t| - now がminimumより小さかったら更新する
      minimum = t.size() - now;
    }
  }
  // minimumを出力する
  cout << minimum << endl;
}

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

int main(){
  int N,M,X,Y;
  cin >> N >> M >> X >> Y;
  vector<int> A(N),B(M);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  for(int i=0;i<M;i++){
    cin >> B.at(i);
  }
  sort(A.rbegin(),A.rend());
  sort(B.begin(),B.end());
  bool a=false;
  if(A.at(0)+1<=B.at(0)){
    for(int i=A.at(0)+1;i<B.at(0)+1;i++){
      if(X<i && i<=Y){
        a=true;
        break;
      }
    }
  }
  if(a){
    cout << "No War" << endl;
  }
  else{
    cout << "War" << endl;
  }
}
        
      
   
  

Measured memory_bytes: 3592
#######関数部分##############
#url http://iatlex.com/python/base_change
def Base_10_to_n(X, n):
    if (int((X-1)/n)):
        return Base_10_to_n(int((X-1)/n), n)+" "+str((X-1)%n)
    return str(X%n)
############################

# 初期入力
import sys
input = sys.stdin.readline
N = int(input())

#26進数に変換
x26 = Base_10_to_n(N, 26) 
x26_list =list(x26.split())
#x26_list.remove(" ")
int_str =["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]

#26進数⇒文字
ans =""
if len(x26_list) ==1:
    ans +=int_str[int(x26_list[0])-1]
else:
    ans +=int_str[int(x26_list[0])-1]

    for i in range(1,len(x26_list)):
        a =x26_list[i]
        x =int_str[int(a)]
        ans +=x

print(ans)

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

int main(){
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  bool f=1;
  rep(i,n){
    if(a[i]%2==1) f=0;
  }
  if(f) cout << "second" << endl;
  else cout << "first" << endl;
}

Measured memory_bytes: 640
import java.util.*;
class Main{
    /*
     * 整数 -> nextInt() (遅い場合は下のni())
     * 単語 -> next()
     * 1行 -> nextLine()
     * 注意 : nextLIneをnext(),nextInt()のあとに呼び出す場合、次が改行だと改行だけ取ってしまうので注意
     */
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();

        if(N==1){
            if(A==B) System.out.println(1);
            else System.out.println(0);
            return;
        }

        if(A == B){
            System.out.println(1);
        }else if(A > B){
            System.out.println(0);
        }else{
            System.out.println(B*(N-2)-A*(N-2)+1);
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(){
	int a[3];
	for(int i=0;i<3;i++){
		cin >> a[i];
	}
	if(a[0]<a[1]&&a[1]<a[2]){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m;
  cin>>n>>m;
  vector<int> v[n];
  for(int i=0; i<m; i++) {
    int x,y;
    cin>>x>>y;
    x--,y--;
    v[x].push_back(y);
  }
  bool u[n];
  memset(u,0,sizeof(u));
  int ans=0;
  for(int i=0; i<n; i++) {
    if(u[i]) continue;
    ans++;
    u[i]=1;
    queue<int> que;
    que.push(i);
    while(!que.empty()) {
      int x=que.front();que.pop();
      ans+=v[x].size()-1;
      for(int i=0; i<v[x].size(); i++) {
        int y=v[x][i];
        if(u[y]) continue;
        u[y]=1;
        que.push(y);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main(){
    int N, min=1000;
    cin >> N;

    for(int i = 0; i < N; i++){
        int A, d=0;
        cin >> A;
        while(A % 2 == 0){
            d++;
            A /= 2;
        }
        if(d < min){
            min = d;
        }
    }
    cout << min << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <cmath>
#include <deque>
#include <iostream>
#include <limits.h>
#include<functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <stack>

#define LL long long
#define pii pair<int,int>
#define pLL pair<LL,LL>
#define mp make_pair
#define mt make_tuple
#define pq priority_queue<LL>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<LL>
#define vecpii vector<pii>
#define vecpLL vector<pLL>
#define vecbL vector<bool>
#define endl "\n"
#define REP(e,v) for(auto e:v)
#define rep(i, a, n) for(LL i = a; i < n;i++)

using namespace std;

int inp(){
	int x;
	scanf("%d",&x);
	return x;
}
LL linp(){
	LL x;
	scanf("%lld",&x);
	return x;
}

void outp(int i){
	printf("%d",i);
}

void loutp(LL i){
	printf("%lld",i);
}

LL mod(LL i){
	return i % 1000000007;
}


int gcd(int i,int j){
	if(j != 0)
		return gcd(j, i % j);
	else
		return i;

}

int SaB(){

	string s;

	cin >> s;

	if(s.find("A") != -1 && s.find("B") != -1)
		printf("Yes");
	else
		printf("No");

	return 0;

}

int CB(){
	LL N,A,B;

	cin >> N >> A >> B;

	LL answer = A * (N/(A+B));

	if(N%(A+B) >= A)
		answer += A;
	else
		answer += N%(A+B);

	loutp(answer);

	return 0;
}

signed main() {

	// SaB();
	CB();
	return 0;
}



Measured memory_bytes: 256