akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define ve vector
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)

int main(){
    ll max = 1e18;
    int n;
    cin >> n;
    ve<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(), a.end());
    ll ans = a[0];
    if(ans == 0) {
        cout << ans << endl;
        return 0;
    }
    rep(i,n-1){
        if(a[i+1] > (double)(max/ans)){
            ans = -1;
            break;
        }
        ans *= a[i+1];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4048
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(int argc, char *argv[]) {
	int sr;
	int A, B;
	int K;
	int i, j;

	sr=scanf("%d %d", &A, &B);

	if ((A+B)%2 != 0) {
		printf("IMPOSSIBLE\n");
		fflush(stdout);
		return 0;
	}
		
	K = (A+B)/2;
	// A-K<0, B-K>0
	// -(A-K) = B-K
	// A+B = 2K, K=(A+B)/2
	if (A<K && B>K || A>K && B<K) {
		printf("%d\n", K);
		fflush(stdout);
		return 0;
	}

	printf("IMPOSSIBLE\n");
	fflush(stdout);
	return 0;

}


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


MOD = 10**9 + 7
K = [int(elem) for elem in fin()[:-1]]
D = int(fin())

dp = [[0] * 2 for _ in range(D)]
dp[0][1] = 1

for bound in K:
    next_dp = [[0] * 2 for _ in range(D)]
    for num in range(10):
        for d in range(D):
            next_reminder = (num + d) % D
            if num < bound:
                next_dp[next_reminder][0] += (dp[d][0] + dp[d][1])
            elif num == bound:
                next_dp[next_reminder][0] += dp[d][0]
                next_dp[next_reminder][1] += dp[d][1]
            else:
                next_dp[next_reminder][0] += dp[d][0]
            next_dp[next_reminder][0] %= MOD
            next_dp[next_reminder][1] %= MOD
    # import pdb; pdb.set_trace()
    dp = next_dp

res = dp[0][0] + dp[0][1] - 1
print(res) if res >= 0 else print(res + MOD)


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

int main(int argc, char const *argv[]) {
    int n;
    cin >> n;
    vector<int> a(n);
    unordered_map<int, int> num;
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ans += a[i];
        num[a[i]]++;
    }

    int q;
    cin >> q;
    vector<int> b(q), c(q);
    for (int i = 0; i < q; i++) cin >> b[i] >> c[i];

    for (int i = 0; i < q; i++) {
        ans += (c[i] - b[i]) * num[b[i]];
        num[c[i]] += num[b[i]];
        num[b[i]] = 0;
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 8128
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;
int main() {
  int N, D;
  cin >> N >> D;
  vector<ll> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>>(N + 1, vector<ll>(2501)));
  dp[0][0][0] = 1;
  for(int i = 0; i < N; i++) {
  	for(int j = 0; j <= N; j++) {
      for(int k = 0; k <= 2500; k++) {
      	dp[i + 1][j][k] += dp[i][j][k];
        if (j + 1 <= N) dp[i + 1][j + 1][k + A[i]] += dp[i][j][k];
      }
    }
  }
  ll ans = 0;
  for(int j = 1; j <= N; j++) {
    for(int k = 0; k <= 2500; k++) {
      if (j * D != k) continue;
      ans += dp[N][j][k];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 52224
a,b = map(int,input().split())
from fractions import gcd
import math
ab_gcd = gcd(a,b)
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return [1,n]
    else:
        factor.append(n)
        return factor
res = trial_division(ab_gcd)
print(len(set(res+[1])))

Measured memory_bytes: 5616
N=int(input())
l=[[0]*10 for i in range(10)]


for i in range(1,N+1):
  l[int(str(i)[0])][int(str(i)[-1])]+=1

ans=0
for i in range(10):
  for j in range(10):
    ans+=l[i][j]*l[j][i]
  
print(ans)


Measured memory_bytes: 9192
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();

            var ans = 0.0;
            for (int i = 0; i < n; i++)
            {
                var v = cin.nextDouble();
                var s = cin.next();

                if(s == "JPY")
                {
                    ans += v;
                }
                else
                {
                    ans += (v * 380000.0);
                }                
            }            
            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 11092
from itertools import product
N, K = map(int, input().split())
A = list(map(int, input().split()))

def f(p):
    ret = 0
    ma = 0
    for i, a in enumerate(A):
        if p[i] == 1:
            if ma == 0:
                pass
            else:
                if ma >= a:
                    ret += ma - a + 1
                    ma += 1
        ma = max(ma, a)
    return ret

ans = 10 ** 20
for p in product(range(2), repeat=N):
    if sum(p) < K: continue
    #print(p)
    ans = min(ans, f(p))

print(ans)



Measured memory_bytes: 45148
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    

#define bp __builtin_popcountll
#define inf 1e15
    
const int N=1e5+5;
const int M=1e9+7;
void solve()
{
	int a,b;
	cin>>a>>b;
	a=a*b;
	cout<<a;

}
signed main()  
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": ";
    	solve();
    }
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> A(N);

    ll LCM = 1;

    REP(i, N){
        cin >> A[i];
        LCM = lcm(LCM, A[i]);
    }

    ll X = 0;
    REP(i, N){
        X += LCM/A[i];
    }
    cout << double(double(LCM)/double(X)) << endl;
    
    return 0;
}

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

int main() {
	int n; cin >> n;
	vector<int>A(n); int cnt = 0;
	for (auto&& x : A) {
		cin >> x;
		if (x % 2 != 0)cnt++;
	}
	cout << (cnt % 2 == 0 ? "YES" : "NO") << endl;

	return 0;
}

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

#define FOR(i,a,n) for (int i = a; i < (int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define whole(f,x,...) ([&](decltype((x)) whole) { \
    return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
template<typename T> bool chmin(T &a, const T &b) {if (a > b) { a = b; return true; }return false;}
template<typename T> bool chmax(T &a, const T &b) {if (a < b) { a = b; return true; }return false;}

using ll = int_fast64_t;

constexpr ll INF = (1e9);
constexpr ll MOD = (1e9+7);

bool f[4];
char c[4] = {'N', 'W', 'S', 'E'};

int main() {
  string s;
  cin >> s;
  REP(i,s.size()) {
    REP(j,4) {
      if (s[i] == c[j]) f[j] = true;
    }
  }
  if ((f[0] && !f[2]) || (!f[0] && f[2])|| (f[1] && !f[3]) || (!f[1] && f[3])) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}


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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif


signed main() {

    int n;
    cin>>n;
    vector<int> a(n);
    int ans;
    rep(i,n)cin>>a[i];
    sort(a.begin(),a.end());
    
    cout << a[n-1]-a[0]<<endl;
    
    return 0;
}


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


int main(){
    ll a,b;cin>>a>>b;
    ll x,y;
    y=b-2*a;
    if(y<0||y%2!=0){
        cout<<"No"<<endl;
        return 0;
    }
    y=y/2;
    x=a-y;
    if(x<0){
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
}

    









Measured memory_bytes: 3636
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();
		Dolphin dl = new Dolphin(sx, sy);
		while(dl.y != ty) dl.up();
		while(dl.x != tx) dl.right();
		//System.out.println(dl.x+ " " + dl.y);
		while(dl.y != sy) dl.down();
		while(dl.x != sx) dl.left();
		//System.out.println(dl.x+ " " + dl.y);
		dl.left();
		while(dl.y != ty + 1) dl.up();
		while(dl.x != tx) dl.right();
		dl.down();
		//System.out.println(dl.x+ " " + dl.y);
		dl.right();
		while(dl.y != sy - 1) dl.down();
		while(dl.x != sx) dl.left();
		dl.up();
		//System.out.println(dl.x+ " " + dl.y);	
	}
	static class Dolphin{
		int x, y;
		public Dolphin(int x, int y){
			this.x = x;
			this.y = y;
		}
		void up() {
			y++;
			System.out.print("U");
		}
		void down() {
			y--;
			System.out.print("D");
		}
		void left() {
			x--;
			System.out.print("L");
		}
		void right() {
			x++;
			System.out.print("R");
		}
	}
}

Measured memory_bytes: 24404
#include <stdio.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string.h>
using namespace std;
char s[200],t[200],d[200];
int main()
{
	scanf("%s\n%s",s,t);
	int n=strlen(s);
	for (int i=0;i<n;i++)
	{
		int v=-1,p=0;
		for (int j=i;j<n;j++)
		{
			v=v+1;
			d[v]=s[j];
		}
		for (int j=0;j<i;j++)
		{
			v=v+1;
			d[v]=s[j];
		}
		for (int j=0;j<n;j++)
		{
			if (d[j]!=t[j]) 
			{
				p=1;
			}
		}
		if (p==0)
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

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

int main() {
    string S, T;
    bool a;
    a = false;
    cin >> S >> T;
    for (int i = 0; i < S.size(); i++){
        if(S.at(i) != T.at(i))a = true;
    }
    if(a) cout << "No" << endl;
    else  cout << "Yes" << endl;
}

Measured memory_bytes: 3624
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=200100;
int a[maxn]={0};
int cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int n,k,j,i,b;
    cin>>n>>k;
    for(i=0;i<n;++i)
    {
        cin>>b;
        a[b]++;
    }
    sort(a,a+200000,cmp);
    int sum=0;
    for(i=k;a[i]!=0;i++)
        sum+=a[i];
    cout<<sum<<endl;
}


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

using namespace std;
const int N = 2e5+100;
const double  eps  = (1e-10);
//点
struct Point{
    double x,y;
    Point(double _x=0,double _y=0):x(_x),y(_y){}
    Point operator + (Point p){return Point(x+p.x,y+p.y);}
    Point operator - (Point p){return Point(x-p.x,y-p.y);}
    Point operator * (double a){return Point(a*x,a*y);}
    Point operator / (double a){return Point(x/a,y/a);}
    double norm(){return x*x+y*y;}//模的平方
    double ABS() {return sqrt(norm());}//模
};
//线段
struct Segment{
    Point p1,p2;
};
double dot(Point a,Point b){
    return a.x*b.x+a.y*b.y;
}
double cross(Point a,Point b){
    return a.x*b.y-a.y*b.x;
}
bool cmp(Point a,Point b){
    if(a.y==b.y) return a.x<b.x;
    return a.y<b.y;
}
vector<Point> all;
vector<Point> Andrew(vector<Point> G){
    sort(G.begin(),G.end(),cmp);
    vector<Point> up,down;
    int n=(int)G.size();
    up.push_back(G[0]);
    up.push_back(G[1]);
    down.push_back(G[n-1]);
    down.push_back(G[n-2]);
    for(int i=2;i<n;i++){
        while(up.size()>1&&cross(up[up.size()-2]-up[up.size()-1],G[i]-up[up.size()-1])<0){
             up.pop_back();
        }
        up.push_back(G[i]);
    }
    for(int i=n-3;i>=0;i--){
         while(down.size()>1&&cross(down[down.size()-2]-down[down.size()-1],G[i]-down[down.size()-1])<0){
              down.pop_back();
         }
         down.push_back(G[i]);       
    }
    vector<Point> ans;
    for(int i=down.size()-1;i>=1;i--) ans.push_back(down[i]);
    for(int i=up.size()-1;i>=1;i--) ans.push_back(up[i]);
    return ans;
}
int main(){
    int n;
    scanf("%d",&n);
    double x,y;
    for(int i=0;i<n;i++){
         scanf("%lf %lf",&x,&y);
         all.push_back({x,y});
    }
    vector<Point> ans=Andrew(all);
    printf("%d\n",(int)ans.size());
    for(auto v:ans){
        printf("%.0lf %.0lf\n",v.x,v.y);
    }
    return 0;
}


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

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;

#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 

#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
#define len length
#define ret0 return 0
#define ret return 

#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound

#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>

// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;

#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN 100001

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

    ll n, l;
    cin>>n>>l;

    ll val = n*l + (n*(n+1))/2 -n, mn=inf, ans;
    loop(i,1,n+1){
        ll x =0;
        loop(j,1,n+1){
            if(i==j) continue;
            x = x+ l+j-1;
        }
        if(abs(val-x) < mn){
            mn = abs(val-x);
            ans = x;
        }
    }
    print(ans);
        
    
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<numeric>
#include<cstdlib>
#define ll long long int
#define all(x) x.begin(),x.end()
 
 #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 
#define v vector<long long int> 
#define vv vector< int> 
#define gcd(m,n) __gcd(m,n)
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,n) for (ll i=a ; i<n ;i+=1)
#define fe(d,e) for(auto d:e)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
# define N 100005LL
using namespace std;

vector<vector<ll>> graph(200005);
ll visited[200005]; 
ll x;
v ans;

void dfs(ll node){
    
    visited[node]=1;
    ans.pb(node);
  	
    for (ll u:graph[node]){
        if(!visited[u])dfs(u);
    }
   
  
  
}

auto solve(){
    ll n,m;cin>>n>>m; 
    f(i,m){
        ll a,b;cin>>a>>b;
        graph[a].pb(b);
        graph[b].pb(a);
    }
    v xxx;
  loop(i,1,n+1){

        if (!visited[i]){
            ans.clear();
          
           dfs(i);
           xxx.pb(ans.size());
           
          
           
        }
    }
    cout<<*max_element(all(xxx))<<"\n";
    


}



int main(){
    ll t=1;
    while(t--)
    
        solve();
    }

    

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
//#define int __int128
//#define ll __int128
//typedef __int128 long long;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}



void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}



