akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

bool f3[3],f4[4];

int main() {
  int N; cin >> N;
  char s[101];
  for ( int i = 0; i < N; i++ ) cin >> s[i];
  for ( int i = 0; i < N; i++ ) {
    if ( s[i] == 'P' ) {
      f3[0] = true;
      f4[0] = true;      
    } else if ( s[i] == 'W' ) {
      f3[1] = true;
      f4[1] = true;            
    } else if ( s[i] == 'G' ) {
      f3[2] = true;
      f4[2] = true;            
    } else if ( s[i] == 'Y' ) {
      f3[3] = true;
      f4[3] = true;            
    }
  }
  bool ans1 = true;
  bool ans2 = true;
  for ( int i = 0; i < 4;i++ ) {
    if( f4[i] != true ) ans1 = false;
  }
  for ( int i = 0; i < 3;i++ ) {
    if( f3[i] != true ) ans2 = false;
  }
  if ( ans1 ) cout << "Four" << endl;
  else if ( ans2 ) cout << "Three" << endl;
  return 0;
}


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

map<string, int> store;

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

    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        store[s]++;
    }


    ll cnt = 0;
    for (auto &x : store) {
        x.second--;
        cnt += (ll)x.second * (x.second + 1) / (ll)2;
    }

    cout << cnt << endl;
}


Measured memory_bytes: 11136
#include<iostream>
#include<math.h>
#include<string>
#include<bits/stdc++.h>
using namespace std;

int main()
{
string n[120];
  int a,b;
  cin >> a >> b;
  for(int i = 0;i < a;i++){
    cin >> n[i];
  }
  sort(n,n+a);
  for(int i = 0;i < a;i++){
    cout << n[i];
  }
  cout << endl;
return 0;
}

Measured memory_bytes: 3652
#include<cstdio>
#include<cstring>
using namespace std;
#define MAXN 100000
#define MAXK 1000
int x[MAXN+5],y[MAXN+5],m[MAXN+5];
int y1[10*MAXK+5];
int main()
{
    int N,K,Max=0,cnt=0;
    scanf("%d %d",&N,&K);
    for(int i=1;i<=N;i++)
    {
        char ch[25];
        scanf("%d %d %s",&x[i],&y[i],ch);
        x[i]=x[i]%(2*K);
        y[i]=y[i]%(2*K);
        if(ch[0]=='W') m[i]=1;
            else m[i]=0;
    }
    for(int i=0;i<=K;i++)
    {
        cnt=0;
        memset(y1,0,sizeof(y1));
        for(int j=1;j<=N;j++)
        {
            int p=(i<=x[j]&&x[j]<i+K);
            int q=(0<=y[j]&&y[j]<K);
            if(p ^ q==m[j])
            {
                cnt++;
                y1[y[j]]++;
            }
            else 
                y1[y[j]]--;
        }
        for(int j=0;j<=K;j++)
        {
            if(cnt>Max)Max=cnt;
            if(N-cnt>Max) Max=N-cnt;
            if(j!=K)
                cnt=cnt-y1[j]-y1[K+j];
        }
    }
    printf("%d\n",Max);
}

Measured memory_bytes: 1408
package main

import (
	"fmt"
)

func main() {
	var N, K int
	fmt.Scanf("%d %d", &N, &K)
	ans := 0
	for b := K + 1; b <= N; b++ {
		I := (N - K) / b
		yaju := 0
		if b - K < N - K - I * b + 1 {
			yaju += b - K
		} else {
			yaju += N - K - I * b + 1
		}
		yaju += (b - K) * I
//		fmt.Printf("%d\n", yaju)
		ans += yaju
	}
	if K == 0 {
		ans -= N
	}
	fmt.Printf("%d\n", ans)
	return
}


Measured memory_bytes: 512
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define FAST  ios_base::sync_with_stdio(0);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 ll long long int 
#define ar array
#define pb push_back
#define fi(a,b) for(ll i=a;i<(b);i++)
#define fj(a,b) for(ll j=a;j<(b);j++)
#define fk(a,b) for(ll k=a;k<(b);k++)

const int mod=998244353;
const int mxn=2e5+2;
int n,k;
vector<int> dp(mxn);
struct node
{
	ll s,m,lz;
} st[1<<19];


void update(int index,int val,int l2=0,int r2=n-1,int ci=0)
{
	if(l2==r2)
	{
		//st[ci].m=val;
		st[ci].s=val;
		return ;
	}
	int mid=(l2+r2)/2;
	if(index<=mid)
		update(index,val,l2,mid,2*ci+1);
	else
	{
		update(index,val,mid+1,r2,2*ci+2);
	}
	st[ci].s=(st[2*ci+1].s+st[2*ci+2].s)%mod;
	st[ci].m=min(st[2*ci+1].m,st[2*ci+2].m);
}
	
