akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int N, K, C; 
  cin >> N >> K >> C;

  string s;
  cin >> s;

  vector<int> R(N), L(N);

  int p = 1;
  REP(i, N){
    if(s[i] == 'o'){
      L[i] = p++;
      i += C;
    }
  }
  RREP(i, N){
    if(s[i] == 'o'){
      R[i] = --p;
      i -= C;
    }
  }

  vector<int> ans;
  REP(i, N){
    if(L[i] != 0 && L[i] == R[i]) ans.emplace_back(i+1);
  }

  if(ans.size() <= K){
    REP(i, ans.size()){
      cout << ans[i] << "\n";
    }
  }

  return 0;
}

Measured memory_bytes: 8568
#include <stdio.h>
#include <cstdio>
#include <string>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>



int main()
{

	int N;
	scanf("%d", &N);

	if (N % 10 == 9 ||
		N / 10 == 9) puts("Yes");
	else puts("No");

	return 0;
}

Measured memory_bytes: 256
import numpy as np
N, M = map(int,input().split())
kinds = np.zeros(M)
for _ in range(N):
    inputs = input().split()
    K = inputs[0]
    A = inputs[1:]
    for a in A:
        kinds[int(a)-1] += 1
N = len(kinds[np.where(kinds==N)])
print(N)

Measured memory_bytes: 12500
S = input()
list_atgc = ["A", "C", "G", "T"]
demand_list = []
for i in range(len(S)):
    if S[i] in list_atgc:
        j = 0
        string_k = ""
        while True:
            if S[i+j] in list_atgc:
                string_k += S[i+j]
                demand_list.append(string_k)
                j += 1
                if i + j >= len(S):
                    break
            else:
                break
if demand_list:
    print(len(max(demand_list, key=len)))
else:
    print(0)

Measured memory_bytes: 3064
// デバッグ実行：Ctrl+F5

using System;

class Program
{
    static void Main(string[] args)
    {
        String line;
        line = Console.ReadLine();
        String[] words = line.Split(' ');
        int Saisyou = 10000;
        for(int i = 0; i < line.Length - 2; i++)
        {
            int X = int.Parse(line.Substring(i, 3));
            if (Saisyou > Math.Abs(753-X))
            {
                Saisyou = Math.Abs(753 - X);
            }
        }

        Console.WriteLine(Saisyou);
    }
}

Measured memory_bytes: 11092
using System;

public class Test
{
	static public void Main( )
	{
		const int S = 0;
		const int H = 1;
		const int C = 2;
		const int D = 3;		
		int n = int.Parse( Console.ReadLine() );
		int[,] shcd = new int[4, 13];
		for( int i=0; i<n; i++ ) {
			string[] strs = Console.ReadLine().Split( ' ' );
			int val = 0;
			switch( strs[0] ) {
				case "S":val = S;
					break;
				case "H":val = H;
					break;
				case "C":val = C;
					break;
				case "D":val = D;
					break;
			}
			shcd[ val, int.Parse( strs[1] )-1 ] = 1;
		}
		for( int i=0; i<4; i++ ) {
			for( int j=0; j<13; j++ ) {
				if( S == i && 0 == shcd[S,j] ) {
					Console.WriteLine( "S "+(j+1) );
				} else if( H == i && 0 == shcd[H,j] ) {
					Console.WriteLine( "H "+(j+1) );
				} else if( C == i && 0 == shcd[C,j] ) {
					Console.WriteLine( "C "+(j+1) );
				} else if( D == i && 0 == shcd[D,j] ) {
					Console.WriteLine( "D "+(j+1) );
				}
			}
		}
	}
}

Measured memory_bytes: 15944
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<stdio.h>
 
using namespace std;
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define ll long long

const int MOD = 1e9 + 7;

int main() {
    int a, b, n;
    cin >> a >> b;
    if(a + b == 15) {
        cout << "+" << endl;
    } else if(a * b == 15) {
        cout << "*" << endl;
    } else {
        cout << "x" << endl;
    }
}

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

const int mod=1e9+7;

long modpow(long x, long n)
{
    long res=1;
    for(; n>0; n>>=1) {
        if (n&1) res=res*x%mod;
        x=x*x%mod;
    }
    return res;
}

long nCr(long n, long r)
{
    long res=1;
    for(int i=0; i<r; ++i) res=res*(n-i)%mod;
    for(int i=1; i<=r; ++i) res=res*modpow(i, mod-2)%mod;
    return res;
}