void smain() {


    int n;
    cin >> n;
    set<pii> edges;
    if (n & 1) {
        n ^= 1;
        for (int i = 1; i <= n; ++i) {
            edges.insert({i, n + 1});
        }
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (i != j && j != n - i + 1) edges.insert({min(i, j), max(i, j)});
        }
    }

    cout << edges.size() << '\n';
    for (auto x : edges) {
        cout << x.first << ' ' << x.second << '\n';
    }
}

Measured memory_bytes: 512
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	m := make(map[string]int, len(s))
	for _,c := range strings.Split(s,"") {
		m[c]++
	}

	if len(m) == 2 {
		for k := range m {
			if m[k] == 2 {
				fmt.Println("Yes")
				return
			}
		}
	}
	fmt.Println("No")
}

Measured memory_bytes: 640
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <set>
using namespace std;

typedef long long llong;

const int N = 1000500;

int n;

struct chain {
    int a, b, c;
    void promote() {
        if ((++a) >= n)
            a = 0;
        if ((++b) >= n)
            b = 0;
        c += 2;
    }
};

int par[N], rnk[N];

int get(int x) {
    return (x == par[x]) ? x : (par[x] = get(par[x]));
}

bool merge(int a, int b) {
    a = get(a);
    b = get(b);
    if (a == b)
        return false;
    if (rnk[a] > rnk[b]) {
        swap(a, b);
    }
    if (rnk[a] == rnk[b])
        rnk[b]++;
    par[a] = b;
    return true;
}