int query(int l1,int r1,int l2=0,int r2=n-1,int ci=0)
{
	if(l1<=l2&&r1>=r2)
	{
		return st[ci].s;
	}
	if(l2>r1||r2<l1)
	{
		return 0;
	}
	int mid=(l2+r2)/2;
	
	//return min(query(l1,r1,l2,mid,2*ci+1),query(l1,r1,mid+1,r2,2*ci+2));
	return (query(l1,r1,l2,mid,2*ci+1)+query(l1,r1,mid+1,r2,2*ci+2))%mod;
}

int main()
{
	FAST;
	//#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
	//#endif
	//int tt;
	//cin>>tt;
	//while(tt--)
	{
		cin>>n>>k;
		dp=vector<int> (n+1);
		dp[0]=1;
		update(0,1);
		vector<pair<int,int>> pairs;
		fi(0,k)
		{
			int l,r;
			cin>>l>>r;
			pairs.pb({l,r});
		}
		sort(pairs.begin(),pairs.end());
		fi(1 ,n)
		{
			fj(0,k)
			{
				if(i<pairs[j].first) break;
				int left=max(0LL,(i-pairs[j].second));
				int right=(i-pairs[j].first);
				dp[i]=(dp[i]+query(left,right))%mod;
				update(i,dp[i]);
			}
		}
		cout<<dp[n-1];
		
	}		
}


Measured memory_bytes: 16360
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
const long long LLINF = 1LL<<60;
const int INF = 1e9;
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; }
typedef long long ll;
#define pint pair<int,int>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

ll gcd(ll x, ll y){
    return y?gcd(y,x%y):x;
}

ll lcm(ll x, ll y){
    return x/gcd(x,y)*y;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, m; cin >> n >> m;
    vector<ll> v(n);
    rep(i,n) {
        cin >> v[i];
        v[i] /= 2;
    }

    ll lcmnum = 1;
    rep(i,n) {
        lcmnum = lcm(lcmnum,v[i]);
        if(m<lcmnum) {
            cout << 0 << endl;
            return 0;
        }
    }

    rep(i,n) {
        if((lcmnum/v[i])%2==0) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll ans = m / lcmnum;
    ans = (ans+1)/2;
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
long long dp[100005][5];
int main()
{
     int n,x,y,z,p,q,i;
     cin>>n;
     cin>>dp[1][1]>>dp[1][2]>>dp[1][3];
     for(i=2; i<=n; i++)
     {
            cin>>x>>y>>z;
            dp[i][1]=x+max(dp[i-1][2],dp[i-1][3]);
            dp[i][2]=y+max(dp[i-1][1],dp[i-1][3]);
            dp[i][3]=z+max(dp[i-1][2],dp[i-1][1]);
     }
       cout<< max(max(dp[n][1],dp[n][2]),dp[n][3])<<endl;
       return 0;
}


Measured memory_bytes: 7468
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define REP(i,k,n) for(int i = k; i < (int)(n); i++)
using namespace std;

int main(){
        int N;
        cin >> N;
        int ans = N;
        for ( int i = 0; i <= N; i++) {
                int item = 6;
                int p_c = 0;
                int dis = i;
                while (dis > 0) {
                        p_c += dis % item;
                        dis /= item;
                }

                item = 9;
                dis = N - i;
                while (dis > 0) {
                        p_c += dis % item;
                        dis /= item;
                }
                ans = min(ans,p_c);
        }
        cout << ans <<endl;
        return 0;
}


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

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

     set<string> kind;
    for(string i:p){
        kind.insert(i);
    }

    cout << kind.size() << endl;
 }


Measured memory_bytes: 25044
#ABC094-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=I()
A=IL()
A.sort()
ai=A[-1]
tA=A[:n-1]
aj=0
for i in range(n-1):
    aj=max(aj,min(tA[i],ai-tA[i]))
if aj in tA:
    print(ai,aj)
else:
    print(ai,ai-aj)

Measured memory_bytes: 62704
import collections

N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
cs = collections.Counter(s)
ct = collections.Counter(t)
ans = 0
for k in cs.keys():
#  print(k, cs[k], ct[k])
  c = cs[k] - ct[k]
  if c > ans:
    ans = c
print(max(ans, 0))

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

/*
   AtCoder contest code
   coder : yoichidon
 */

public class Main {
    public static String longer(String x, String y){
        if(x.length() > y.length()) return x;
        else return y;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] a = new int[N];
        for(int n=0; n<N; n++) a[n]=sc.nextInt();
        boolean[] taroWin = new boolean[K+1];
        Arrays.fill(taroWin,false);
        for(int k=1; k<=K;k++){
            for(int m:a) if(m<=k && !taroWin[k-m]) taroWin[k]=true;
        }

        System.out.println(taroWin[K] ? "First" : "Second");


    }
}


Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <limits.h>
#include <algorithm>
using namespace std;

int main(void){
    string s, t;
    bool ans = false;
    cin >> s;
    t = "AC";
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == t[0] && s[i + 1] == t[1]) ans = true;
    }
    if (ans) cout << "Yes";
    else cout << "No";
    return 0;
}


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

int N, K;
vector<int> S;

