akhauriyash/Code-Regression huggingface dataset:
// https://atcoder.jp/contests/abc086/tasks/arc089_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define REP(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
const int MAX_N = 2003;
int r[MAX_N][MAX_N], s[MAX_N][MAX_N];

int query(int x1, int y1, int x2, int y2) {
    // return sum(x1<=x<=x2,y1<=y<=y2)
    if (x1 > x2 || y1 > y2)
        return 0;
    else
        return s[x2][y2] - s[x1 - 1][y2] - s[x2][y1 - 1] + s[x1 - 1][y1 - 1];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, K;
    cin >> N >> K;
    REP(i, N) {
        int x, y;
        char c;
        cin >> x >> y >> c;
        if (c == 'B')
            y += K;
        x %= 2 * K;
        y %= 2 * K;
        r[x + 1][y + 1]++;
    }
    // 2次元累積和
    REP(x, 1, 2 * K + 2)
    REP(y, 1, 2 * K + 2)
    s[x][y] = r[x][y] + s[x - 1][y] + s[x][y - 1] - s[x - 1][y - 1];

    int ans = 0;
    REP(x, 1, K + 1) REP(y, 1, K + 1) {
        int temp = query(x, y, x + K - 1, y + K - 1) +
                   query(x + K, y + K, 2 * K, 2 * K) +
                   query(1, 1, x - 1, y - 1) + query(x + K, 1, 2 * K, y - 1) +
                   query(1, y + K, x - 1, 2 * K);
        ans = max({ans, temp, N - temp});
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 31616
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.math.*;

public class Main {

    public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        
        List<Double> list = new ArrayList<>();
        
        list.add(sc.nextDouble());
         System.out.print(String.format("%.5f",Math.pow(list.get(0),2)*Math.PI));
         System.out.print(String.format(" %.5f",list.get(0)*2*Math.PI));
    }
}
       


Measured memory_bytes: 28416
n = int(input())
a = list(map(int,input().split()))

dict1 = {}
for i in a:
    if i in dict1:
        dict1[i] += 1
    else:
        dict1[i] = 1

dict1_sorted = sorted(dict1.items(), key=lambda x:x[0], reverse = True)

ans = []

for a,b in dict1_sorted:
    if b >= 4:
        if len(ans) == 0:
            ans = [a] * 2
            break
        else:
            ans.append(a)
            break
    elif b >= 2:
        ans.append(a)
        if len(ans) == 2:
            break

if len(ans) == 2:
    print(ans[0] * ans[1])
else:
    print(0)


Measured memory_bytes: 21896
#include<bits/stdc++.h>
using namespace std;
#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define ll long long
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define abs(a,b) (a-b>0?a-b:b-a)
#define size size()

int main(){
    int n;
    cin >> n;
    cout << "ABC" << n << endl;

    return 0;
}





Measured memory_bytes: 256
#include <bits/stdtr1c++.h>
#define stat akjcjalsjcjalscj
#define hash ajkscjlsjclajsc
#define next ackjalscjaowjico
#define prev ajcsoua0wucckjsl
#define y1 alkscj9u20cjeijc
#define left lajcljascjljl
#define right aucouasocjolkjl
#define y0 u9cqu3jioajc

using namespace std;
#define TASK "solve"

const int N = 3e5 + 100;
const int module = 1e6 + 3;
const long long Base = 500000004;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());

long long rand(long long l, long long r){
    return 1LL * (1LL * rnd() * RAND_MAX + rnd()) % (r - l + 1) + l;
}
void doc() {
}

char Write(int x,int n) {
    if (x >= n) return 'L';
    return 'R';
}
void solve() {
    int n;
    cin >> n;
    int v[n];
    for (int i = 0; i < n; i++) cin >> v[i];
    int c[n];
    for (int i = 0; i < n; i++) cin >> c[i];
    int Res = 0;
    for (int i = 0; i < n; i++) Res += max(0,v[i] - c[i]);
    cout << Res;
}