int cpt = 0;
chain C[N];

struct evt {
    int t;
    int i;
};

int ept = 0;
evt E[N];

void add_chain(int a, int b, int c) {
    E[ept++] = {c, cpt};
    C[cpt++] = {a, b, c};
}

set<int> ids[2];

int main() {
    int q;
    int mn = 1e9 + 42;
    scanf("%d %d", &n, &q);
    for (int i = 0; i < q; i++) {
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        mn = min(mn, c);
        add_chain(a, b, c);
        add_chain((a + 1) % n, b, c + 1);
    }
    sort(E, E + ept, [] (evt a, evt b) { return a.t < b.t; } );
    int pt = 0;
    llong ans = 0;

    for (int i = 0; i < n; i++)
        par[i] = i;

    int cnt = 0;
    for (int t = mn; cnt < n - 1; t++) {
        while (pt != ept && E[pt].t <= t) {
            ids[t % 2].insert(E[pt].i);
            pt++;
        }
        auto& cur = ids[t % 2];
        vector<int> todel;
        for (int i : cur) {
            if (!merge(C[i].a, C[i].b)) {
                todel.push_back(i);
            } else {
                ans += C[i].c;
                assert(C[i].c == t);
                C[i].promote();
                cnt++;
            }
        }
        for (int i : todel)
            cur.erase(i);
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 28476
a,b=map(int, input().split(" "))
arr=[]
for i in range(a):
    line=list(input())
    #for j in line;
    arr.append(line)
    #for j in range(b)
    #    arr.append()
    #line=input()
    #if "#" in line:
    #    arr.append(line)

out=[]
for i in arr:
    if "#" in i:
        out.append(i)

count={}
for i in range(len(out)):
    for j in range(len(out[0])):
        if j not in count:
            count[j]=0
        if out[i][j]=="#":
            count[j]+=1
#print(count)
#print(arr)
#print(out)

for line in out:
    result=""
    for num,i in enumerate(line):
        if count[num]!=0:
            result+=i

    if result != "":
        print(result)


Measured memory_bytes: 3188
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define endl "\n"
inline bool EQ(double a, double b)
{
    return fabs(a - b) < 1e-9;
}
const int INF = 1 << 29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }

inline int test(int n, int b) { return (n >> b) & 1; }
inline void set_bit(int &n, int b) { n |= two(b); }
inline void unset_bit(int &n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n)
{
    int res = 0;
    while (n && ++res)
        n -= n & (-n);
    return res;
}
template <class T>
void chmax(T &a, const T &b) { a = max(a, b); }
template <class T>
void chmin(T &a, const T &b) { a = min(a, b); }

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

    int n;
    cin >> n;
    int dp[n + 1], arr[n];
    REP(i, n)
    cin >> arr[i];
    REP(i, n + 1)
    dp[i] = INF;
    dp[0] = 0;
    FOR(i, 1, n - 1)
    {
        dp[i] = dp[i - 1] + abs(arr[i] - arr[i - 1]);
        if (i >= 2)
        {
            dp[i] = min(dp[i], dp[i - 2] + abs(arr[i] - arr[i - 2]));
        }
        // dp[i]=dp[i-1]
    }
    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 4420
n,m=map(int,input().split())
l=[]
for i in range(n):
   l.append(list(map(int,input().split())))
l.sort()
#print(l)
total = 0
drink = 0
for i in range(0,n) :
    drink = drink + l[i][1]
    if drink>m:
        break
    #print('drink',drink,'l[i][1]',l[i][1])
noko = m-drink
#print('noko',noko,'m',m,'drink',drink)
d = i
#print('d',d)
for j in range(0,d+1):
    total += l[j][0]*l[j][1]
    #print('total',total,'l[j][0]',l[j][0],'l[j][1]',l[j][1])
total =total + l[d][0]*noko
#print('l[d][0]',l[d][0],'noko',noko)
print(total)


Measured memory_bytes: 27760
//総当り
//2018-12-21
//Ebitani Akira

#include <stdio.h>
#include <stdlib.h>

int Answer( int, int );

#define N 20
#define Q 200

int n;
int array1[N];

int main () {
  int array2[Q];
  int q, i;
  int answer;

  scanf( "%d", &n );
  if( n < 0 || n > 20 ){
    printf("要素数nが適当ではありません。\n");
    exit(1);
  }
  for( i = 0 ; i < n ; i++ ){
    scanf( "%d", &array1[i] );
  }
  
  scanf( "%d", &q );
  if( q < 0 || q > 200 ){
    printf("要素数qが適当ではありません。\n");
    exit(2);
  }
  for( i = 0 ; i < q ; i++ ){
    scanf( "%d", &array2[i] );
  }
  
  for( i = 0 ; i < q ; i++ ){
    answer = Answer( 0, array2[i] );

    if( answer == 1 ){
      printf( "yes\n" );
    }
    else{
      printf( "no\n" );
    }
  }

  return 0;
}

int Answer( int x, int y ){
  if( y == 0 ){
    return 1;
  }
  if( x >= n ){
    return 0;
  }

  if( Answer( x+1, y ) || Answer( x+1 , y - array1[x] )){
    return 1;
  }
  else {
    return 0;
  }

}
  
  



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    long long int a,b,x;
    cin >> a >> b >> x;
    if(a==0){
        cout << b/x  + 1<< endl;
    }else{
        cout << b/x -(a-1)/x << endl;
    }
    return 0;
}


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