int main() {
    scanf("%d %d", &N, &K);
    S.resize(N);
    scanf("\n");
    for(int i = 0; i < N; i++) {
        char t; scanf("%c", &t);
        S[i] = t == 'A';
    }
    int pos = 0, inv = 0, cnt = 0, rcnt = 0;
    while(cnt < K && rcnt < N) {
        if(S[pos] ^ inv) {
            S[pos] ^= 1;
            cnt++;
        }
        else {
            pos = (pos + 1) % N;
            cnt++;
            rcnt++;
            inv ^= 1;
        }
    }
    if(cnt == K) {
        for(int i = 0; i < N; i++) {
            if(S[pos] ^ inv) printf("A");
            else printf("B");
            pos = (pos + 1) % N;
        }
    }
    else if(N % 2) {
        if((K - rcnt) % 2) {
            printf("B");
            pos = (pos + 1) % N;
            for(int i = 1; i < N; i++) {
                if(S[pos] ^ inv) printf("A");
                else printf("B");
                pos = (pos + 1) % N;
            }
        }
        else {
            for(int i = 0; i < N; i++) {
                if(S[pos] ^ inv) printf("A");
                else printf("B");
                pos = (pos + 1) % N;
            }
        }
    }
    else {
        for(int i = 0; i < N; i++) {
            if(S[pos] ^ inv) printf("A");
            else printf("B");
            pos = (pos + 1) % N;
        }
    }
}


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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;

#define LINF		((ll)1 << 63 -1)
#define INF 		2000000007
#define MINF		-2000000007
#define MAX 		100005

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//



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

	int dx = tx-sx;
	int dy = ty-sy;

	// one
	REP(i,dy)cout << "U";
	REP(i,dx)cout << "R";

	// two
	REP(i,dy)cout << "D";
	REP(i,dx)cout << "L";

	// third
	cout << "L";
	REP(i,dy+1)cout<<"U";
	REP(i,dx+1)cout<<"R";
	cout << "D";

	// forth
	cout << "R";
	REP(i,dy+1)cout << "D";
	REP(i,dx+1)cout << "L";
	cout << "U";

	return 0;
}




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

int main(void) {
    int N,D;
    cin>>N>>D;
    int X[N+1][D+1];
    // 点の代入
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= D; j++) {
            int x;
            cin>>x;
            X[i][j] = x;
        }
    }

    // 走査
    int result = 0;
    for (int i = 1; i <= N - 1; i++) {
        for (int j = i + 1; j <= N; j++) {
            // iとjの距離を求める
            double dist_sqr = 0;
            for (int k = 1; k <= D; k++) {
                dist_sqr += pow(X[i][k] - X[j][k], 2);
            }
            double dist = sqrt(dist_sqr);
            int dist_i = dist;
            if (dist_i * dist_i == dist_sqr) result++;
        }
    }

    // 出力
    cout << result << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	long long int x,y,temp,X,cnt;
	while(1){
		cnt=0;
		scanf("%lld %lld",&x,&y);
		if(x==0&&y==0)break;
		if(x<=y){
			temp=x;
			x=y;
			y=temp;
		}
		while(1){
			if(y==0)break;
			cnt++;
			X=x%y;
			x=y;
			y=X;
		}
		printf("%lld %lld\n",x,cnt);
	}
	return 0;
}	

Measured memory_bytes: 1028
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