int main() {
    srand(time(nullptr));
    ios_base::sync_with_stdio(1); cin.tie(nullptr); cout.tie(nullptr);
    doc();
    solve();
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define co cout
#define ci cin
#define sf1(n) scanf("%lld",&n);
#define sf2(n,m) scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define en cout<<endl;
#define pb push_back
#define coy cout<< "YES"<<endl;
#define con cout<< "NO"<<endl;
#define For(a,b) for(ll a=0;a<b;a++)
#define br break;
#define i64 long long
i64 M=10000000;
//ll b[805],ans[805];
map< ll,pair<ll,ll> >mp;
double dis(int x1,int y1,int x2,int y2)
{
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
int main()
{
    ll t,n,g,k,m,mx=0,mn=1e9,res,c1,x,y,c2;
    ci>>n;
    ll a[n][2];
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<2;j++)
        {
            ci>>a[i][j];
        }
    }
    double sum=0.0;
    for(ll i=0;i<n;i++)
    {
        for(ll j=i+1;j<n;j++)
        {
             sum+=dis(a[i][0],a[i][1],a[j][0],a[j][1]);
        }
    }
    //sum+=dis(a[n-1][0],a[n-1][1],a[0][0],a[0][1]);
    printf("%.10lf",(sum/n)*2);


}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}

vi f(int n){
    vi ret;
    for(int i = 1; i*i <= n; i++)if(n%i == 0){
        ret.push_back(i);
        if(i*i < n)ret.push_back(n/i);
    }
    sort(all(ret));
    return ret;
}