int main()
{
    long n, a, b; cin>>n>>a>>b;

    cout<<((modpow(2, n)+mod-1)%mod-nCr(n, a)+mod-nCr(n, b)+mod)%mod<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// e.g. sort(all(a), [](int a1, int a2) { return a1 < a2; });
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

vector<ll> a;

int main() {
  ll k,n;
  cin >> k >> n;
  a.resize(n);
  rep(i,n) cin >> a[i];

  // となりあう家の間隔が最大の場所

  int m_diff = 0;
  rep(i,n) {
    // current
    if (i == n-1) {
      int diff = k- a[i] + a[0];
      m_diff = max(m_diff, diff);
    } else {
      int diff = a[i+1] - a[i];
      m_diff = max(m_diff, diff);
    }
  }
  
  cout << k - m_diff << endl;
  return 0;
}


Measured memory_bytes: 1792
s=input()
n=len(s)
ans=0
for i in range(2**(n-1)):
    l=[]
    bef=0
    for j in range(n-1):
        if ((i>>j)&1):
            l.append(int(s[bef:j+1]))
            bef=j+1
    l.append(int(s[bef:]))
    ans+=sum(l)

print(ans)


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

using namespace std;

int main(){

    string s;
    cin >> s;

    if(s == "A"){
        cout << "T" << endl;
    }else if(s == "T"){
        cout << "A" << endl;
    }else if(s == "G"){
        cout << "C" << endl;
    }else if(s == "C"){
        cout << "G" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;

template <class T> using V = vector<T>;

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

const long long INF = 1LL << 60;

using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;



#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define pb(a) push_back(a);



ll Sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}



const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}


#define comuse Comuse()

ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll perm(int n,int k){
    if(n < k) return 0;
    if(n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] % MOD) % MOD;
}


ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}


vll div(ll n){
  vll ret;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ret.push_back(i);
      if(i*i!=n){
        ret.push_back(n/i);
      }
    }
  }
  SORT(ret);
  return (ret);
}

ll modpow(ll a,ll n,ll mod){
  ll ans=1;
  while(n>0){
    if(n&1){
      ans=ans*a%mod;
    }

    a=a*a%mod;
    
    n>>=1;
  }

  return ans;
}

void Solve();


const int MAX_N = 131072;
//segment tree 
int NN;
int seg[MAX_N*2-1];
void seguse(){
  for(int i=0;i<2*NN-1;i++){
    seg[i]=INT_MAX;
  }
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout<<setprecision(20)<<fixed;
  Solve();
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
//segtreeの葉の先頭の添え字はn-1
void Solve(){
  ll x;
    cin>>x;
  ll n=x/100;//買える個数
  ll m=x%100;//きめてとなる数
  
  if(n>=100){
    cout<<1<<endl;
    return;
  }

  if((m+4)/5<=n){
    cout<<1<<endl;
    return;
  }

  cout<<0<<endl;
}

Measured memory_bytes: 256
L1 = list(map(int, input().split()))
for i in range(2):
	l = list(map(int, input().split()))
	sabun = None
	for j in range(3):
		if sabun == None:
			sabun = L1[j] - l[j]
		elif L1[j] - l[j] != sabun:
			print("No")
			exit()
print("Yes")


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

using namespace std;
const int MOD = 1000000007;

typedef long long Int;

Int dp[101][100000];
Int w[100000];

int main()
{
  int n, k;
  scanf("%d %d", &n, &k);
  
  vector<int> cands;
  for (int i = 1; i * i <= n; i++) {
    cands.push_back(i);
    if (i * i != n) cands.push_back(n / i);
  }
  sort(cands.begin(), cands.end());
  int m = cands.size();
  
  w[0] = 1;
  dp[0][0] = 1;
  for (int i = 1; i < m; i++) {
    w[i] = cands[i] - cands[i - 1];
    dp[0][i] = 1;
  }
  
  for (int i = 1; i <= k; i++) {
    for (int j = 0; j < m; j++) {
      int p = m - j - 1;
      dp[i][j] = dp[i - 1][p] * w[j] % MOD;
      if (j) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
    }
  }
  
  printf("%lld\n", dp[k][m - 1]);
  
  return 0;
}

Measured memory_bytes: 78844
from collections import defaultdict
from itertools import accumulate

n, m = map(int, input().split())
aa = list(map(int, input().split()))
counter = defaultdict(list)

cum = [0] * (m + 2)
ans_1 = 0
for a, b in zip(aa, aa[1:]):
    counter[b].append(a)
    cum[a + 1] += 1
    cum[b] += -1
    if a > b:
        cum[1] += 1
        ans_1 += b
    else:
        ans_1 += b - a

cum = list(accumulate(cum))

ans_prev = ans_1
ans_min = ans_1
for x in range(2, m + 1):
    ans_x = ans_prev
    px = x - 1
    if px in counter:
        ans_x += sum((px - a) % m - 1 for a in counter[px])
    ans_x -= cum[px]
    ans_min = min(ans_min, ans_x)
    ans_prev = ans_x
print(ans_min)


Measured memory_bytes: 24152
#include<bits/stdc++.h>
/* #define int long long */
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
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; }