deque<int> deq;
vector<int> G[100010];
bool isvisit[100010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    rep(i, M) {
        int s, t;
        cin >> s >> t;
        s--; t--;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    deq.push_back(0);
    
    while(true) {
        int k = deq.back();
        isvisit[k] = true;
        bool isupdate = false;
        for(auto to: G[k]) {
            if(isvisit[to]) continue;
            isupdate = true;
            deq.push_back(to);
            break;
        }
        if(!isupdate) break;
    }
    while(true) {
        int k = deq.front();
        isvisit[k] = true;
        bool isupdate = false;
        for(auto to: G[k]) {
            if(isvisit[to]) continue;
            isupdate = true;
            deq.push_front(to);
            break;
        }
        if(!isupdate) break;
    }
    cout << deq.size() << endl;
    rep(i, deq.size()) {
        if (i != 0) cout << " ";
        cout << deq[i] + 1;
    }
    cout << endl;

    return 0;
}


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

int main(){
  int n, k;
  scanf("%d %d", &n, &k);
  vector<ll> a(n);
  rep(i, n)scanf("%lld", &a[i]);
  
  ll ans = pow(10, 11);
  int count;
  ll sub, minimum;
  
  rep(i, pow(2, n)){
    count = 1;
    sub = 0;
    minimum = a[0];
    
    reps(j, 1, n){
      if (a[j] > minimum){
        minimum = a[j];
        count++;
        continue;
      }
      if ((i>>j)&1){
        count++;
        minimum++;
        sub += minimum-a[j];
      }
    }
    if ((count >= k) and (ans > sub)){
      ans = sub;
    }
  }
    
  
  printf("%lld\n", ans);
  
  return 0;
}

Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
#define N (int)1e5+1
#define INF 2e9
#define MP make_pair
#define F first
#define S second
typedef pair<int, int> P;
int V, E;
vector<int> path[N];
int flag[N], x_min[N], depths[N], y_min;
int y;
int dfs(int s, int from, int depth){
    x_min[s] = depth;
    depths[s] = depth;
    if(path[s].size() == 1){
        return x_min[s];
    }
    for(auto i = path[s].begin(); i != path[s].end();i++){
        if(!x_min[*i]){
            int z_min = dfs(*i, s, depth + 1);
            if(x_min[s] > z_min){
                x_min[s] = min(z_min, x_min[s]);
            }
            if(depths[s] <= z_min && x_min[s] != x_min[*i]){
                flag[s] = 1;
                if(path[*i].size() != 1){
                    flag[*i] = 1;
                }
            }
        }
        else if(*i != from){
            x_min[s] = min(depths[*i], x_min[s]);
        }
    }
    return x_min[s];
}


int main(){
    cin >> V >> E;
    for(int i = 0; i < E; i++){
        int temp, temp2;
        cin >> temp >> temp2;
        path[temp].push_back(temp2);
        path[temp2].push_back(temp);
    }
    for(int i = 0; i < V; i++){
        if(path[i].size() > 1){
            dfs(i, i, 1);
            break;
        }
    }

    // for(int i = 0; i < V; i++){
    //     if(path[i].size() == 1){
    //         continue;
    //     }
    //     for(auto j = path[i].begin(); j != path[i].end(); j++){
    //         if(x_min[i] != x_min[*j]){
    //             flag[i] = 1;
    //             cout << i << " ";
    //             if(path[*j].size() > 1){
    //                 flag[*j] = 1;
    //                 cout << *j << " ";
    //             }
    //         }
    //     }
    //     cout << endl;
    //    if(flag[i]){
    //  //     cout << i << endl;
    //    }
    //  //cout << x_min[i] << endl;
    // }

    for(int i = 0; i < V; i++){
       if(flag[i]){
          cout << i << endl;
       }
  //       cout << x_min[i] << endl;
    }
    
}


Measured memory_bytes: 6816
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)
ll a[200005];
vector<int>g[200005];
ll dp[200005];
ll sum[200005];
void edge()
{
	int u,v;
	cin>>u>>v;
	
    g[v].pb(u);
    g[u].pb(v);

}
ll ans;

void dfs(int s,int p)
{
	
    ll x=0;
	for(int i=0;i<g[s].size();i++)
	{
	    if(g[s][i]==p)
		continue;	
	    dfs(g[s][i],s);
	    dp[s]=max(dp[s],dp[g[s][i]]);
	

	}
    dp[s]=max(dp[s],sum[s]);

	vector<ll>v;
	
	for(int i=0;i<g[s].size();i++)
	{
		if(g[s][i]==p)
		continue;
		v.pb(dp[g[s][i]]);
	}
	sort(all(v));
	reverse(all(v));
	if(v.size()>=2)
	ans=max(ans,v[0]+v[1]);
	
	
	
}

void dfs1(int s,int p)
{
	sum[s]=a[s];
	for(int i=0;i<g[s].size();i++)
	{
		if(g[s][i]==p)
		{
			continue;
		}
		dfs1(g[s][i],s);
		sum[s]+=sum[g[s][i]];
		
	}
}

int main(){

    fast;
    int T;
    T=1;
    //cin>>T;
    while(T--){
    	int x;
    	cin>>x;
    	if(360%x==0)
    	{
    		cout<<360/x;
    		
		}
		else
		{
			cout<<360/__gcd(360,x);
			
			
		}
    	
		
		
		
		
    
    }

}

Measured memory_bytes: 8344
//解説あり
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

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

using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;


int main(void) {
    int sx, sy, tx, ty;
    scanf("%d %d %d %d", &sx, &sy, &tx, &ty);
    int dx = tx - sx, dy = ty - sy;
    
    rep(i, 0, dx) printf("R");
    rep(i, 0, dy) printf("U");
    
    rep(i, 0, dx) printf("L");
    rep(i, 0, dy) printf("D");
    
    printf("D");
    rep(i, 0, dx+1) printf("R");
    rep(i, 0, dy+1) printf("U");
    printf("L");
    
    printf("U");
    rep(i, 0, dx+1) printf("L");
    rep(i, 0, dy+1) printf("D");
    printf("R");
    

    return 0;
}



Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = (ll)(1e9+7);
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(int)(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int r;

signed main(){
    cin >> r;
    cout << r*r << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(){
  while(1){
    int x,n,count=0;
    cin>>n>>x;
    if(x==0&&n==0)break;

    for(int i=1;i<=n;i++){
      for(int j=i;j<=n;j++){
	for(int k=j;k<=n;k++){
	  if(i+j+k==x && i!=j&&i!=k&&j!=k)count++;
	  
      
	}
      }
    }
    cout<<count<<endl;	
    
  }
  
  
}
    



Measured memory_bytes: 3068
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int h,w,n;
    cin >> h >> w >> n;
    if (h < w) swap(h,w);
    cout << (n + h - 1) / h << endl;
}

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

Measured memory_bytes: 256
//winnable
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<long long> a(n),count(n);
	for(int i =0;i<n;i++)
	{
		cin>>a[i];
		count[a[i]-1]++;
	}
	long long ans = 0;
	for(int i =0;i<n;i++)
	{
		ans+= (count[i]*(count[i]-1))/2;
	}
	for(int i =0;i<n;i++)
	{
			cout<<ans-count[a[i]-1]+1<<'\n';
	}
}