signed main(void) {
    int n,k;
    cin >> n >> k;
    vi a(n);
    rep(i,n)cin >> a[i];
    sort(all(a));
    int sum = 0;
    rep(i,n)sum += a[i];
    vi v = f(sum);
    //rep(i,v.size())cout << " " << v[i];cout << endl;
    reverse(all(v));
    for(int x: v){
        //k回以内にxの倍数にできるか判定する
        vi t;
        rep(i,n)if(a[i]%x)t.push_back(a[i]%x);
        if(t.empty()){
            cout << x << endl;
            return 0;
        }
        sort(all(t));
        vi rev(t.size());
        rep(i,t.size())rev[i] = x - t[i];
        rep(i,t.size()-1)t[i+1] += t[i];
        for(int i = t.size()-2; i >= 0; i--)rev[i] += rev[i+1];
        int tmp = LINF;
        rep(i,t.size()-1){
            int p = t[i];
            int q = rev[i+1];
            if(abs(p - q) % x == 0)tmp = min(tmp, max(p,q));
        }
        if(tmp <= k){
            cout << x << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
const long long MOD = 1e9+7;
ll dp[2001];

int main(){
  int n;cin>>n;
  dp[0]=dp[1]=dp[2]=(ll)0;
  dp[3]=dp[4]=dp[5]=(ll)1;

  for(int i=6;i<=n;i++){
    for(int j=3;j<=i-3;j++){
      dp[i]+=dp[i-j];
      dp[i]%=MOD;
    }
    dp[i]+=(ll)1;
  }

  cout<<dp[n];
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
        int N, D;
    cin >> N >> D;
    vector< vector<int> > v(N, vector<int>(D));
    for (int i=0; i<N; i++) {
        for (int j=0; j<D; j++) {
            cin >> v[i][j];
        }
    }

    int count = 0;

    for (int i=0; i<N; i++) {
        for (int j=(i+1); j<N; j++) {
            vector<int> v1 = v[i];
            vector<int> v2 = v[j];

            int distance_sqare = 0;
            for (int k=0; k<D; k++) {
                distance_sqare += pow((v1[k]-v2[k]), 2);
            }
            int distance = sqrt(distance_sqare);
            if (pow(distance, 2) == distance_sqare) {
                count += 1;
            }
        }
    }
    cout << count;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>

using namespace std;

int main()
{
    long long R = 0, ant = 0, a = 0, n;
    cin>>n;
    for (int i=0;i<n;i++){
        ant = a;
        cin>>a;
        if (ant>a) R += ant-a, a=ant;
    }
    cout<<R<<endl;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
long long mod = 1e9+7;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
//////////////////////////////////

int n, k;
vector<vector<int>> v;
long long dfs(int now, int from) {
    long long p = k;
    if(from == -1) p--;
    else p -= 2;

    if(k < v[now].size()) {
        return 0;
    }

    long long num = 1;
    for(int u: v[now]) {
        if(u == from) continue;
        num *= p;
        num %= mod;
        p--;
    }
    for(int u: v[now]) {
        if(u == from) continue;
        num *= dfs(u, now);
        num %= mod;
    }
    return num;
}

int main(){
    cin >> n >> k;
    v.resize(n);
    int a, b;
    for(int i=0; i<n-1; i++) {
        cin >> a >> b;
        a--; b--;
        v[a].push_back(b);
        v[b].push_back(a);
    } 

    long long ans = dfs(0, -1);
    ans *= k;
    ans %= mod;
    cout << ans << endl;

    return 0;
}

// EOF



Measured memory_bytes: 10368
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
long long int mod = (long long int)1000000007;
using namespace std;

void solve()
{
    ll i,j,k,n;
    std::cout.precision(10);
    int yes=0;
    cin>>n;
    ll a[n];
    ll tot=0;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        tot=tot^a[i];
    }
    string p="";
    while(tot!=0)
    {
        p+=(tot%2+'0');
        tot/=2;
    }
  
    for(j=0;j<n;j++)
    {
        int vis[33]={0};
        string curr="";
        while(a[j]!=0)
        {
            curr+=(a[j]%2+'0');
            a[j]/=2;
        }
        string z="";
        for(i=0;i<min(p.size(),curr.size());i++)
        {
            if(p[i]=='1' && curr[i]=='0')
            {
                z+='1';
            }
            else if(p[i]=='1' && curr[i]=='1')
            {
                z+='0';
            }
            else if(p[i]=='0' && curr[i]=='1')
            {
                z+='1';
            }
            else if(p[i]=='0' && curr[i]=='0')
            {
                z+='0';
            }
        }
        ll num=0;
        if(i==curr.size())
        {
            for(i=curr.size();i<p.size();i++)
            {
                z+=p[i];
            }
        }
        else if(i==p.size())
        {
            for(i=p.size();i<curr.size();i++)
            {
                z+=curr[i];
            }
        }
        for(i=0;i<z.size();i++)
        {
            if(z[i]=='1')
            {
                num+=pow((ll)2,i);
            }
        }
        cout<<num<<" ";
    }
    
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    int i,j,k;
    int t;
    std::cout.precision(10);
    t=1;
    while(t--)
    {
        solve();
        cout<<"\n";
    }
}

Measured memory_bytes: 5644
#include<bits/stdc++.h> 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define int long long
#define swap(x,y) (x^=y^=x^=y)

#define debug1(a) cerr<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cerr<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

using namespace std;
 
#define mod 1000000007
long long modexpo(long long x, long long p){
    int res = 1;x = x%mod;
    while(p){
        if(p%2)res = res * x;
        p >>= 1;
        x = x*x % mod;
        res %= mod;
    }
    return res;
}

struct compare{
    bool operator() (const pair<int,int> a, const pair<int,int> b) const{
        return a.first < b.first;
    }
};

int32_t main(){
    IOS
    int n;
    cin >> n;
    cout << 1-n << "\n";
} 

Measured memory_bytes: 3632
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // long long64_t, long long*_t
#include <cstdio> // prlong longf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip> //setprecision
#include <limits>
using namespace std;
int main(){
    int n;
    string s;
    cin >> n >> s;
    int left=0,right=0;
    int pl=0,pr=0;
    for(int i=0; i<n; i++){
        if(s[i]=='(') left++;
        else{
            if(left!=0){
                left--;
            }
            else{
                pl++;
            }
        }
    }
    pr=left;
    for(int i=0; i<pl; i++) cout << '(';
    cout << s;
    for(int i=0; i<pr; i++) cout << ')';
    cout << endl;
}


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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
typedef struct {
	vector <int> to;
	int cost;
} edge;

int main( void ){
	// initialize();
	int N;
	cin >> N;
	string classifier[] = {"pon", "pon", "hon", "bon", "hon", "hon", "pon", "hon", "pon", "hon"};
	cout << classifier[N%10] << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


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

public class Main {
	static final int mod = (int) 1e9 + 7;
	static final int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int[] DX8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, DY8 = { -1, 0, 1, -1, 1, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;
	static final String nextLine = "\n";

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		String s = fs.next(), t = fs.next();
		HashMap<Character,TreeSet<Integer>> map = new HashMap<>();
		for(int i=0;i<s.length();i++) {
			if(!map.containsKey(s.charAt(i)))map.put(s.charAt(i),new TreeSet<Integer>());
			map.get(s.charAt(i)).add(i);
		}
		
		int p = 0, cnt = 0;
		for(int i=0;i<t.length();i++) {
			char now = t.charAt(i);
			TreeSet<Integer> ts = map.get(now);
			if(ts == null) {
				System.out.println(-1);
				return;
			}
			if(ts.ceiling(p)==null) {
				p = 0; cnt++;
				if(ts.ceiling(p)==null) {
					System.out.println(-1);
					return;
				}
				p = ts.ceiling(p) + 1;
			}
			else {
				p = ts.ceiling(p) + 1;
			}
		}
		long ans = (long)cnt * s.length() + p; 
		System.out.println(ans);
	}

	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

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

int main()
{
  char s[100000];
  int i, flag=1;

  scanf("%s", s);
  for (i=97; i<97+26; i++){
    if (strchr(s, i) == NULL){
      printf("%c\n", i);
      flag = 0;
      break;
    }
  }
  if (flag) printf("None\n");

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    int H,W,K;
    string S[14];
    cin >> H >> W >> K;
    REP(i,H){
        cin >> S[i];
    }
    
    
    int Ans = INF;
    for(int j=0;j<(1<<(H-1));j++){
        
        int num = 0;
        REP(i,H-1){
            if((j>>i)%2==1){
                num++;
            }
        }
        
        int d[14]={};
        int e[14]={};
        bool ng = false;
        REP(i,W){
            REP(k,H){
                if(S[k][i]=='1'){
                    e[k]++;
                }
            }
            
            RREP(k,H-1){
                if((j>>k)%2==0){
                    e[k]+=e[k+1];
                    e[k+1]=0;
                }
            }
            
            /*REP(k,H){
                cout << e[k] << " ";
            }cout << endl;*/
            
            bool sla = false;
            REP(k,H){
                if(d[k]+e[k]>K){
                    sla = true;
                    if(e[k]>K){
                        ng = true;
                    }
                }
            }
            
            if(sla){
                //cout << i << " ";
                num++;
                REP(k,H){
                    d[k]=0;
                }
            }
            
            REP(k,H){
                d[k]+=e[k];
                e[k]=0;
            }
        }
        
        if(!ng){
            Ans=min(Ans,num);
        }
        
        //cout << j MM num MM ng << endl;
    }
    cout << Ans << endl;

    
    return 0;
}



Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int main() {
    int a = gi();
    int b = gi()/a;
    a = gi();
    printf("%d\n", MIN(a, b));

    return 0;
}


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

using namespace std;
using ll = long long;

ll dp[111111];

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int n, full; cin >> n >> full;
    memset(dp, 0, sizeof dp);
    for (int i = 0; i < n; i++) {
        int w, value; cin>>w>>value;
        for(int x=full;x>=w;x--){
            dp[x] = max(dp[x], dp[x-w]+value);
        }
    }
    cout<<dp[full]<<endl;
}


Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int count = 1;
		int[] H = new int[N];

		for(int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
		}

		boolean flag = false;
		for(int i = 1; i < N ; i++) {
			flag = true;
			for(int j = 0; j < i; j++) {
				if(H[j] <= H[i]) {
					flag = true;
				}
				else {
					flag = false;
					break;
				}
			}
			if(flag) {
				count++;
			}
		}
		System.out.println(count);
	}

}


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

int main() {
	int a, b, c;

	cin >> a >> b >> c;

	if ((a == b && a != c) || (a == c && a != b) || (b == c && b != a)) {
		cout << "Yes";
	} else {
		cout << "No";
	}
	
	return 0;
}
	

Measured memory_bytes: 256
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix += [int(b) for b in a]
    return intMatrix


def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix


def makeInt(line):
    return int(line.rstrip())


def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve(input_string):
    N = input_string
    if N == 'A':
        return 'T'
    elif N == 'T':
        return 'A'
    elif N == 'G':
        return 'C'
    elif N == 'C':
        return 'G'


def main():
    input_lines = stdin.readline().rstrip()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()


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

using namespace std;

int main()
{
    int k;
    cin>>k;
    int x = 7%k;
    set<int> s;
    int i = 0;
    int answer = -1;
    while(s.count(x) == 0)
    {
        if(x == 0)
        {
            answer = i;
            break;
        }
        s.insert(x);
        x = (x*10 + 7) % k;
        i++;

    }

    if(answer == -1)
    {
        cout<<-1;
    }
    else
    {
        cout<<answer+1;
    }
    
    
    return 0;
}

Measured memory_bytes: 50448
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author TM
 */


#include <bits/stdc++.h>

using namespace std;

class CHonestOrUnkind2 {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        int n;
        cin >> n;
        vector<vector<pair<int, int>>> vec(n + 1);
        for (int i = 0; i < n; ++i) {
            int a;
            cin >> a;
            vector<pair<int, int>> a_v;
            for (int j = 0; j < a; ++j) {
                int x, y;
                cin >> x >> y;
                a_v.emplace_back(x, y);
            }
            vec[i] = a_v;
        }
        int cnt = 0;
        for (int bits = 0; bits < pow(2, n); ++bits) {
            int tmp_cnt = 0;
            bool flag = true;
//            全探索。bitが立っている部分は「正直者」それ以外は「不親切」として扱う
            for (int j = 0; j < n; ++j) {
                if (bits & (1 << j)) {
                    for (auto p: vec[j]) {
//                        正直者が言っていることに矛盾がないか確認
                        int candidate = p.first;
                        if (!(bits & (1 << (candidate - 1))) && (p.second == 1))
                            flag = false;
                        if ((bits & (1 << (candidate - 1))) && (p.second == 0))
                            flag = false;
                    }
                }
            }
            if (flag) {
                for (int k = 0; k < n; ++k) {
                    if (1 & (bits >> k))tmp_cnt++;
                }
            }
            cnt = max(cnt, tmp_cnt);
        }

        cout << cnt << endl;
    }

};


int main() {
    CHonestOrUnkind2 solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
    
//-------------------------↓↓↓↓↓↓------------------------
    
//------ 自分を天才だと信じる ------

template< typename T >
struct edge {
  int src, to;
  T cost;
 
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
 
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
 
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
 
  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;

template< typename T >
pair< T, int > dfs(const WeightedGraph< T > &g, int idx, int par) {
  pair< T, int > ret(0, idx);
  for(auto &e : g[idx]) {
    if(e.to == par) continue;
    auto cost = dfs(g, e.to, idx);
    cost.first += e.cost;
    ret = max(ret, cost);
  }
  return ret;
}
 
template< typename T >
T tree_diameter(const WeightedGraph< T > &g) {
  auto p = dfs(g, 0, -1);
  auto q = dfs(g, p.second, -1);
  return (q.first);
}
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    WeightedGraph<ll> g(n);
    rep(i,n-1){
        cin>>a>>b>>c;
        //インデントは0から
        g[a].emplace_back(b,c);
        g[b].emplace_back(a,c);
    }
    Cout(tree_diameter(g));
    return 0;
}


Measured memory_bytes: 17568
//Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
using namespace std;

typedef long long              ll;
typedef long double            ld;
typedef pair<int, int>         pi;
typedef vector<int>            vi;
typedef vector<pair<int, int>> vpi;

#define pb       push_back
#define all(x)   begin(x), end(x)
#define sz(x)    (int)(x).size()
#define ff       first
#define ss       second
#define mp       make_pair
#define lb       lower_bound
#define ub       upper_bound
#define tcase()  int t; cin >> t; while(t--)

const int MOD = 1e9 + 7; // 998244353;
const int MX  = 2e5 + 5;
const ll  INF = 1e18;
const ld  PI  = acos((ld) -1);

void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0);
    if(sz(name)){
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

int main(){

    setIO();

    string a, b;
    cin >> a >> b;

    int na = sz(a), nb = sz(b);

    int cnt = 0, best = 0;

    for(int i = 0; i <= na - nb; i++){
        cnt = 0;
        string p = a.substr(i, nb);

        for(int i = 0; i < nb; i++){
            if(p[i] == b[i]) cnt++;
        }

        best = max(best, cnt);
    }

    cout << nb - best;
}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define INF 1125899906842624
#define MAX_N 12
#define MAX_M 12
i64 A[MAX_N][MAX_M];


int main() {
    i64 N, M, X; cin >> N >> M >> X;
    vector<i64> C(N);
    REP(i, N) {
        cin >> C[i];
        REP(j, M) cin >> A[i][j];
    }

    i64 minv = INF;
    for (i64 bit = 0; bit < (1 << N); bit++) {
        i64 v = 0;
        vector<i64> S(M, 0);
        REP(i, N) {
            if (bit >> i & 1) {
                v += C[i];
                REP(j, M) {
                    S[j] += A[i][j];
                }
            }
        }

        bool ok = true;
        REP(i, M) {
            if (S[i] < X) ok = false;
        }
        if (ok) chmin(minv, v);
    }
    if (minv == INF) {
        cout << -1 << endl;
    } else {
        cout << minv << endl;
    }

    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <cstdlib>
long X, A, B;
int main(void){
    std::cin >> X >> A >> B;
    if(B-A <= 0){
        std::cout << "delicious" << std::endl;
    }else if(B-A >= X+1){
        std::cout << "dangerous" << std::endl;
    }else{
        std::cout << "safe" << std::endl;
    }
}


Measured memory_bytes: 256
from sys import stdin

n = int(stdin.readline().rstrip())
s = str(stdin.readline().rstrip())
a = 1#何個目
ans = s[0]
while a < n:
    if s[a-1] == s[a]:
        pass
        a += 1
    else:
        ans += s[a]
        a += 1

print(len(ans))


Measured memory_bytes: 3316
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007


int main()
{
	long long int n, m;
	cin >> n >> m;
	long long int x[100001], y[100001];
	for(int i = 0; i < n; i++){
		cin >> x[i];
	}
	for(int i = 0; i < m; i++){
		cin >> y[i];
	}
	long long int ansx = 0, ansy = 0;
	for(long long int i = 1; i < n; i++){
		ansx += (((x[i] - x[i - 1]) % mod) * (i * (n - i)) % mod) % mod;
		ansx = ansx % mod;
	}
	for(long long int i = 1; i < m; i++){
		ansy += (((y[i] - y[i - 1]) % mod) * (i * (m - i)) % mod) % mod;
		ansy = ansy % mod;
	}
	// cout << ansx << " " << ansy << endl;
	long long int ans = (ansx * ansy) % mod;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int d(int x){
    int ret = 0;
    while(x){
        ret += x%10;
        x/=10;
    }
    return ret;
}

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

    int ans = 1234567;
    for(int i=1; i<n; ++i){
        int j=n-i;
        ans = min(ans, d(i)+d(j));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int selectionSort(int A[], int N) {
    int i,j,t,sw = 0, minj;
    for(i=0; i<N-1; i++) {
        minj = i;
        for(j=i; j<N; j++) {
            if(A[j] < A[minj]) minj = j;
        }
        t = A[i]; A[i] = A[minj]; A[minj] = t;
        if(i != minj) sw++;
    }
    return sw;
}

int main() {
    int A[100], N, i, sw;
    
    scanf("%d", &N);
    for(i=0; i<N; i++) scanf("%d", &A[i]);
    
    sw = selectionSort(A,N);
    
    for(i=0; i<N; i++) {
        if(i>0) printf(" ");
        printf("%d", A[i]);
    }
    printf("\n");
    printf("%d\n", sw);
    
    return 0;
}


Measured memory_bytes: 2104
import itertools

s = input()
n = [i for i in s]
#print(n)
ans = 0
# +の個数
for i in range(len(n)):
    # +を挿入するパターンの全探索
    for j in itertools.combinations(range(len(n)-1), i):
        #print(i,j)
        temp = [i for i in s]
        # +を挿入
        for k in j[::-1]:
            temp.insert(k+1, "+")
            #print(i,j,k)
        # listから文字列に
        temp = "".join(temp)
        # +で区切ってリストに
        temp = temp.split("+")
        # リストの要素をint型にキャストして総和を算出
        temp = map(int, temp)
        ans += sum(temp)

print(ans)

Measured memory_bytes: 3316
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def sol():
    N, K = map(int, input().split())

    A = list(map(int, input().split()))
    sumPlus = [0] * (N + 1)
    sumA = [0] * (N + 1)

    for i, a in enumerate(A):
        sumA[i + 1] = sumA[i] + a
        if a > 0:
            sumPlus[i + 1] = sumPlus[i] + a
        else:
            sumPlus[i + 1] = sumPlus[i]

    ans = 0
    for left in range(N - K + 1):  # []left - left + K) を捨てる or 加える
        leftSum = sumPlus[left]
        rightSum = sumPlus[N] - sumPlus[left + K]
        midSum = sumA[left + K] - sumA[left]

        if midSum > 0:
            ans = max(ans, leftSum + rightSum + midSum)
        else:
            ans = max(ans, leftSum + rightSum)

    print(ans)

sol()

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

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

    vector<int> list;

    int tmp;
    rep(i,n){
        cin>>tmp;
        list.push_back(tmp);
    }

    sort(list.begin(), list.end());
    int ans=0;
    rep(i,k){
        ans+=list[i];
    }

    cout<<ans<<endl;

}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define INF (int)1e9
#define endl "\n"
#define ll long long
#define ull unsigned long long

using namespace std;

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

    ll a, b, n;
    cin >> a >> b >> n;

    ll ans = 0;
    ll i = min(b - 1, n);
    ans = max(ans, (a * i) / b - a * (i / b));

    ll to = n / b * b - 1;
    i = to;
    ans = max(ans, (a * i) / b - a * (i / b));

    cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main()
{
  	int n, r;
  	cin >> n >> r;
  	
  	if(n < 10)
    {
      	cout << r + (10 - n) * 100 << endl;
    }
  	else
  	cout << r << endl; 
}


Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-

# import numpy as np
# from itertools import *
# from collections import *

# S = input().split()
# N = int(input().split())
# N, K = [int(x) for x in input().split()]

X = int(input())

li = []

n = -1000

while n**5 < 10**15:
    li.append(n**5)
    n += 1

for ai, a in enumerate(li):
    for bi, b in enumerate(li):
        if a - b == X:
            print(ai-1000, bi-1000)
            exit(0)


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

using namespace std;

void solve()
{
	int n;
	while(cin >> n)
	{
		int ans = 0;
		int sum = 0;
		vector<int> Vec(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> Vec[i];
		}
		sort(Vec.begin(), Vec.end());
		for(int i = 0; i < n; ++i)
		{
			sum += Vec[i];
			ans += sum;
		}
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1216
s = input()
k = int(input())

ans = 0
flag = False
before = ""
for i in range(len(s)):
    if s[i] == before:
        if flag:
            flag = False
        else:
            flag = True
            ans += 1
    else:
        flag = False
    before = s[i]

n = len(s)
if len(set(list(s))) == 1:
    print(len(s) * k // 2)
    exit()
elif s[0] == s[-1]:
    a = 1
    b = 1
    for i in range(len(s)):
        if s[i] == s[i+1]:
            a += 1
        else:
            break
    for i in range(len(s)):
        if s[n-1-i] == s[n-2-i]:
            b += 1
        else:
            break
    if a % 2 == 1 and b % 2 == 1:
        print(ans*k + (k-1))
    else:
        print(ans*k)
else:
    print(ans * k)

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(long long i=(l);i<(r);i++)
#define dec(i, l, r)   for(long long i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n;cin >> n;
    int A = 0;
    int B = 0;
    vector<int> a(n);
    inc(i, 0, n){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    inc(i, 0, n){
        if(i%2 == 0){
            A += a[i];
        }else{
            B += a[i];
        }
    }
    cout << A-B << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>

using namespace std;

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

  map<int, int> mp;
  for(int i = 0; i < k; i++){
    int d;
    cin >> d;

    for(int j = 0; j < d; j++){
      int l;
      cin >> l;

      mp[l]++;
    }
  }

  int ans = n - mp.size();

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3636
import datetime

while True:
    try:
        y, m, d = map(int, input().split())
        n = 10000*y + 100*m +d
        if n < 18680908:
            print("pre-meiji")
        elif n < 19120730:
            print("meiji", y - 1867, m, d)
        elif n < 19261225:
            print("taisho", y - 1911, m, d)
        elif n < 19890108:
            print("showa", y - 1925, m, d)
        else:
            print("heisei", y - 1988, m, d)
    except:
        break



Measured memory_bytes: 6032
#拡張ユークリッド互除法
#ax+by=1の1つの解(gcd(a,b)=1)
#仕組みをちゃんと理解していない
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def modinv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m #負の値を返さないように

X,Y = map(int,input().split())

X,Y = min(X,Y),max(X,Y)

if (X+Y)%3 != 0 or X*2-Y < 0:
    ans = 0
else:
    a = (2*X-Y)//3
    b = (2*Y-X)//3
    m = 10**9+7
    ans = 1
    for i in range(b+1,a+b+1):
        ans = ans*i%m
    for i in range(1,a+1):
        ans = ans*modinv(i,m)%m
print(ans)


Measured memory_bytes: 41324
#include<bits/stdc++.h>
using namespace std;
#define INFTY 1<<20
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long int ll;
const int MOD=1000000007;

int main(){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    int dx = tx-sx,dy = ty-sy;
    string s;
    s += 'L';
    rep(i,dy+1)s += 'U';
    rep(i,dx+1)s += 'R';
    s += 'D';
    
    rep(i,dx)s += 'L';
    rep(i,dy)s += 'D';

    s+= 'D';
    rep(i,dx+1)s += 'R';
    rep(i,dy+1)s += 'U';
    s += 'L';

    rep(i,dy)s += 'D';
    rep(i,dx)s += 'L';

    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

def getlist():
	return list(map(int, input().split()))

#初期化
N = int(input())
FL = []
PL = []
for i in range(N):
	F = getlist()
	FL.append(F)

for i in range(N):
	P = getlist()
	PL.append(P)

#bit全探索
ans = -float("inf")
for i in range(1, 1 << 10):
	D = defaultdict(int)
	for j in range(10):
		if ((i >> j) & 1) == 1:
			for k in range(N):
				D[k] += 1 & FL[k][j]
	val = 0
	for j in range(N):
		val += PL[j][D[j]]
	ans = max(ans, val)
print(ans)

Measured memory_bytes: 3436
#include <stdio.h>
#include <stdlib.h>

int main(){

    int time; //input time[s]
    div_t o1; //output1
    div_t o2; //output2
    int h; //output hours
    int m; //output minutes
    int s; //output seconds

    scanf("%d", &time);

    o1 = div(time,3600);
    o2 = div(o1.rem,60);

    h = o1.quot; //quotient part of time[s]/3600
    m = o2.quot; //quotient part of o.rem[s]/60
    s = o2.rem; //remainder part of o.rem[s]/60

    printf("%d:%d:%d\n",h,m,s);

    return 0;

}

Measured memory_bytes: 1860
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long long solve(long long a, long long b) {
        return lcm(a, b);
    }

private:
    long long gcd(long long a, long long b) {
        while (a != 0) {
            b %= a;
            swap(a, b);
        }
        return b;
    }

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

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    Solution sol;

    cout << sol.solve(a, b) << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>

using namespace std;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
int main() {
  int N, A[3];
  ins(N, A[0], A[1], A[2]);
  map<string, pair<int, int>> m;
  m["AB"] = make_pair(0, 1);
  m["AC"] = make_pair(0, 2);
  m["BC"] = make_pair(1, 2);

  if (A[0] + A[1] + A[2] == 0) {
    cout << "No\n";
    return 0;
  }
  queue<int> q;
  if (A[0] + A[1] + A[2] == 1) {
    rep(i, N) {
      string s; cin >> s;
      int fst = m[s].first, snd = m[s].second;
      if (A[fst] + A[snd] == 0) {
        cout << "No\n";
        return 0;
      }
      if (A[fst] == 0)
        q.push(fst);
      else
        q.push(snd);
      swap(A[fst], A[snd]);
    }
    cout << "Yes\n";
    while (!q.empty()) {
      cout << (char)(q.front() + 'A') << endl;
      q.pop();
    }
    return 0;
  }

  string s[N];
  rep(i, N) { cin >> s[i]; }

  if (A[m[s[0]].first] + A[m[s[0]].second] == 0) {
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";
  rep(i, N) {
    int fst = m[s[i]].first, snd = m[s[i]].second;
    if (A[fst] == 0) {
      q.push(fst);
      ++A[fst]; --A[snd];
    } else if (A[snd] == 0) {
      q.push(snd);
      --A[fst]; ++A[snd];
    } else {
      if (A[fst] == 1 && A[snd] == 1 && A[0] + A[1] + A[2] == 2) {
        if (i == N-1) {
          q.push(fst);
          continue;
        }
        if (s[i+1] != s[i] && (m[s[i+1]].first == fst || m[s[i+1]].second == fst)) {
          swap(fst, snd);
        }
        q.push(snd);
        --A[fst]; ++A[snd];
      } else {
        if (A[fst] < A[snd]) {
          swap(fst, snd);
        }
        q.push(snd);
        --A[fst]; ++A[snd];
      }
    }
  }
  while (!q.empty()) {
    cout << (char)(q.front() + 'A') << endl;
    q.pop();
  }
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);

  rep(i, n) cin >> s[i];

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

  rep(i, n) cout << s[i];

  return 0;
}


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

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
template<typename T> bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b){ if(a>b){ a=b; return 1;} return 0;}


/*FUNCs=================================================*/


/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int n,a,b; cin >> n>>a >>b;
    cout << min(n*a, b) << '\n';
}

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

using namespace std;

int h,w,n,i,j;
long long res[15];
pair <int, int> pt[100005];
set <pair<int, int> > a,b;

int main(){
	scanf("%d%d%d", &h, &w, &n);
	for(i = 0; i < n; i++){
		scanf("%d%d", &pt[i].first, &pt[i].second);
		a.insert(pt[i]);
	}
	
	res[0] = (long long)(h - 2) * (w - 2);
	
	for(i = 0; i < n; i++){
		for(int ii = 0; ii < 3; ii++){
			for(int jj = 0; jj < 3; jj++){
				pair<int, int> lc = {pt[i].first - ii, pt[i].second - jj};
				pair<int, int> rc = {lc.first + 2, lc.second + 2};
				
				if(lc.first <= 0 || lc.first > h || lc.second <= 0 || lc.second > w) continue;
				if(rc.first <= 0 || rc.first > h || rc.second <= 0 || rc.second > w) continue;
				if(b.count(lc) != 0) continue;
				int cnt = 0;
				for(int iii = lc.first; iii <= lc.first + 2; iii++){
					for(int jjj = lc.second; jjj <= lc.second + 2; jjj++){
						cnt += a.count({iii, jjj});
					}
				}
				res[cnt]++;
				b.insert(lc);
			}
		}
	}
	
	for(i = 1; i <= 9; i++)
	res[0] -= res[i];
	
	for(i = 0; i <= 9; i++)
	printf("%lld\n", res[i]);

}


Measured memory_bytes: 47872