int cmp(const void *a,const void *b)
{
  return *(int*)b-*(int*)a;
}

int main()
{
  int n,m;
  
  scanf("%d",&n);
  
  char s[n][11];
  int i,j,k;
  
  for(i=0;i<n;i++)
  {
    scanf("%s",&s[i]);
  }
  
  scanf("%d",&m);
  
  char t[m][11];
  
  for(i=0;i<m;i++)
  {
    scanf("%s",&t[i]);
  }
  
  int count_s[100]={},count_t[100]={},count[100]={};
  
  for(i=0;i<n;i++)
  {
    for(j=0;j<n;j++)
    {
      if(strcmp(s[i],s[j])==0)
      {
        count_s[i]++;
      }
    }  
    for(k=0;k<m;k++)
    {
      if(strcmp(s[i],t[k])==0)
      {
        count_t[i]++;
      }
    }    
    count[i]=count_s[i]-count_t[i];
  }
  
  qsort(count,n,sizeof(int),cmp);
  
  if(count[0]<0)
  {
    count[0]=0;
  }
  printf("%d\n",count[0]);
  return 0;
}

Measured memory_bytes: 128
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
int main(){
#define int long long
    int n,query;
    cin >> n>> query;
    vector<int> a;
    REP(i,n){
        int b;
        cin >> b;
        a.push_back(b);
    }
    REP(i,query){
        long long border = 0;
        cin >> border;
        long long ans = 0;
        long long sum = 0;
        long long left = 0;
        for(int q = 0;q < n;++q){
            sum += a[q];
            while(sum > border){
                sum -= a[left];
                left++;
            }
            ans += q + 1LL - left;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3884
fun main(args:Array<String>) {
    val a = readLine()!!
    val b = readLine()!!
    var aPad = a.padStart(Math.max(a.length, b.length), '0')
    var bPad = b.padStart(aPad.length, '0')
    if(aPad== bPad) {
        println("EQUAL")
    } else if(aPad > bPad) {
        println("GREATER")
    } else {
        println("LESS")
    }

}


Measured memory_bytes: 33652
#include <stdio.h>

int main(void)
{
	int n ,ai ,i ,max ,min;
	
        long int sum = 0;
	
	scanf("%d" ,&n);
	
	for(i=0;i<n;i++){
		
		scanf("%d" ,&ai);
		
		sum += ai;
		
		if(i==0){
			
			max = ai;
                        min = ai;


		}
		
		else if(ai>max){
			
			max = ai;
		
		}
		
		else if(ai<min){
			
			min = ai;
			
		}

          }
		
		printf("%d %d %ld\n" ,min ,max ,sum);
		
		return 0;
		
	}
		
	

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

#define loop(v, f, l) for(int v = (f), v##_ = (l); v < v##_; ++v)

using namespace std;

typedef long long int lint;
static inline int in(){ int x; scanf("%d", &x); return (x); }
static inline lint inl(){ lint x; scanf("lld", &x); return (x); }

double sequence(double a)
{
	double ans = a;
	loop(i, 2, 11)
	{
		if( i % 2 == 0 )
		{
			a *= 2;
			ans += a;
		}
		else
		{
			a /= 3;
			ans += a;
		}
	}
	return ans;
}

int main()
{
	double a;

	while( scanf("%lf", &a) != EOF )
	{
		printf("%lf\n", sequence( a ) );
	}

	return (0);
}

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

using namespace std;
long long x[10000010], y[10000010];
#define rep(i, n) for (int i = 0; i < (n); i++)
#define lep(j, n) for (int j = 0; j < (n); j++)
#define reps(i, n) for (int i = 1; i < (n); i++)
#define leps(i, n) for (int j = 1; j < (n); j++)
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define int long long
#define gsort(x, n) sort((x), (x) + (n), greater<int>());
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

signed main()
{

   cin.tie(0);
   ios::sync_with_stdio(false);

   int a, b, c;
   cin >> a >> b >> c;
   a = a + b;
   if (a >= c)
      cout << "Yes" << '\n';
   else
      cout << "No" << '\n';
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

const string t = "AKIHABARA";


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

	const int m = t.size();

	bool ok = false;
	rep(mask,1<<m){
		bool valid = true;
		string cur="";

		rep(i,m){
			if(mask &(1<<i))
				cur += t[i];
			else if(t[i]!='A')
				valid = false;
		}

		if(valid == false) continue;
		if(s == cur) ok = true;
	}


	puts(ok?"YES":"NO");
	return 0;
}

Measured memory_bytes: 764
N, M = map(int, input().split())
A = set([int(input()) for _ in range(M)])
MOD = 1000000007
memo = [0]*(N+1)
memo[0] = 1
if 1 not in A:
    memo[1] = 1
for i in range(2, N+1):
    if i not in A:
        memo[i] = (memo[i-2] + memo[i-1])%MOD
print(memo[N])


Measured memory_bytes: 18792
#include <iostream>
#include <string>

using namespace std;

int N, M;
string S, T;

long long int gcd(long long int a, long long int b) {
	if (a < b) { return gcd(b, a); }

	if (b == 0) { return a; }
	return gcd(b, a%b);
}

long long int LCM(long long int a, long long int b) {
	return a*b / gcd(a, b);
}

int main(void) {

	cin >> N >> M;
	cin >> S >> T;

	long long int L;

	//cout << LCM(N, M) << endl;

	L = LCM(N, M);

	bool sign = true;
	int p = 1, q = 1;
	while (1) {
		//cout << S[p - 1] << " " << T[q - 1] << endl;
		if (S[p -1] != T[q -1]) { sign = false; }
		p += L / M;
		q += L / N;
		if (p > N) { break; }
	}



	if (sign) { cout << L << endl; }
	else { cout << -1 << endl; }

	//system("pause");
	return 0;
}

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

struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    std::vector<std::vector<int>> groups() {
        std::vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        std::vector<std::vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            std::remove_if(result.begin(), result.end(),
                           [&](const std::vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    // root node: -1 * component size
    // otherwise: parent
    std::vector<int> parent_or_size;
};


int main() {
    int N, Q, t, u, v;
    cin >> N >> Q;
    dsu ds(N);
    for (int i = 0; i < Q; i++) {
        cin >> t >> u >> v;
        if (t) {
            cout << ds.same(u, v) << "\n";
        } else {
            ds.merge(u, v);
        }
    }

    return 0;
}


Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  // 一年の秒数
  int time;
  
  cin>>time;
  
  time = 24 - time;
 
  // 以下のコメント/* */を消して追記する
  cout << time + 24 << endl;

}

Measured memory_bytes: 3568
/*ex4_2
ryo_1129*/
#include<stdio.h>
#include<math.h>
//プロトタイプ宣言
double distance(int length_hour,int length_minute,double rad);

int main(void){
    //変数宣言
    int A,B,H,M;
    double radhour,radminute,rad,length;
    //入力
    scanf("%d %d %d %d",&A,&B,&H,&M);
    //演習率πを決める。
    const double pi = 3.14159265358979;
    //時針、分針を求める。
    radminute = 2*pi*M/60;
    radhour = 2*pi*(H*60+M)/720;
    //角度の差を求める。cos(θ)=cos(-θ)に注意
    rad = radhour - radminute;
    //長さを求める。関数の呼び出し
    length = distance(A,B,rad);
    //出力
    printf("%.9f\n",length);
    return 0;
}
//時針と分針の長さと角度から端点間の長さを求める。引数、時針の長さ、分針の長さ、それらのなす角度
double distance(int length_hour,int length_minute,double rad){
    double length;//変数宣言
    //余弦定理を用いて端点間の長さを求める
    length = sqrt(pow(length_hour,2)+pow(length_minute,2)-2*length_hour*length_minute*cos(rad));
    // 端点間の長さを返す
    return length;
}

Measured memory_bytes: 2432
# input
N = int(input())
S = input()

# check
if N > 0:
    ord_z = ord("Z")
    ord_a = ord("A")

    op = ""

    for i, s in enumerate(S):
        ord_s = ord(s) + N

        # Zの次はAになる
        if ord_s > ord_z:
            rem = ord_s % ord_z - 1
            ord_s = ord_a + rem

        chr_s = chr(ord_s)
        op += chr_s

    print(op)
else:
    print(S)

Measured memory_bytes: 3060
#include<stdio.h>
int main(){
  int s,h,m;
  int ans=0,pon=0,pan=0,pin=0;
  scanf("%d",&s);
  ans=s/3600;
  pon=s%3600/60;
  pin=s%3600%60;
  printf("%d:%d:%d\n",ans,pon,pin);
  return(0);
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

string s;

int main()
{
	cin>>s;
	rep(i,s.size()) if(s[i]=='?') s[i]='D';
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}


int main() {
    int N;
    cin >> N;
    if (N == 1) {
        cout << 1 << endl;
        return 0;
    }

    // 一個だけ読み込む
    int bef;
    cin >> bef;
    int cnt = 1;
    // upper = 1, downer = 0
    int isUpper = -1;
    FOR(i,1,N) {
        cerr << isUpper << endl;
        int a;
        cin >> a;
        if (a == bef) {
            bef = a;
            continue;
        }
        if (isUpper == -1) {
            isUpper = ( a > bef ) ? 1 : 0;
            cerr << "new: " << isUpper << endl;
            bef = a;
            continue;
        }
        if (isUpper == 1) {
            if ( a < bef) {
                bef = a;
                isUpper = -1;
                cnt++;
                continue;
            }
        }
        if (isUpper == 0) {
            if ( a > bef) {
                bef = a;
                isUpper = -1;
                cnt++;
                continue;
            }
        }
        bef = a;
    }

    cout << cnt << endl;


    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.length()==2){
            System.out.println(s);
        } else{
            StringBuilder sb = new StringBuilder();
            sb.append(s);
            System.out.println(sb.reverse().toString());
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <numeric>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

ll n, m;
vll BIT;
void add(ll a, ll w) {
  for(ll x=a; x<=m; x+=x&-x) BIT[x] += w;
}
ll sum(ll a) {
  ll ret=0;
  for(ll x=a; x>0; x-=x&-x) ret += BIT[x];
  return ret;
}

int main() {
  cin >> n >> m;
  vll l(n), r(n); REP(i, n) cin >> l[i] >> r[i];
  BIT.resize(2*m, 0);
  vll ord(n); iota(ord.begin(), ord.end(), 0);
  sort(ord.begin(), ord.end(), [&](ll x, ll y) {
    return r[x]-l[x] < r[y]-l[y];
  });
  ll i = 1;
  rep(d, 1, m+1) {
    while(i<=n && r[ord[i-1]]-l[ord[i-1]]+1==d) {
      add(l[ord[i-1]], 1); add(r[ord[i-1]]+1, -1); i++;
    }
    ll ans = n-i+1;
    for(ll j=d; j<=m; j+=d) ans += sum(j);
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 9984
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

void solve() {
    int N;
    cin >> N;
    int K = 2;
    for (; K*(K - 1) / 2 < N; ++K) {
    }
    if (K*(K - 1) / 2 != N) {
        cout << "No" << endl;
        return;
    }
    cout << "Yes" << endl;
    cout << K << endl;
    vector<vi> ans(K);
    int cur = 1;
    rep(i, K) {
        rep(j, i) {
            ans[i].push_back(cur);
            ans[j].push_back(cur);
            cur++;
        }
    }
    rep(i, K) {
        cout << sz(ans[i]);
        each(a, ans[i])cout << ' ' << a;
        cout << endl;
    }
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}

Measured memory_bytes: 2304
N, T = map(int, input().split())

array = [list(map(int, input().split())) for i in range(N)]

cost = 0

for i in range(N):
    if array[i][1] <= T and (cost == 0 or cost > array[i][0]):
        cost = array[i][0]
if cost == 0:
    print('TLE')
    exit()
print(cost)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
#define Mod 1e9+7
const LL mod=1e9+7;
const LL inf=0x3f3f3f3f;
using namespace std;
int dfs(int x,int step)
{
	if(x%2)
		return step;
	dfs(x/2,step+1);
}
int main()
{
	int n,a[10005],ans=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]),ans+=dfs(a[i],0);
	printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll)(a.size())
#define pll pair<ll,ll>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for(i=a;i<b;i++)

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll i,j,k,n,t;
	string s;
	cin>>n;
	cin>>s;
	ll cnt1,cnt2;
	cnt1 = cnt2 = 0;
	for(i=0;i<sz(s);i++)
		if(s[i]=='R')
			cnt1++;
	cnt2 = sz(s) - cnt1;
	ll ans = 0;
	for(i=0;i<cnt1;i++)
		if(s[i]!='R')
			ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3752
#include <stdio.h>

int main(){
  int i,x,y;
  for(i=0;i<3000;i++){
    scanf("%d %d",&x,&y);
    
    if(x==0 && y==0) break;
    else{
      if(x<y) printf("%d %d\n",x,y);
      else printf("%d %d\n",y,x);
    }
  }
  
  
  return 0;
}


Measured memory_bytes: 1972