Measured memory_bytes: 5760
n,k = map(int,input().split())
line = list(map(int,input().split()))
 
inf = float('inf')
line.extend([inf for i in range(k)])
box = [inf for i in range(n + k)]
#out of rangeを避けるため

box[0] = 0
for x in range(n):   
  for i in range(1,k+1):
    cost = abs(line[x] - line[x+i])
    if box[x+i] >= box[x] + cost:
      box[x+i] = box[x] + cost
print(box[n-1])

Measured memory_bytes: 61152
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String l1 = scan.nextLine();
		scan.close();

		String S = l1;
		int N = S.length();

		String source = S;
		if (!judge(source)) {
			System.out.println("No");
			return;
		}

		source = S.substring(0, (N - 1) / 2);
		if (!judge(source)) {
			System.out.println("No");
			return;
		}

		source = S.substring(((N + 3) / 2) - 1, N);
		if (!judge(source)) {
			System.out.println("No");
			return;
		}

		System.out.println("Yes");
	}

	static boolean judge(String source) {
		char[] cArray = source.toCharArray();

		boolean result = true;

		for (int i = 0; i < ((cArray.length + 1) / 2); i++) {
			char a = cArray[i];
			char b = cArray[cArray.length - 1 - i];
			if (a != b) {
				result = false;
				break;
			}
		}

		return result;
	}
}

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

const int inf = 1000000;
int a,b;
int main(){
	cin >> a >> b;
	int u = (a + b - 1);
	int d = (b - a + 1);
	u = min(u, inf);
	d = max(d, -inf);
	for(int i=d;i<=u;i++) cout << i << ' ';
	return 0;
}

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

#define ALL(a) a.begin(),a.end()

using namespace std;

int main()
{
  unsigned a = 1, b;

  while ( cin >> a >> b ) {
    int c = 1, n = a + b;
    if ( n == 0 ) {
      cout << 0 << endl;
      continue;
    }
    while ( n /= 10 )
      c++;
    cout << c << endl;
  }

  return 0;
}

Measured memory_bytes: 1156
using System;
using System.Linq;

namespace ABC129D
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] HW = CIN.LongArray();
            long H = HW[0];
            long W = HW[1];
            string[] grid = new string[H];
            for (int i = 0; i < H; i++)
            {
                grid[i] = CIN.String();
            }
            
            int[][] horizontal = new int[H][];

            for (int y = 0; y < H; y++)
            {
                horizontal[y] = new int[W];
                int count = 0;
                for (int x = 0; x < W; x++)
                {
                    if (grid[y][x] == '.')
                    {
                        count++;
                        continue;
                    }

                    if (grid[y][x] == '#')
                    {
                        for (int i = 0; i < count; i++)
                        {
                            horizontal[y][x - i - 1] = count;
                        }

                        count = 0;
                    }
                }

                for (int i = 0; i < count; i++)
                {
                    horizontal[y][W - i - 1] = count;
                }
            }

            int score = 0;
            for (int xx = 0; xx < W; xx++)
            {
                int count = 0;
                for (int yy = 0; yy < H; yy++)
                {
                    if (grid[yy][xx] == '.')
                    {
                        count++;
                        continue;
                    }

                    if (grid[yy][xx] == '#')
                    {
                        for (int i = 0; i < count; i++)
                        {
                            score = Math.Max(score, horizontal[yy - i - 1][xx] + count - 1);
                        }

                        count = 0;
                    }
                }

                for (int i = 0; i < count; i++)
                {
                    score = Math.Max(score, horizontal[H - i - 1][xx] + count - 1);
                }

            }
            Console.WriteLine(score);
        }
    }

    internal static class CIN
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

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

ll cal(int k, vector<ll> var){
  ll ans=0;
  for(int p=0; p<k-2; p++){
    for(int q=p+1; q<k-1; q++){
      for(int r=q+1; r<k; r++){
        ans+=var[p]*var[q]*var[r];
      }
    }
  }
  return ans;
}

int main(){
  int n;
  cin>>n;
  map<char,ll> mp;
  rep(i,n){
    string s;
    cin>>s;
    if(s[0]=='M') mp['M']++; 
    if(s[0]=='A') mp['A']++;
    if(s[0]=='R') mp['R']++;
    if(s[0]=='C') mp['C']++;
    if(s[0]=='H') mp['H']++;
  }
  int kind=0;
  vector<ll> var;
  if(mp['M']!=0) {kind++; var.push_back(mp['M']);}
  if(mp['A']!=0) {kind++; var.push_back(mp['A']);}
  if(mp['R']!=0) {kind++; var.push_back(mp['R']);}
  if(mp['C']!=0) {kind++; var.push_back(mp['C']);}
  if(mp['H']!=0) {kind++; var.push_back(mp['H']);}
  ll ans=0;
  if(kind>=3){
    ans=cal(kind,var);
  }
  cout<<ans<<endl;
}



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