signed main(){
    string s, t;
    cin >> s >> t;
    int tlen = t.size();
    int ans = 9999999;
    rep(i, s.size() - tlen + 1){
        string subs = s.substr(i, tlen);
        int tmp = 0;
        /* cout << subs << " "; */
        rep(j ,tlen){
            if(subs[j] == t[j]) tmp++;
        }
        int sa = tlen - tmp;
        /* cout << sa; */
        chmin(ans, sa);
        /* cout << endl; */
    }
    cout << ans << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for (int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for (int (i) = (a) - 1; (i) >= (b); (i)--)
#define PI acos(-1.0)
#define DEBUG(C) cout<< C <<endl;
#define VI vector <int>
#define VII vector <VI>
#define VL vector <LL>
#define VLL vector <VL>
#define VD vector <double>
#define VDD vector <VD>
#define PII pair <int, int>
#define PDD pair <double, double>
#define PLL pair <LL, LL>
#define VPII vector <PII>
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define REVERSE(a) reverse(ALL(a))
#define MP make_pair
#define EB emplace_back
#define FORE(a, b) for (auto &&a:b)
#define FIND(s, n) (s.find(n) != s.end())

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF = 1e9;
const int MOD = INF + 7;

string ss = "CODEFESTIVAL2016";

int main(void) {
    string s; cin >> s;
    int cnt = 0;
    REP(i, s.size()) {
        cnt += (s[i] != ss[i]);
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
    void run(){
        Scanner sc = new Scanner(System.in);
        while(true){
            String[] A = new String[21];
            String a = sc.next();
            int L = sc.nextInt();
            if(a.equals("0") && L == 0){
                break;
            }
            while(a.length() < L){
                a = "0" + a;
            }
            A[0] = a;
            for(int i = 1; i <= 20; i++){
                A[i] = func(A[i-1],L);
            }
            //System.out.println(Arrays.toString(A));
            String ans = ""; 
            for(int i = 0; i <= 20; i++){
                for(int ii = i+1; ii <= 20; ii++){
                    if(A[i].equals(A[ii])){
                        ans = i + " " + Integer.parseInt(A[i]) + " " + (ii - i);
                        break;
                    }
                }
                if(ans != ""){
                    break;
                }
            }
            System.out.println(ans);
        }    
    }
    String func(String a, int L){
        int[] array = new int[a.length()];
        for(int i = 0; i < a.length(); i++){
            array[i] = Integer.parseInt("" + a.charAt(i));
        }
        Arrays.sort(array);
        String big = "";
        String small = "";
        for(int num: array){
            big = num + big;
            small = small + num;
        }
        String next_a = "" + (Integer.parseInt(big) - Integer.parseInt(small));
        while(next_a.length() < L){
            next_a = "0" + next_a;
        }
        return next_a;
    }
    public static void main(String[] args){
        new Main().run();
    }
}

Measured memory_bytes: 25736
#include<iostream>
using namespace std;
int main()
{
   long long a,b,c,d;
   long long arr[4];
   long long max;

   cin>>a>>b>>c>>d;
   arr[0] = a*c;
   arr[1] = a*d;
   arr[2] = b*c;
   arr[3] = b*d;
  
   max = arr[0];
   for (int i = 1; i < 4; i++)
   {  
      if(max < arr[i])
         max = arr[i];
   }
     cout<<max; 
   


}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef tuple<long double,ll,ll> T;
const ll mod=1e9+7,INF=mod*mod*3;//M_PI
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define f first
#define s second
#define pb push_back
#define mp make_pair

ll N; 
ll ans;
ll Xs;
ll Ys;
T point[105];
long double angle(ll dx,ll dy){
	long double radian=atan2(dy, dx);
	radian=radian*(180.0/M_PI);
	if(radian<0) radian+=360.0;
	return radian;
}
ll calc(ll n1,ll n2){
	if(n1>=n2) swap(n1,n2);
	ll X=0;
	ll Y=0;
	ll X1=0;
	ll Y1=0;
	ll ret1=0;
	ll ret2=0;
	for(ll i=n1; i<=n2; i++){
		X+=get<1>(point[i]);
		Y+=get<2>(point[i]);
	}
	ret1=X*X+Y*Y;
	X1=Xs-X+get<1>(point[n1])+get<1>(point[n2]);
	Y1=Ys-Y+get<2>(point[n1])+get<2>(point[n2]);
	if(n1==n2){
		X1-=get<1>(point[n1]);
		Y1-=get<2>(point[n1]);
	}
	ret2=X1*X1+Y1*Y1;
	return max(ret1,ret2);
}

int main(){

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

cin>>N; 
rep(i,N){
	ll x,y;
	cin>>x>>y;
	point[i]=T(angle(x,y),x,y);
}
sort(point,point+N);
rep(i,N){
	Xs+=get<1>(point[i]);
	Ys+=get<2>(point[i]);
}
rep(i,N){
	rep(j,N){
		ans=max(ans,calc(i,j));
	}
}
cout<<fixed<<setprecision(30)<<sqrt(ans)<<endl;
//36.138621999185303934609692078084
//42.953463189829058421764784725383

}
	

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

int main() {
	string n;
	cin >> n;
	for (int i = 0;i < 3;++ i) n[i] = n[i] == '1' ? '9' : '1';
	cout << n;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

やるだけ
*/

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

int main(){
    double n, m, d;
    cin >> n >> m >> d;

    if(d==0){
        printf("%.10f",(m-1)/n);
    }else{
        printf("%.10f",(m-1)*2*(n-d)/(n*n));
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    N, K = MI()
    targets = LI()
    if N == 1:
        print(abs(targets[0]))
        return
    length = targets[K - 1] - targets[0]
    ans = length + min(abs(targets[K-1]), abs(targets[0]))
    for i in range(N-K + 1):
        length = targets[i + K - 1] - targets[i]
        cost = length + min(abs(targets[i+K-1]), abs(targets[i]))
        ans = min(ans, cost)

    print(ans)


main()


Measured memory_bytes: 87136
package main

import "fmt"

func main() {
	var (
		count int
		judge string
		ac    int
		wa    int
		tle   int
		re    int
	)
	fmt.Scan(&count)

	for i := 0; i < count; i++ {
		fmt.Scan(&judge)
		if judge == "AC" {
			ac++
		} else if judge == "WA" {
			wa++
		} else if judge == "TLE" {
			tle++
		} else {
			re++
		}
	}
	fmt.Println("AC x", ac)
	fmt.Println("WA x", wa)
	fmt.Println("TLE x", tle)
	fmt.Println("RE x", re)
}


Measured memory_bytes: 6320
#include <iostream>
#include <algorithm>
int main()
{
  int A, B, C, K, ans;
  std::cin >> A >> B >> C >> K;

  int xa = std::min(A, K);
  K = K - xa;
  int xb = std::min(B, K);
  K = K - xb;
  int xc = K;
  ans = xa - xc;
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define repeat(i,a,b) for(int i=(a),_=(b);i<_;i++)
#define repeat_back(i,a,b) for(int i=(b)-1,_=(a);i>=_;i--)
#define mst(a,a0) memset(a,a0,sizeof(a))
#define fi first
#define se second
#ifndef qwq
int cansel_sync=(ios::sync_with_stdio(0),cin.tie(0),0);
#endif
//mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const int N=200010; typedef long long ll; const int inf=~0u>>2; const ll INF=~0ull>>2; ll read(){ll x; if(scanf("%lld",&x)==-1)exit(0); return x;} typedef double lf; typedef long double llf; const lf pi=acos(-1.0); lf readf(){lf x; if(scanf("%lf",&x)==-1)exit(0); return x;} template<typename T> T sqr(const T &x){return x*x;} typedef pair<ll,ll> pii;
const int mod=(1?1000000007:998244353); ll mul(ll a,ll b,ll m=mod){return a*b%m;} ll qpow(ll a,ll b,ll m=mod){ll ans=1; for(;b;a=mul(a,a,m),b>>=1)if(b&1)ans=mul(ans,a,m); return ans;} ll getinv(ll v,ll m=mod){return qpow(v,m-2,m);}
//#define int ll
int x;
void Solve(){
	cin>>x;
	int d=__gcd(x,360);
	cout<<360/d<<endl;
}
signed main(){
	int T=1; //cin>>T;
	while(T--)Solve();
	return 0;
}

Measured memory_bytes: 3648
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  let res = 0;
  const input = lines.shift().split("");

  for (let bit = 0; bit < 1 << input.length; bit++) {
    let row: any[] = [];
    let num = "";
    let numArray = [];
    for (let i = 0; i < input.length; i++) {
      num += input[i];
      if (bit & (1 << i)) {
        numArray.push(Number(num));
        num = "";
        row.push(i);
      }
    }
    if (num) numArray.push(Number(num));

    if (row.indexOf(input.length - 1) !== -1) {
      const rowSum = numArray.reduce((ele, sum) => {
        return (sum += ele);
      }, 0);
      res += rowSum;
    }
  }

  console.log(res);
});


Measured memory_bytes: 11596
#include <iostream>
#include <math.h>
using namespace std;
const double pi=acos(-1.0);

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int max3(int a,int b,int c) {return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
int min3(int a,int b,int c) {return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

#define  f(i,n){for(int i=0;i<(int)(n);i++)}              ////for文



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

Measured memory_bytes: 3596
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod = 1e9 + 7;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	string s; cin >> s;
	bool f1 = false, f2 = false;
	for (auto i : s) {
		if (i == 'C') f1 = true;
		if (f1 && i == 'F') f2 = true;
	}
	cout << ((f1 && f2) ? "Yes" : "No");
	return 0;
}

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

using namespace std;

int main(void){
  while( true ){
    int n;
    long long int ans = 0;
    long long int sumWait = 0;
    vector<int> vwait;

    cin >> n;
    if(n == 0){
      break;
    }

    for(int i = 0; i < n; i++){
      int tmp;
      cin>>tmp;
      vwait.push_back(tmp);
    }

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

    for(int i = 0; i < n-1; i++){
      ans += sumWait = vwait[i] + sumWait;
    }

    cout<<ans<<'\n';

  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    int n;
    cin >> n;
    vector<int> a1(n),a2(n);
    rep(i,n) cin >> a1[i];
    rep(i,n) cin >> a2[i];
    int ans = 0;
    rep(i,n) {
        int now = 0;
        rep(j,i+1) now += a1[j];
        rep2(j,i,n) now += a2[j];
        chmax(ans,now);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstring>
#include <cstdlib>
#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 ABS(a) ((a)<0?(-(a)):(a))
#define CS while(cases())
#define I(n) int n = gi()
#define II(n) n = gi()
#define L(n) ll n = gli()
#define LL(n) n = gli()
#define F(i, n) for (int i = 0; i < n; i++)
#define Fa(n, a) for (int i = 0; i < n; i++) a[i] = gi()
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

template<class T>
T gcd(T a, T b) {
    return (b == 0 ? a : gcd(b, a%b));
}

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

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

int cases() {
    static int t = gi();
    return t--;
}

#define MD 1000000007

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char a[4];
    scanf("%s", a);
    printf(a[0] < 'a' ? "A\n" : "a\n");

    return 0;
}


Measured memory_bytes: 3808
//@author yash2040
#include<bits/stdc++.h>
using namespace std;
#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
#define int long long
#define pb push_back
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
void add_self(int& a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}
void sub_self(int& a, int b) {
    a -= b;
    if(a < 0) {
        a += mod;
    }
}
main()
{
//	fast();
 
	int n, k;
    cin>>n>>k;
    vector<int> dp(k + 1);
    // dp[i] - the number of ways such that we used i candies so far
    dp[0] = 1;
    for(int child = 0; child < n; ++child) {
        int up_to;
        cin>>up_to;
        vector<int> fake(k + 1);
        for(int used = k; used >= 0; --used) {
            int tmp = dp[used];
            int L = used + 1;
            int R = used + min(up_to, k - used);
            if(L <= R) {
               add_self(fake[L], tmp);
                if(R + 1 <= k) {
                   sub_self(fake[R+1],tmp);
                }
            }
            //~ for(int i = L; i <= R; ++i) {
                //~ add_self(dp[i], tmp);
            //~ }
        }
        int prefix_sum = 0;
        for(int i = 0; i <= k; ++i) {
           add_self(prefix_sum, fake[i]);
        add_self(dp[i], prefix_sum);
        }
    }
    
    cout<<dp[k];
 
	
}

Measured memory_bytes: 4708
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        n: usize, k: usize,
        h: [usize; n],
    }
    let mut cnt = 0;
    for i in 0..n {
        if h[i] >= k {
            cnt += 1;
        }
    }
    println!("{}", cnt);
}


Measured memory_bytes: 4352
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	int n;
	while(scanf("%d", &n), n){
		vi array(n);
		rep(i, n)
			scanf("%d", &array[i]);

		int cnt;
		for(cnt=0;; ++cnt){
			vi tmp(n, 0);
			rep(i, n) rep(j, n)
				tmp[i] += array[i] == array[j];
			bool changed = false;
			rep(i, n){
				if(array[i] != tmp[i]){
					changed = true;
					array[i] = tmp[i];
				}
			}
			if(!changed)
				break;
		}
		printf("%d\n", cnt);
		rep(i, n)
			printf("%s%d", i?" ":"", array[i]);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
#define df 0
int root(int v,int* uf);
void merge(int u,int v,int* uf);

int main(){
  if(df) printf("*debug mode*\n");
  int n,m;cin >> n>>m;
  int uf[n+m];
  for(auto& x:uf){
    x=-1;
  }
  for(int i=0;i<n;i++){
    int k; cin >>k;
    for(int j=0;j<k;j++){
      int l; cin >>l; l--;
      merge(l+n,i,uf);
    }
  }
  int r=root(0,uf);
  for(int i=0;i<n;i++){
    if(root(i,uf)!=r){
      printf("NO");
      return 0;
    }
  }
  printf("YES");
  return 0;
}

int root(int v,int* uf){
  if(uf[v]<0)return v;
  int u=root(uf[v],uf);
  uf[v]=u;
  return u;
}

void merge(int u,int v,int* uf){
  u=root(u,uf);v=root(v,uf);
  if(u==v)return;
  int w=(uf[u]<uf[v])?u:v;
  uf[w]--;
  uf[u+v-w]=w;
}

/// confirm df==0 ///


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+50;
ll n,m,k;
ll a[maxn],b[maxn];
int main()
{
	scanf("%lld%lld%lld",&n,&m,&k);
	memset(a,0,sizeof a);
	memset(b,0,sizeof b);
	for(int i=1;i<=n;++i)
	{
		scanf("%lld",&a[i]);
		a[i]+=a[i-1];
	}
	for(int i=1;i<=m;++i)
	{
		scanf("%lld",&b[i]);
		b[i]+=b[i-1];	
	}
	/*for(int i=0;i<=n;++i) cout<<a[i]<<" ";
	cout<<endl;
	for(int i=0;i<=m;++i) cout<<b[i]<<" ";
	cout<<endl;*/
	int maxx=0,cnt=m;
	for(int i=0;i<=n;++i)
	{
		if(a[i]<=k)
		{
			int l=0,r=cnt,mid;
			while(l<=r)
			{
				mid=(l+r)/2;
				if(a[i]+b[mid]>k) r=mid-1;
				else if(a[i]+b[mid]<k) l=mid+1;
				else 
				{
					r=mid;
					break;
				}
			}	
			maxx=max(r+i,maxx);	
			cnt=r;
		}	
	}	
	cout<<maxx<<endl;
	return 0;
}

Measured memory_bytes: 6748
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;

int main(){
  int N, A[200001], B[200001]={};
  cin>>N;
  for(int i=2; i<=N; i++) cin>>A[i];

  for(int i=2; i<=N; i++) {
    B[A[i]]++;
  }
  rep1(i, N) out(B[i]);
}


Measured memory_bytes: 5196
#include<stdio.h>

#define MIN(a,b) ((a)<(b)?(a):(b));
#define MAX(a,b) ((a)>(b)?(a):(b));

typedef long long int64;

int main(void){
    int a,b,c,d,e,k;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    scanf("%d",&d);
    scanf("%d",&e);
    scanf("%d",&k);
    if(e-a<=k){
        printf("Yay!");
        
    }else{
        printf(":(");
    }
    
    return 0;
}

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

class SegmentTreeDual():
    def __init__(self,arr,op=lambda x,y:y if y != -1 else x,ie=-1):
        self.h = (len(arr)-1).bit_length()
        self.n = 2**self.h
        self.ie = ie
        self.op = op
        self.val = [ie for _ in range(len(arr))]
        self.laz = [ie for _ in range(2*self.n)]
        for i in range(len(arr)):
            self.val[i] = arr[i]
    def propagate(self,k):
        if self.laz[k] == self.ie:
            return
        if self.n <= k:
            self.val[k-self.n] = self.op(self.val[k-self.n],self.laz[k])
            self.laz[k] = self.ie
        else:
            self.laz[(k<<1)] = self.op(self.laz[(k<<1)],self.laz[k])
            self.laz[(k<<1)+1] = self.op(self.laz[(k<<1)+1],self.laz[k])
            self.laz[k] = self.ie
    def update(self,left,right,f):
        left += self.n
        right += self.n
        for i in reversed(range(self.h+1)):
            self.propagate(left>>i)
        for i in reversed(range(self.h+1)):
            self.propagate((right-1)>>i)
        while right - left > 0:
            if right & 1:
                right -= 1
                self.laz[right] = self.op(self.laz[right],f)
            if left & 1:
                self.laz[left] = self.op(self.laz[left],f)
                left += 1
            left >>= 1
            right >>= 1
    def get(self,index):
        res = self.val[index]
        index += self.n
        while index:
            res = self.op(res,self.laz[index])
            index //= 2
        return res

N,Q = map(int,input().split())
A = [0 for _ in range(N)]
sg = SegmentTreeDual(A,lambda x,y:x+y,0)
ans = []

for _ in range(Q):
    q = list(map(int,input().split()))
    if q[0] == 0:
        s,t,x = q[1:]
        sg.update(s-1,t,x)
    else:
        i = q[1]
        ans.append(sg.get(i-1))

print('\n'.join(map(str,ans)))


Measured memory_bytes: 20264
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
#define endl '\n'
#ifndef YDK
#define eprintf(...)
#endif
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr const int INF  = 0x3f3f3f3f;
constexpr const i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr const int MOD  = int(1e9) + 7;
// }}}

// Library {{{
// }}}

int N, A;
int x[55];

i64 dp[55][55][50 * 60];

i64 slv(int idx, int cnt, int rem)
{
    if (cnt <= 0) { return (rem == 0) ? 1 : 0; }
    if (idx >= N) return 0;
    if (rem < 0) return 0;

    if (~dp[idx][cnt][rem]) return dp[idx][cnt][rem];

    return dp[idx][cnt][rem] =
        slv(idx+1, cnt, rem) + slv(idx+1, cnt-1, rem-x[idx]);
}

signed main()
{
    cin >> N >> A;
    rep(i, 0, N) cin >> x[i];

    memset(dp, -1, sizeof(dp));

    i64 ans = 0;
    for (int i = 1; i <= N; ++i) {
        ans += slv(0, i, A*i);
    }

    cout << (ans) << endl;
    return 0;
}


Measured memory_bytes: 71168
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
int MOD=1000000007;
bool judge(char s){
    bool res=false;
    if(s=='A')res=true;
    if(s=='T')res=true;
    if(s=='C')res=true;
    if(s=='G')res=true;
    return res;
}
signed main(){
    string s;cin>>s;
    int n=(int)s.length();
    int res=0;
    char last='H';
    int buf=0;
    s+='.';
    rep(i,n+1){
        if(judge(s[i])){
            buf++;
        }
        else{
            res=max(res,buf);
            buf=0;
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
template<typename T>
struct Edge {
    int from, to;
    T cost;
    Edge(int from, int to, T cost) {
        this->from = from;
        this->to = to;
        this->cost = cost;
    }
};
bool operator == (Edge<int> e1, Edge<int> e2) {
    return e1.from == e2.from &&
            e1.to == e2.to &&
            e1.cost == e2.cost;
}
template<typename T>
using Edges = std::vector<Edge<T>>;
template<typename T>
using Graph = std::vector<Edges<T>>;
struct UnionFind {
    int sz;
    std::vector<int> par;
    UnionFind(int sz) {
        this->sz = sz;
        par.clear();
        par.resize(sz, -1);
    }
    int root(int x) {
        return par[x] < 0 ? x : par[x] = root(par[x]);
    }
    void unite(int a, int b) {
        int roota = root(a);
        int rootb = root(b);
        if(roota == rootb) return;
        if(par[roota] < par[rootb]) std::swap(roota, rootb);
        par[roota] += par[rootb];
        par[rootb] = roota;
    }
    bool same(int a, int b) {
        return (root(a) == root(b));
    }
    bool size(int a) {
        return -par[root(a)];
    }
};
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
signed main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n, m; cin >> n >> m;
  vector<ll> a(n);
  for(int i=0;i<n;++i) {
    cin >> a[i];
  }
  UnionFind uf(n);
  for(int i=0;i<m;++i) {
    int a, b; cin >> a >> b;
    uf.unite(a, b);
  }
  map<int, int> id;
  int fresh_id = 0;
  for(int i=0;i<n;++i) {
    if(id[uf.root(i)] == 0) {
      fresh_id++;
      id[uf.root(i)] = fresh_id;
    }
  }
  if(fresh_id == 1) {
    cout << 0 << endl;
    return 0;
  }
  if(n < (fresh_id - 1) * 2ll) {
    cout << "Impossible" << endl;
    return 0;
  }
  vector<priority_queue<ll, vector<ll>, greater<ll>>> v(fresh_id);
  priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;
  for(int i=0;i<n;++i) {
    v[id[uf.root(i)]-1].push(a[i]);
  }
  ll ans = 0;
  for(int i=0;i<fresh_id;++i) {
    assert((int)(v[i].size()) != 0);
    ans += v[i].top(); v[i].pop();
    if((int)(v[i].size()) == 0) continue;
    int now = v[i].top(); v[i].pop();
    pq.push({now, i});
  }
  ll cnt = (fresh_id - 1) * 2ll - fresh_id;
  while(cnt > 0) {
    cnt--;
    ll fi = pq.top().first;
    int se = pq.top().second;
    pq.pop();
    ans += fi;
    if(v[se].size() == 0) continue;
    ll next = v[se].top(); v[se].pop();
    pq.push({next, se});
  }
  cout << ans << endl;
}


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

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if((a-c<=d&&c-a<=d)||(a-b<=d&&b-a<=d&&b-c<=d&&c-b<=d)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  string t = "";
  rep(i, c-a) t += 'R';
  rep(i, d-b) t += 'U';
  rep(i, c-a) t += 'L';
  rep(i, d-b) t += 'D';
  t += 'D';
  rep(i, c-a+1) t += 'R';
  rep(i, d-b+1) t += 'U';
  t += 'L';
  t += 'U';
  rep(i, c-a+1) t += 'L';
  rep(i, d-b+1) t += 'D';
  t += 'R';
  cout << t << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
	cin >> n;
	int flag = n % 10;
	if(flag == 2 || flag == 4 || flag == 5 || flag == 7 || flag == 9) cout << "hon" << endl;
	else if(flag == 3) cout << "bon" << endl;
	else cout << "pon" << endl;
}

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

int myCeil(int x, int y) {return (x % y == 0 ? x : x + y) / y;}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    int one = 0;
    for (int i = 0; i < n; ++i) {
        int b;
        cin >> b;
        if (b == 0) one = i;
        a[i] = b;
    }
    int ans = 0;
    ans += myCeil(one, (k - 1));
    ans += myCeil(n - one - 1, (k - 1));
    cout << ans << endl;
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  string S;
  cin>>S;
  bool ok=true;
  for(int i=0;i<S.size();i++){
    if((i%2)&&S[i]=='R')ok=false;
    if(i%2==0&&S[i]=='L')ok=false;
  }
  if(ok)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     string s;
     cin>>s;
     int n=s.length();
     if(s[0]!='A'){cout<<"WA\n"; return 0;}int c=0;
     for(int i=2;i<n-1;i++)
     {
     if(s[i]=='C')c++;
     }
     if(c!=1){cout<<"WA\n"; return 0;}
     for(int i=1;i<n;i++)
     {
         if(i>=2&&i<n-1&&s[i]=='C')continue;
         if(s[i]<='Z'&&s[i]>='A') {cout<<"WA\n"; return 0;}
     }
     cout<<"AC\n";
return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

 int main(void)
 {
     int d;

     scanf("%d",&d);

     switch(d)
    {
        case 25: puts("Christmas");
                 break;
        case 24: puts("Christmas Eve");
                 break;
        case 23: puts("Christmas Eve Eve");
                 break;
        case 22: puts("Christmas Eve Eve Eve");
    }

     return 0;
 }

Measured memory_bytes: 256
X,N=map(int,input().split())
if N!=0:
	P=set(map(int,input().split()))
else:
	P=set()
ans=0
for i in range(1,X+1):
	if i not in P:
		ans=i
for i in range(X+1,2*X-ans):
	if i not in P:
		ans = i
		break
print(ans)

Measured memory_bytes: 9212
N = [list(map(int, input().split())) for _ in range(3)]
if (N[0][0] + N[1][1] + N[2][2] ==
   N[0][1] + N[1][2] + N[2][0] ==
   N[0][2] + N[1][0] + N[2][1]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while (true){
int H = sc.nextInt();
int W = sc.nextInt();
if(H == 0 && W == 0){
break;
}
for(int i = 1;i <= H;i++){
for(int j = 1;j <= W;j++){
if(i == 1 || i == H || j == 1 || j == W){
System.out.printf("#");
}else{
System.out.printf(".");
}
}
System.out.printf("\n");
}
System.out.printf("\n");
}
sc.close();
}
}


Measured memory_bytes: 58600
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

vector<int>vec;

int main(){

	int N,K;
	scanf("%d %d",&N,&K);

	int i;

	for(i=0;i<N;i++){
	int l;
	scanf(" %d",&l);
	vec.push_back(l);
	}

	sort(vec.begin(),vec.end());
	reverse(vec.begin(),vec.end());

	int ans=0;
	for(i=0;i<K;i++){
	ans+=vec[i];
	}

	printf("%d\n",ans);

	return 0;
}

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

n = int(input())
a = list(map(int, input().split()))

a = [0] + a + [0]

diff = []
for i in range(1, len(a)):
    diff.append(abs(a[i-1]-a[i]))

ans = sum(diff)

# print(diff)
for i in range(1, len(diff)):
    tmp = abs(a[i+1]-a[i-1])-abs(a[i]-a[i+1])-abs(a[i-1]-a[i])
    print(ans+tmp)


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

int main(){
    int a,b,k;
    cin>>k>>a>>b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
}

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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	for (int i = a; i <= b * a; i += a) {
		if (i % b == c) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long modsub(long long a, long long b){
	a %= MOD;
	b %= MOD;
	if (a >= b){
		return (a - b) % MOD;
	} else {
		return MOD - (b - a) % MOD;
	}
}
int main(){
  long long N, K;
  cin >> N >> K;
  long long count = 0;
  for (long long i = K; i <= N + 1; i++){
    long long S = i * (i + 1) / 2;
    long long L = (N + 1 + N - i + 2) * i / 2;
	count += modsub(L + 1, S);
    count %= MOD;
  }
  cout << count << endl;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main(void) {

  long n,k;
	scanf("%ld %ld", &n, &k);
	if (k == 0) {
		printf("%ld\n", n*n);
		return 0;
	}
	long sum = 0;
	long pairs;
	long n_mod_b;
	for (long b = k+1; b <= n; b++) {
		pairs = n/b;
		pairs *= b-k;
		n_mod_b = n%b;
		if (n_mod_b >= k) {
			pairs += n_mod_b-k+1;
		}
		sum += pairs;
	}
	printf("%ld\n", sum);

  return 0;
}

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

#define ll long long

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll H,W,K;
    cin>>H>>W>>K;
    
    ll A[H][W];
    ll col[H] = {0};
    for(ll i=0;i<H;i++){
        string s;
        cin>>s;
        if(i > 0) col[i] = col[i-1];
        for(ll j=0;j<W;j++){
            if(s[j]=='.'){
                A[i][j] = 0;
            }
            else{
                A[i][j] = 1;
                col[i]++;
            }
        }
    }
    // for(ll i=0;i<H;i++) cout<<col[i]<<" ";
    // cout<<endl;
    ll dp[H][W];
    ll c = 1;
    ll last = 0;
    for(ll i=0;i<H;i++){
        if(col[i]>=c){
            for(ll j=0;j<W;j++){
                for(ll k=last; k<=i;k++){
                    dp[k][j] = min(c, col[i]);
                    // cout<<"k j:"<<k<<" "<<j<<" val:"<<dp[k][j]<<endl;
                }
                if(A[i][j]==1) c++;
            }
            last = i+1;
        }
        else continue;
    }
    for(ll i=last; i<H;i++){
        for(ll j=0;j<W;j++) dp[i][j]=dp[i-1][j];
    }
    
    // print
    for(ll i=0;i<H;i++){
        for(ll j=0;j<W;j++){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }
	return 0;
}

Measured memory_bytes: 2176