#define MOD (long long)(1E9+7)
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
	string s;
  	cin >> s;
  	int aa, bb;
  	aa = (int)(s[0] - '0') * 10 + (int)(s[1] - '0');
  	bb = (int)(s[2] - '0') * 10 + (int)(s[3] - '0');
  	bool YYMMflag = false, MMYYflag = false;
  	if(bb>0 && bb <= 12) YYMMflag = true;
  	if(aa>0 && aa <= 12) MMYYflag = true;
  	if(YYMMflag && MMYYflag) {
    	cout << "AMBIGUOUS" << endl; 
    } else if(YYMMflag) {
     	cout << "YYMM" << endl; 
    } else if(MMYYflag) {
        cout << "MMYY" << endl;
    } else {
        cout << "NA" << endl; 
    }
}

Measured memory_bytes: 3572
#include<iostream>
#include<cstring>
#include<stdio.h>
#include<algorithm>
#include<math.h>

using namespace std;

const int mod = 1e9+7;
const int AC=100010;

long long n,ans,res=1;
long long a[AC],b[AC],t[AC],s[AC];

inline void read(long long &x)
{
	long long f=1;
	char s=getchar();
	x=0;
	while ( s<'0' || s>'9' )
	{
		if ( s=='-' ) f=-1;
		s=getchar();
	}
	while ( s>='0' && s<='9' )
	{
		x=x*10+s-'0';
		s=getchar();
	}
	x*=f;
}

inline long long quick(long long a,long long b)
{
	long long base=a,ans=1;
	while ( b )
	{
		if ( b&1 ) ans=ans*base%mod;
		base=base*base%mod;
		b>>=1;
	}
	return ans;
} 

long long inv(long long n){
	return quick(n, mod-2);
}

int main(){
	read(n);
	for ( int i=1;i<=n;i++ )
	{
		read(a[i]);
		s[i]=(s[i-1]+inv(i))%mod;
	}
	for ( int i=1;i<=n;i++ )
	{
		b[i]=(s[n-i+1]+s[i]-1)%mod;
	}	
	for ( int i=1;i<=n;i++ )
	{
		t[i]=(b[i]*a[i])%mod;
		ans=(ans+t[i])%mod;
		res=(res*i)%mod;
	}
	ans=(ans*res)%mod;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD=1000000007;
const long double PI=3.14159265358979;

int main() {
  ll N,ans=1;
  cin>>N;
  vector<string> a(N);
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  for(int i=0;i<N-1;i++){
    if(a[i]!=a[i+1]){
      ans++;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 9600
import java.util.Scanner;

public class Main
{	
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int  toppingN   = sc.nextInt();
		int  valBase    = sc.nextInt();
		int  valTopping = sc.nextInt();
		int  calBase    = sc.nextInt();
		int[]calTopping = new int[toppingN];
		
		for(int i=0; i<toppingN; i++)
			calTopping[i] = sc.nextInt();
		java.util.Arrays.sort(calTopping);

		int currCal =calBase;
		int currVal =valBase;
		for(int i=toppingN-1; i>=0; i--)
		{
			int nextCal = currCal +calTopping[i];
			int nextVal = currVal +valTopping;
			
			if( ((double)nextCal/nextVal) > ((double)currCal/currVal) )
			{
				currCal = nextCal;
				currVal = nextVal;
			}
			else break;
		}
		System.out.println(currCal/currVal);
	}
}

Measured memory_bytes: 18124
fun main(args: Array<String>) {
  val (k, s) = readLine()!!.split(" ").map(String::toInt)
  var ans = 0
  for (x in 0..k) {
    if( x + 2*k < s) continue
    for (y in 0..k){
      if( x + y + k < s) continue
      val z = s - x - y
      if (z in 0..k) ans++
    }
  }
  println(ans)
}

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

ans_1 = [a for _ in range(b)]
ans_1 = "".join(map(str, ans_1))
ans_2 = [b for _ in range(a)]
ans_2 = "".join(map(str, ans_2))

if ans_1 < ans_2:
    print(ans_1)
else:
    print(ans_2)

Measured memory_bytes: 3060
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader();  
        String S = r.s();
        int n = S.length();
        int t = n;
        for(int k = 1; k < n; k++)
            if(S.charAt(k-1) != S.charAt(k))
                t = Math.min(Math.max(k, n-k), t);
        println(t);            
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long.parseLong(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 23380
using System;
namespace test
{
  class program
  {
    static void Main()
    {
    int ans = 0;
    string[] str = Console.ReadLine().Split(' ');
    int a = int.Parse(str[0]);
    int b = int.Parse(str[1]);
    int c = int.Parse(str[2]);
    for (int i = a; i <= b; i++)
    {
      if (c % i == 0)
      {
        ans++;
      }
    }
    Console.WriteLine(ans);
    }
  }
}
  

Measured memory_bytes: 9208
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int acnt = 0;
        long sum = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == 'A') {
                acnt++;
            } else if (c == 'B' && i < s.length() - 1 && s.charAt(i + 1) == 'C') {
                sum += acnt;
                i++;
            } else {
                acnt = 0;
            }
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 40580
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(dead_code)]
fn practice_1() {
    input! {
    n: i32,
    m: [i32; 2],
    s: chars,
    }
    let s: Vec<char> = s;
    let s: String = s.into_iter().collect();

    println!("{} {}", n + m[0] + m[1], s);
}

#[allow(dead_code)]
fn abc086_a() {
    input! {
    n: [i32; 2],
    }
    let n: Vec<i32> = n;
    let res: i32 = n[0] * n[1];
    let res = if res % 2 == 0 {
        "Even"
    } else {
        "Odd"
    };
    println!("{}", res)
}

fn main() {
    abc086_a()
}



Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
/********************************************************************************************************************************/
/* main *************************************************************************************************************************/
/********************************************************************************************************************************/
int DEBUG = 0;										/* デバッグプリント 提出時は0 */
int main()
{
	int		w,h,x,y,r,ans = 0;
	
	scanf("%d %d %d %d %d", &w,&h,&x,&y,&r);

	if (x-r >= 0) ans++;
	if (x+r <= w) ans++;
	if (y-r >= 0) ans++;
	if (y+r <= h) ans++;

	if (ans==4) printf("Yes\n");
	else        printf("No\n");
	
	return 0;
}



Measured memory_bytes: 2108
#include<iostream>
#include<vector>
using namespace std;
vector<int>G[8];
long dp[1<<8][8];
main()
{
	long cnt=0;
	int n,m;cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;cin>>a>>b;
		a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dp[1][0]=1;
	for(int i=1;i<1<<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			for(int k=0;k<G[j].size();k++)
			{
				int b=G[j][k];
				if(i&(1<<b))continue;
				dp[i|(1<<b)][b]+=dp[i][j];
			}
		}
	}
	for(int i=0;i<n;i++)cnt+=dp[(1<<n)-1][i];
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
static const int MAX = 50;
int main() {
    int h, w;
    string grid[MAX + 1];

    cin >> h >> w;
    for (int i = 0; i < h; ++i) {
        cin >> grid[i];
    }

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

    bool canDraw = true;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (grid[i][j] != '#') continue;
            bool can = false;
            for (int k = 0; k < 4; ++k) {
                int ni = i + dy[k];
                int nj = j + dx[k];
                if (ni < 0 or h <= ni) continue;
                if (nj < 0 or w <= nj) continue;
                if (grid[ni][nj] == '#') {
                    can = true;
                    break;
                }
            }
            if (!can) {
                canDraw = false;
                break;
            }
        }
    }
    if (canDraw) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
/* abc_170_a */

#include<stdio.h>
#include<math.h>

int main()
{
  int N;
  int i;
  int zero=0;
  long long s;
  long long A[100000];
  scanf("%d",&N);
  s=1;
  for(i=0;i<N;i++){
    scanf("%lld",&A[i]);
  }
  for(i=0;i<N;i++){
    if(A[i]==0) zero++;
  }
  if(zero>0){
    printf("0\n");
    return 0;
  }
  for(i=0;i<N;i++){
    if(A[i]<=1000000000000000000/s){
      s*=A[i];
    }else{
      printf("-1\n");
      return 0;
    }
  }
  printf("%lld\n",s);
  return 0;      
}


Measured memory_bytes: 2504
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  map<char,bool> list;
  for (int i=0; i<26; i++) {
    list['a'+i] = true;
  }
  char c;
  for (int i=0; i<s.size(); i++) {
    c = s.at(i);
    list[c] = false;
  }
  for (auto x:list) {
    if (x.second) {
      cout << x.first << endl;
      return 0;
    }
  }
  cout << "None" << endl;
}

Measured memory_bytes: 512
def make_divisors(n):
    divisors = []

    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    return divisors


N = int(input())

ans = 0
for i in range(1, N + 1, 2):
    if len(make_divisors(i)) == 8:
        ans += 1
print(ans)


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

int main(){
  ll N;
  cin >> N;

  ll sum = 0;
  for(ll i=1; i<N+1; i++){
    if((i%3==0) || (i%5==0)){
      continue;
    }
    sum += i;
  }
  cout << sum << endl;
}

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

using u32 = uint32_t;
using u64 = uint64_t;
using i32 = int32_t;
using i64 = int64_t;

int main()
{
	std::string s;

	std::cin >> s;

	i32 n = s.size();
	i32 res = 0;

	std::string prev = s.substr(0, 1);
	i32 i = 1;
	while(true)
	{
		std::clog << "n-i=" << (n-i) << "\n";
		bool found = false;
		for(i32 j=1;j<n-i+1;j++)
		{
			std::string cur = s.substr(i, j);
			
			if(prev != cur)
			{
				std::clog << prev << " != " << cur << "\n";
				prev = cur;
				i+=j;
				res++;
				found = true;
				break;
			}
		}
		if(!found) break;
		if(i >= n) break;
	}

	std::cout << res+1 << "\n";
	
	return 0;
}

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

int main() {
  
  int n;
  string s, message = "Three";
  
  cin >> n;
  
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s == "Y") {
      message = "Four";
      break;
    }
  }
  
  cout << message << endl;
}

//桃色を P、白色を W、緑色を G、黄色を Y 


Measured memory_bytes: 256
import math as ma

n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

d = [int(0)]*4 #m,e,p3,t
tmp = int(0)
tmp2 = int(0)
tmp3 = [int(0)]*n

for i in range(n):
    d[0] += abs(x[i]-y[i])
    tmp += (x[i]-y[i])**2
    tmp2 += (abs(x[i]-y[i]))**3
    tmp3[i] = abs(x[i]-y[i])

d[1] = ma.sqrt(tmp)
d[2] = (tmp2)**(1/3)
d[3] = max(tmp3)

for i in range(4):
    print(d[i])



Measured memory_bytes: 5692
#include<iostream>
using namespace std;
int main(){
int h,w;
while(1){
cin >> h >> w;
if(h==0 && w==0)break;
for(int i=1; i<=h; i++){
for(int j=1; j<=w; j++){
cout << "#";
}
cout <<endl;
}
cout <<endl;
}
return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
main () {
  int N;
  cin >> N;
  int i = 1;
 
  int sum = 0;
  int sa = 0;
  
 
  while (i <= N) {
    int l, r;
    cin >> r >> l;
   
   
    sum = l - r + sum + 1;
    i++;
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int count = sc.nextInt();
        int time = sc.nextInt();
        int[] history = new int[count];
        for (int i = 0; i < count; i++) {
            history[i] = sc.nextInt();
        }
        long total = 0;
        long beforeTime = 0;
        long afterTime = 0;
        long diffTime = 0;
        for (int i = 1; i < history.length; i++) {
            beforeTime = history[i - 1];
            afterTime = history[i];
            diffTime = (afterTime - beforeTime);
            if (diffTime < time) {
                total += diffTime;
            } else {
                total += time;
            }
        }
        total += time;
        System.out.println(total);

    }

}


Measured memory_bytes: 63952
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

ll a[20][20];
ll cost[1<<16];
ll dp[1<<16];

int main()
{
    ll n;
    cin >> n;
    rep(i,n){
        rep(j,n){
            cin >> a[i][j];
        }
    }
    dp[0]=0;
    for(ll s=1;s<(1<<n);s++){
        for(ll i=0;i<n;i++){
            for(ll j=i+1;j<n;j++){
                if((s>>i)%2==0) continue;
                if((s>>j)%2==0) continue;
                cost[s]+=a[i][j];
            }
        }
    }
    //cout << cost[(1<<n)-1] << endl;
    for(ll s=1;s<(1<<n);s++){
        for(ll t=s;t>0;t=(t-1)&s){
            dp[s]=max(dp[s],dp[s-t]+cost[t]);
        }
    }
    cout << dp[(1<<n)-1] << endl;
    return 0;
} 

Measured memory_bytes: 1280
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <queue>
#include <cstring>
using namespace std;

int main() {
	long long N, K,x=0,mod=1000000007; cin >> N >> K;
	vector<long long> A(N);
	for (int i = 0; i < N; i++)cin >> A[i];
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (A[i] > A[j]&&i<j) {
				x += (K * (K + 1)) / 2;
				x %= mod;
			}
			if (A[i]>A[j] && i>j) {
				x += (K * (K - 1)) / 2;
				x %= mod;
			}
		}
	}
	cout << x << endl;
	
}





Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int X,A,B,dif,buf;
    int olddif;
    scanf("%d%d%d",&X,&A,&B);
    dif = X - A ;
    while( (dif) >= 0 ){
        olddif = dif;
        buf = dif - B ;
        dif = buf;
    }
    printf("%d\n",olddif);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>

typedef long long ll;

ll count(ll T1, ll T2, ll A1, ll A2, ll B1, ll B2) {
    if ((A1 - B1)*T1 < (B2 - A2)*T2) {
        return count(T1, T2, B1, B2, A1, A2);
    }

    if (A1*T1 > B1*T1) return 0;
    if (A1*T1 == B1*T1) return 1;
    ll d1 = (B1 - A1)*T1;
    ll d = (A1 - B1)*T1 + (A2 - B2)*T2;
    

    if (d1 % d == 0) {
        ll x = d1 / d;
        return 2*x;
    } else {
        ll x = (d1 / d) + 1;
        return 2*x - 1;
    }
}

int main(int argc, char const *argv[])
{
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);

    ll T1, T2, A1, A2, B1, B2;
    std::cin >> T1 >> T2;
    std::cin >> A1 >> A2;
    std::cin >> B1 >> B2;

    if ((A1 - B1)*T1 == (B2 - A2)*T2) {
        std::cout << "infinity" << std::endl;
        return 0;
    }

    std::cout << count(T1, T2, A1, A2, B1, B2) << std::endl;
    return 0;
}


Measured memory_bytes: 256