akhauriyash/Code-Regression huggingface dataset:
//بسم الله الرحمن الرحيم
//* In The Name 0f ALLAH *//* The Most Beneficent *//* The Most Merciful *//*
#include<bits/stdc++.h>
using namespace std;
#define el << endl
typedef long int li;
typedef long long ll;
#define tc int T; cin>>T; while(T--)
#define GOOD_BYE return 0;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define file() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)
const int mx = 1e5+123;
const ll MAX = 1e9+5;
//......TEMPLATE TERMINATES HERE......*//*......LET'S BEGIN (-_^)......//
int n,t;
ll weight[101],value[101];
ll dp[101][mx];

ll dynamic_programming(ll i,ll w){

    if(i>n) return 0;
    if(dp[i][w]!=-1) return dp[i][w];
    ll r1=0,r2=0 ;
    if(w+weight[i]<=t)
        r1=value[i]+dynamic_programming(i+1,w+weight[i]);
    r2=dynamic_programming(i+1,w);
    return dp[i][w]=max(r1,r2);
}

void fn(){

        memset(dp,-1,sizeof(dp));
        cin >> n >> t;
        for(int i=1;i<=n;i++)
            cin >> weight[i] >> value[i];
        cout << dynamic_programming(1,0) << endl;
}

int main(){

    //file();
    optimize();
    //tc
        fn();

    GOOD_BYE
}

///////////*  N A Y E M  *///////////

Measured memory_bytes: 82576
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
     double s=0;
    while(t--)
    {

        double x;
        string str;
        cin>>x;
        cin>>str;
        if(str=="BTC")
            s=s+x*380000;
         else
            s=s+x;
    }
    cout<<s;
}


Measured memory_bytes: 3804
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001

#define F first
#define S second

#define Pii pair<SINT32,SINT32>
#define Pll pair<SINT64,SINT64>


using namespace std;

int main() {

	SINT32 A,B;
	SINT32 K;

	cin >> A>>B>>K;

	SINT32 cnt = 101;

	while (K!=0) {
		cnt--;
		if (((A % cnt) == 0) && ((B % cnt) == 0)) {
			K--;
		}
	}
	cout << cnt << endl;
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());	//ソート後に使用

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));	//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();	//key以上を探す
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/
/* 文字列合成
	string N,M;
	cin >> N >> M;
	SINT64 ans = 0;
	ans = stoi(N+M);
*/

/*
//ワーシャルフロイド
vector<vector<SINT32>> dist(N,vector<SINT32>(N));
rep(i,0,N) {
	rep(j,0,N) {
		if (i != j) {
			dist[i][j] = INF;
		}
	}
}
rep(k,0,N) {
	rep(i,0,N) {
		rep(j,0,N) {
			dist[i][j] = MIN(dist[i][j], dist[i][k]+dist[k][j]);
		}
	}
}
*/



/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}
*/

/*
	//順列全表示
	//sortしてからでないと全列挙にならない
	sort(DATA.begin(),DATA.end());
	do {
		cout << buf << endl;
		rep(i,0,R) {
			cout << DATA[i] << " ";
		}
		cout << endl;

    } while (next_permutation(DATA.begin(),DATA.end()));
*/

Measured memory_bytes: 384
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double x1 = sc.nextDouble();
		double y1 = sc.nextDouble();
		double x2 = sc.nextDouble();
		double y2 = sc.nextDouble();
		System.out.printf("%.8f\n",Math.sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2)));
	}

}

Measured memory_bytes: 18940
import java.util.*;

public class Main {
	int w,h;
	char [][] data;
	int [] vx = {0,1,0,-1};
	int [] vy = {-1,0,1,0};
	boolean ans;
	boolean [][] visited, searchXvisited, getGvisited;
	int minx, maxx;

	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			w = sc.nextInt();
			h = sc.nextInt();
			if((w|h) == 0) break;
			data = new char[h + 1][w];
			for(int i = 0; i < h; i++){
				data[i] = sc.next().toCharArray();
			}
			for(int i = 0; i < w; i++){
				data[h][i] = '0';
			}
			h++;
			
			ans = true;
			visited = new boolean[h][w];
			for(int i = 0; i < w; i++){
				if(data[h-1][i] != '.'){
					visited[h-1][i] = true;
					dfs(i, h-1, data[h-1][i]);
					break;
				}
			}
			System.out.println(ans ? "STABLE" : "UNSTABLE");
		}
	}

	private void dfs(int x, int y, char color) {

		for(int i = 0; i < 4; i++){
			int xx = vx[i] + x;
			int yy = vy[i] + y;
			if(! isOK(xx,yy)) continue;
			if(data[yy][xx] == '.') continue;
			if(visited[yy][xx])continue;
			if(data[yy][xx] == color){
				visited[yy][xx] = true;
				dfs(xx,yy, color);
			}
			else if(i == 0){
				boolean res = isStable(x, y, xx,yy);
				if(! res){
					ans = false;
					return;
				}
				else{
					dfs(xx, yy, data[yy][xx]);
				}
			}
		}
	}

	private boolean isStable(int x, int y, int xx, int yy) {
		searchXvisited = new boolean[h][w];
		searchXvisited[y][x] = true;
		minx = xx;
		maxx = xx;
		searchX(xx,yy,data[yy][xx]);
		
		getGvisited = new boolean[h][w];
		getGvisited[yy][xx] = true;
		
		int [] res2 = getG(xx,yy,data[yy][xx]);
		double g = (double)res2[0] / res2[1];
		if((double)(minx - 0.5) < g && g < (double)(maxx + 0.5)){
			return true;
		}
		return false;
	}

	private int[] getG(int x, int y, char c) {
		int [] ans = {x, 1};
		for(int i = 0; i < 4; i++){
			int xx = x + vx[i];
			int yy = y + vy[i];
			if(! isOK(xx,yy)) continue;
			if(getGvisited[yy][xx]) continue;
			if(data[yy][xx] == '.') continue;
			if(data[yy][xx] == c){
				getGvisited[yy][xx] = true;
				int [] res = getG(xx, yy, c);
				ans[0] += res[0];
				ans[1] += res[1];
			}
			else if(i == 0){
				getGvisited[yy][xx] = true;
				int [] res = getG(xx, yy, data[yy][xx]);
				ans[0] += res[0];
				ans[1] += res[1];
			}
		}
		return ans;
	}

	private void searchX(int x, int y, char nowcolor) {
		for(int i = 0; i < 4; i++){
			int xx = x + vx[i];
			int yy = y + vy[i];
			if(! isOK(xx,yy)) continue;
			if(searchXvisited[yy][xx]) continue;
			if(data[yy][xx] == '.') continue;
			if(data[yy][xx] == nowcolor){
				searchXvisited[yy][xx] = true;
				searchX(xx, yy, nowcolor);
			}
			else if(i == 2){
				minx = Math.min(xx, minx);
				maxx = Math.max(maxx, xx);
			}
		}
	}

	private boolean isOK(int xx, int yy) {
		if(0<= xx && xx < w && 0<= yy && yy < h) return true;
		return false;
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 35948
#include<iostream>
#include<map>
#include<string>
using namespace std;
typedef long long ll;
int main() {
	string s; cin >> s;
	map<char, bool>m;
	for (char c = 'a'; c <= 'z'; c++)m[c] = false;
	for (int i = 0; i < s.size(); i++)m[s[i]] = true;
	for (char c = 'a'; c <= 'z'; c++)if (!m[c]) { cout << c << endl; return 0; }
	cout << "None\n";
}

Measured memory_bytes: 512
#  --*-coding:utf-8-*--

import math

def getSumOfD(N, XY, flags, n, d, x, y):
    if n == N:
        return d

    sumOfD = 0

    for i in range(N):
        if not flags[i]:
            flags[i] = True
            x2, y2 = XY[i]

            sumOfD += getSumOfD(
                N, XY, flags, n+1,
                d + math.sqrt((x2-x)**2 + (y2-y)**2),
                x2, y2)
            
            flags[i] = False
        
    return sumOfD


def getFact(n):
    x = 1
    for i in range(2, n+1):
        x *= i

    return x


def main():
    N = int(input())
    XY = [tuple(map(int, input().split())) for _ in range(N)]

    sumOfD = 0
    flags = [False]*N

    for i in range(N):
        flags[i] = True
        x, y = XY[i]
        sumOfD += getSumOfD(N, XY, flags, 1, 0, x, y)
        flags[i] = False

    print('{:.9f}'.format(sumOfD/getFact(N)));



if __name__ == '__main__':
    main()


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

using ll = long long;
#define int long long
using P = pair<int, int>;

#define LOG(variable) cerr << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cerr << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
template<typename T = int>
T in() {T a; cin >> a; return a;}
/***** MAIN *****/
signed main() {
  int n, x, t; cin >> n >> x >> t;
  int ans = n / x;
  if(n % x) {
    ++ans;
  }
  cout << ans * t;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
	FastIO
	lld a, b;
	cin >> a;
	cin >> b;
	if ((a >= 1 && a <= 9) && (b >= 1 && b <= 9))
		cout << (a*b);
	else
		cout <<  "-1";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
    double r;
    cin >> r;
    cout << 2*r*PI << endl;
}

Measured memory_bytes: 3780
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
template<typename T> inline void debug(const vector<T> &xs){
#ifdef DEBUG
	pr(xs);
#endif
}

int main(){
	int N;
	cin >> N;
	vector<int> B(N);
	for(int i=0; i<N-1; i++) cin >> B[i];

	ll ans = B[0]+B[N-2];
	for(int i=1; i<N-1; i++){
		ans += min(B[i], B[i-1]);
	}
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    string alp="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    char a;
    string ans;
    int i,j;
    for(i=0;i<s.size();i++){
        vector<int> al(52);
        int iti=0;
        for(j=0;j<26;j++){
            if(s.at(i)==alp.at(j))
            iti=j+1;
        }
        if(iti+n>26){
            a=s.at(i)+n-26;
        }
        else{
            a=s.at(i)+n;
        }
        ans+=a;
    }
    cout << ans << endl;
    return 0;
}

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

public class Main {
	public static final int BIG_NUM = 2000000000;
	public static final int MOD = 1000000007;

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			int n = Integer.parseInt(br.readLine());
			String input_str[] = br.readLine().split("\\s+");
			int[] array = new int[n];
			for(int i=0; i < n; i++) {
				array[i] = Integer.parseInt(input_str[i]);
			}
			int work, minj, sw = 0;
			for(int i=0; i<n; i++) {
				minj = i;
				work = array[i];
				for(int j=i+1; j<n; j++) {
					if(array[minj] > array[j]) {
						minj = j;
					}
				}
				if(i != minj) {
					array[i] = array[minj];
					array[minj] = work;
					sw++;
				}
			}
			output(array);
			System.out.println(sw);
		} catch (NumberFormatException | IOException e) {
			e.printStackTrace();
		}
	}
	private static void output(int[] array) {
		System.out.printf("%d", array[0]);
		for (int i=1; i<array.length; i++) {
			System.out.printf(" %d", array[i]);
		}
		System.out.printf("\n");
	}

}



Measured memory_bytes: 24732
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef vector<int> vint;
typedef vector<float> vfloat;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vstr> vvstr;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main(void){
    string a, b;
    cin >> a >> b;
    int al = a.length();
    int bl = b.length();
    if (al != bl) {
        if (al > bl) cout << "GREATER" << endl;
        else cout << "LESS" << endl;
    } else {
        rep(i, al) {
            if (a[i] > b[i]) {
                cout << "GREATER" << endl;
                return 0;
            }
            else if (a[i] < b[i]) {
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }
}

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

int main(){
  string s;int n,k;cin>>s>>k;n=s.size();
  long long ans=0;
  string ttmp=""; REP(tt,n) ttmp.push_back('0');
  if(k==1){
    ans+=9*(n-1);
    int top=s.at(0)-'0';
    ans+=top;
  }else if(k==2){
    for(int i=2;i<n;i++) ans+=9*9*(i-1);
    for(int i=1;i<=9;i++){
      for(int j=1;j<=9;j++){
        for(int l=1;l<n;l++){
          string tmp=ttmp;
          //REP(tt,n) tmp.push_back('0');
          tmp.at(0)=i+'0';
          tmp.at(l)=j+'0';
          REP(tt,n){
            if(tmp.at(tt)<s.at(tt)){
              ans++;
              break;
            }else if(tmp.at(tt)>s.at(tt)){
              break;
            }else{
              if(tt==n-1) ans++;
            }
          }
        }  
      }
    }  
  }else{
    for(int i=3;i<n;i++) ans+=9*9*9*(i-1)*(i-2)/2;
    for(int i=1;i<=9;i++){
      for(int j=1;j<=9;j++){
        for(int jj=1;jj<=9;jj++){
          for(int l=1;l<n-1;l++){
            for(int ll=l+1;ll<n;ll++){
              string tmp=ttmp;
              //REP(tt,n) tmp.push_back('0');
              tmp.at(0)=i+'0';
              tmp.at(l)=j+'0';
              tmp.at(ll)=jj+'0';
              REP(tt,n){
                if(tmp.at(tt)<s.at(tt)){
                  ans++;
                  break;
                }else if(tmp.at(tt)>s.at(tt)){
                  break;
                }else{
                  if(tt==n-1) ans++;
                }
              }
            }
          }  
        }
      }
    }
  }
  cout<<ans<<endl;;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
long long int comp(const void *a, const void *b){
    return *(long long *)b - *(long long *)a;
}

int main() {
  int n;
  scanf("%d", &n);
  long long a[n];
  for(int i=0;i<n;i++) {
    scanf("%lld", &a[i]);
  }
  long long ans=0;
  qsort(a, n, sizeof(long long), comp);
  for(int i=1;i<n;i++){
    ans+=a[i/2];
  }

  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 4980
#include <bits/stdc++.h>
using namespace std;
int n, q, v,l,r;
int lowerBound(int a[], int x)
{
    int l = 0, r = n - 1;
    int res = n;
    while (l <= r)
    {
        int mid = (l + r) / 2;
        if (a[mid] >= x)
        {
            res = mid;
            r = mid - 1;
        }
        else
            l = mid + 1;
    }
    return res;
}

int main()
{
    cin >> n;
    int a[n];
    for( int i = 0; i < n; i++ ){
        cin >> a[i];   
    }
    cin >> q;
    for( int i = 0; i < q; i++ )
    {
        cin >> v;
        cout << lowerBound( a, v) << "\n";
    }
    return 0;
}


Measured memory_bytes: 3488
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // input
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();

        double yokin = 100;
        long year = 0;
        while(yokin < x) {
            yokin = Math.floor(yokin * 1.01);
            year++;
        }
        System.out.println(year);
    }
}

Measured memory_bytes: 35732
#include <bits/stdc++.h>
#include <algorithm> //next_permutation

using namespace std;
typedef long long ll;
//typedef pair<int, int> P;

int main(){
  int n,k,r,s,p;
  string t;
  cin>>n>>k;
  cin>>r>>s>>p;
  cin>>t;
  map <char,int> m;
  m['s']=r;
  m['p']=s;
  m['r']=p;
  m['q']=0;
  int ans=0;
  for (int i; i<n; i++){
    if (i>=k){
      if (t[i]==t[i-k]){
        t[i]='q';
        //n番目から数えてm個の文字列をXに置換したい場合はreplace(n,m,X) teWttest

      }
    }

  }
  for (int i; i<n; i++){
    ans+=m[t[i]];

  }
  cout<<ans;
}


Measured memory_bytes: 512
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    s=input()
    mod=10**9+7
    #i(1-)番目の数まで決めた時，それより大きな数がj個ある場合の数
    dp=[[0]*(n+1) for _ in range(n+1)] 
    for i in range(n):
        dp[1][i]=1
    cum=[0]*(n+1)
    for i in range(2,n+1):
        cum[0]=dp[i-1][0]
        for j in range(1,n-i+2):
            cum[j]=(cum[j-1]+dp[i-1][j])%mod
        if s[i-2]=="<":
            for j in range(n-i+1):
                dp[i][j]=(cum[n-i+1]-cum[j])%mod
        else:
            for j in range(n-i+1):
                dp[i][j]=(cum[j])%mod
    print(dp[n][0])
if __name__=='__main__':
    main()

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

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for ( int i = 0; i < n; i++ ) {
		cin >> a[i];
	}

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

	int ans = INT_MAX;

	for ( int i = 0; i < n-(k-1); i++ ) {
		ans = min(a[i + k - 1] - a[i], ans);
	}

	cout << ans << endl;

}


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

namespace TYC
{
	typedef long long ll;

	const int N = 505;
	const ll INF = 0x3f3f3f3f3f3f3f3fLL;

	ll A[N][N], S1[N][N], S2[N][N], F[N][N];

	inline int read()
	{
		int x = 0, f = 0, ch = getchar();
		while (!isdigit(ch))
			f |= (ch == '-'), ch = getchar();
		while (isdigit(ch))
			x = x * 10 + ch - '0', ch = getchar();
		return f ? -x : x;
	}

	inline ll Q(const int x1, const int x2, const int y1, const int y2)
	{
		if (x1 > x2 || y1 > y2)
			return 0;
		else
			return S2[x2][y2] - S2[x1 - 1][y2] - S2[x2][y1 - 1] + S2[x1 - 1][y1 - 1];
	}

	void work()
	{
		int n = read();
		for (int i = 1; i <= n; i++)
			for (int j = 1, v; j <= n; j++)
			{
				v = i == j ? 0 : read();
				A[i][j] = A[i][j - 1] + v;
				S2[i][j] = S2[i - 1][j] + S2[i][j - 1] + v - S2[i - 1][j - 1];
			}
		for (int a = 1; a <= n; a++)
			for (int b = a; b <= n; b++)
				for (int i = a; i <= b; i++)
					S1[a][b] += A[i][b] - A[i][i];
		memset(F, 0x3f, sizeof(F));
		for (int i = 1; i <= n; i++)
			F[i][0] = S1[1][i];
		for (int i = 1; i < n; i++)
			for (int j = 0; j < i; j++)
				if (F[i][j] != INF)
					for (int k = i + 1; k <= n; k++)
						F[k][i] = min(F[k][i], F[i][j] + S1[i + 1][k] + Q(k + 1, n, j + 1, i));
		ll ans = INF;
		for (int i = 0; i <= n; i++)
			ans = min(ans, F[n][i]);
		printf("%lld\n", ans);
	}
}

int main()
{
	TYC::work();
	return 0;
}

Measured memory_bytes: 8192
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

// 2???????????????????????????????±???????
double dot(P a, P b) {
    return (a.X * b.X + a.Y * b.Y);
}

// 2???????????????????????????????±???????
double cross(P a, P b) {
    return (a.X * b.Y - a.Y * b.X);
}

// ??? a1, a2 ???????????¨??????????????¨??? b ??¨????????¢
double dist_sp(P a1, P a2, P b) {
    if( dot(a2-a1, b-a1) < EPS ) return abs(b - a1);
    if( dot(a1-a2, b-a2) < EPS ) return abs(b - a2);
    return abs( cross(a2-a1, b-a1) ) / abs(a2 - a1);
}

int ccw(P a, P b, P c) {
    b -= a; c -= a;
    if( cross(b,c) > EPS ) return +1;
    if( cross(b,c) < -EPS ) return -1;
    if( dot(b,c) < 0 ) return +2;
    if( norm(b) < norm(c) ) return -2;
    return 0;
}

// ?????? a1, a2 ??¨ ?????? b1, b2 ??¨????????¢
bool isec_ss(P a1, P a2, P b1, P b2) {
    return ( ccw(a1,a2,b1) * ccw(a1,a2,b2) <= 0 ) &&
           ( ccw(b1,b2,a1) * ccw(b1,b2,a2) <= 0 );
}

double dist_ss(P a1, P a2, P b1, P b2) {
    if(isec_ss(a1, a2, b1, b2)) return 0;
    return min( min(dist_sp(a1, a2, b1), dist_sp(a1, a2, b2)),
                min(dist_sp(b1, b2, a1), dist_sp(b1, b2, a2)) );
}

int main() {
    P a, b, c, d; 
    int q; cin >> q;
    rep(i,0,q) {
        cin >> a.X >> a.Y >> b.X >> b.Y >> c.X >> c.Y >> d.X >> d.Y;
        double ans = dist_ss(a,b,c,d);
        printf("%.10f\n", ans);
    }
    return 0;
}

Measured memory_bytes: 1264
n, m = list(map(int, input().split()))
l = sorted(list(map(int, input().split())), reverse=True)

def analyze(m):
    maximum = -1
    i = 0
    while m > 0 and i < n:
        if l[i] >= maximum:
            l[i] //= 2
            maximum = max(maximum, l[i])
            i += 1
            m -= 1
        else:
            return m
    return m



while m > 0:
    m = analyze(m)
    l.sort(reverse=True)

print(sum(l))




Measured memory_bytes: 14224
/*
  The Island Was Silent before.
  .....
  And One day again it became Silent.
*/
#include<bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define ll  long long
#define modd(a,b) ((a+2*b)%b)
#define debug(a) cout << #a << ": " << (a) << "\n"
#define ioso ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define rtt cerr << "Time: " << clock()*1.0 / CLOCKS_PER_SEC << endl;
#define ffe freopen("input.txt","r",stdin), freopen("output.txt","w",stdout);
 
int main() {
  ioso
  #ifndef ONLINE_JUDGE
  ffe
  #endif
  ll n,k,x; cin >> n >> k >> x;
   n = abs(n);
  ll smx = (min((ll)(n/x),k));// * x;
  ll sm = smx*x;
  sm = n-sm;
  ll baki = k - smx;

  ll an = (baki&1) ? abs(sm-x) : sm;
  ll an2 = (k&1) ? abs(n-x) : n ;
  cout << (ll)(min(an,an2)) << endl;
}

Measured memory_bytes: 3636
from fractions import gcd
a,b=map(int,input().split())
c=gcd(a,b)
d=1
for i in range(2, int(-(-gcd(a,b)**0.5//1))+1):
  if c%i==0:
    d+=1
    while c%i==0:
      c//=i
  if c==1:
    break
if c!=1:
  d+=1
print(d)

Measured memory_bytes: 5048
#include <stdio.h>
#include <cmath>

int main(void) {
  long long N;
  scanf("%lld", &N);
  for (int i = sqrt(N); i >= 1; --i) {
    if (N % i == 0) {
      printf("%lld\n", i + (N/i) - 2);
      break;
    }
  }
  return 0;
}


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

int main() {
    /*変数定義，入力*/
    // ll N;
    // cin >> N;
    string S;
    cin >> S;

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


    //ll A, B;cin >> A >> B;
    //vector<ll> a(N);  rep(i, N) cin >> a[i];
    
    /*演算*/
    
    /*出力*/
    //cout <<  << endl;

    /*終了*/
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
  double W,H,x,y;
  cin>>W>>H>>x>>y;
  cout<<fixed<<setprecision(10)<<W*H/2<<" ";
  if(x==W/2&&y==H/2)cout<<1<<endl;
  else cout<<0<<endl;
  return 0;
}


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





int main() {
  
  int64_t n;
  cin>>n;
  
  int64_t x=0;
  
  while (x*x<=n){
    x++;
  }

  int64_t a;
  
  for (int64_t i=x-1;i>=0;i--){
    if (n%i==0){
      a=i;
      break;
    }
  }
  
  int64_t b;
  b=n/a;
  

  int answer=0;
  
  while (b>0){
    b/=10;
    answer++;
  }
  
  cout<<answer<<endl;
  
}












Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}


ll a[100009];


int main() {
	ll N, an = 0;
	cin >> N;
	vector<ll> A(N);
	vector<ll> B(N);
	vector<ll> C(N);
	rep(i, N) {
		cin >> A.at(i);
	}
	rep(i, N) {
		cin >> B.at(i);
	}
	rep(i, N) {
		cin >> C.at(i);
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());
	ll a = 0, c = 0;
	rep(i, N) {
		while (a<N&&A.at(a) < B.at(i)) {
			a++;
		}
		while (c < N && C.at(c) <= B.at(i)) {
			c++;
		}
		an += (a * (N - c));
	}
	cout << an << endl;
}

Measured memory_bytes: 5620
import sys

def I(): 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 = I()
    h = LI()
    for i in range(n-1, 0, -1):
        diff = h[i] - h[i-1]
        if diff >= 0:
            continue
        elif diff == -1:
            h[i-1] -= 1
        else:
            print("No")
            sys.exit()
    print("Yes")

if __name__ == '__main__':
    main()

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int a , b;

int main()
{
    _FastIO;
    cin >> a >> b;
    if((a + b) % 2){
        cout << "IMPOSSIBLE" << endl;
    }
    else
        cout << (a + b) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

c = Counter(S)

max_cnt = 0
words = []
for s_i, cnt in sorted(c.items(), key=lambda x: x[1], reverse=True):
    if max_cnt <= cnt:
        max_cnt = cnt
        words.append(s_i)
    else:
        break

for word in sorted(words):
    print(word)


Measured memory_bytes: 45032
def main():
    S = input()
    if S == 1:
        return 1
    dp_1 = [0] * len(S)
    dp_2 = [0] * len(S)
    if S[0] != S[1]:
        dp_1[1] = 2
    dp_1[0] = 1
    dp_2[1] = 1
    for i, v in enumerate(S):
        if i < 2:
            continue
        if v == S[i-1]:
            dp_1[i] = dp_2[i-1] + 1
        else:
            dp_1[i] = max(dp_1[i-1], dp_2[i-1]) + 1
        if i < 4 or S[i-1:i+1] == S[i-3:i-1]:
            dp_2[i] = dp_1[i-2] + 1
        else:
            dp_2[i] = max(dp_1[i-2], dp_2[i-2]) + 1
    return max(dp_1[-1], dp_2[-1])
print(main())


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

//約数列挙（因数分解）
vector<ll> divisor(ll n) {
  vector<ll> 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(begin(ret), end(ret));
  return (ret);
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int ans = 0;
	int cnt1 = 0;
	rep(i, n) {
		if(a[i] == 1) cnt1++;
	}
	if(cnt1 == 1) {
		cout << 1 << endl;
		return 0;
	} else if (cnt1 > 1) {
		cout << 0 << endl;
		return 0;
	}
	map<int, int> mp;
	multiset<int> st;
	rep(i, n) st.insert(a[i]);
	rep(i, n) mp[a[i]]++;
	for(auto m: mp) {
		int ma = m.first;
		int mb = m.second;
		if(mb>1) continue;
		auto d = divisor(ma);
		bool ok = true;
		st.erase(st.find(ma));
		for(auto t: d) {
			if (t==1) continue;
			if (st.find(t) != st.end()) {
				ok = false;
				break;
			}
		}
		st.insert(ma);
		if (ok) {
			ans++;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 22720
#include <bits/stdc++.h>
#define fr(i, n) for (int i = 0; i < n; i++)
#define frab(i, a, b) for (int i = a; i < b; i++)
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;

const ll MOD = 1e9 + 7;
const ll INF = 2e15 + 10;
const ll MAX = 1e14 + 10;
const ld EPS = 1e-9;
const int N = 1e2 + 10;
const int M = 1e5 + 10;

ll a[N];
ll d[N][M];
ll pref[N][M];

void solve() {
    int n, k;
    cin >> n >> k;
    fr(i, n)
        cin >> a[i];
    d[0][0] = 1;
    fill(pref[0], pref[0] + k + 1, 1);

    frab(i, 1, 1 + n) {
        fr(j, k + 1) {
            d[i][j] = pref[i - 1][j] - (j - a[i - 1] - 1 >= 0 ? pref[i - 1][j - a[i - 1] - 1] : 0);
            d[i][j] %= MOD;
            if (d[i][j] < 0)
                d[i][j] += MOD;
        }

        pref[i][0] = d[i][0];
        frab(j, 1, k + 1) {
            pref[i][j] = pref[i][j - 1] + d[i][j];
            if (pref[i][j] >= MOD)
                pref[i][j] -= MOD;
        }
    }

    cout << d[n][k];
}



int main() {
    //freopen("a.in", "r", stdin);
    ios_base::sync_with_stdio(false);
    solve();
}


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

long long dp[100001];
int main(){
int N,K;
cin>>N>>K;
int h[100000];
for(int i=1;i<N+1;i++){
cin>>h[i];
}
dp[0]=0;
dp[1]=0;
for(int i=2;i<N+1;i++){
dp[i]=99999999999;
if(i<=K){
for(int j=1;j<i;j++){
dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
}
}
if(i>K){
for(int j=i-K;j<i;j++){
dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
}
}
}
cout<<dp[N]<<endl;

/*int dp[200000];
int main(){
int N,C;
cin>>N>>C;
int h[200000];
for(int i=1;i<N+1;i++){
cin>>h[i];
}
dp[1]=0;
dp[2]=(h[2]-h[1])*(h[2]-h[1])+C;
for(int i=3;i<N+1;i++){
dp[i]=99999999;
for(int j=1;j<i;j++){
dp[i]=min(dp[i],dp[j]+(h[i]-h[j])*(h[i]-h[j])+C);
}
}
cout<<dp[N]<<endl;*/

/*int dp[100000];

int main(){
int n,k;
cin>>n>>k;
int a[100000];
for(int i=1;i<n+1;i++){
cin>>a[i];
}
dp[0]=0;
dp[1]=0;
for(int i=1;i<k+1;i++){
dp[1]=dp[1]+a[i];
}
for(int i=2;i<n-k+2;i++){
dp[i]=dp[i-1]-a[i-1]+a[i+k-1];
}
int answer=0;
for(int i=1;i<n-k+2;i++){
answer=max(answer,dp[i]);
}
cout<<answer<<endl;*/

/*int dp[100000];

int main(){
int N,h[100000];
cin >>N;
for(int i=0;i<N;i++){
cin>>h[i];
}
dp[0]=0;
dp[1]=abs(h[1]-h[0]);
for(int i=2;i<N;i++){
dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
}
cout<<dp[N-1]<<endl;*/
}

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

using namespace std;

class FoodInfor {
public:
	string name;
	int weight;
	int limit;
};

FoodInfor FoodData[10];
int TableIndex[10], Result[10];


bool checkWeight(int n) {
	int sum = 0;

#if 0
	for (int i = n-1; i > 0; i--) {
		sum += FoodData[TableIndex[i]].weight;
		if (sum > FoodData[TableIndex[i - 1]].limit) {
			return false;
		}
	}
#else
	for (int i = 0; i < n - 1; i++) {
		sum += FoodData[TableIndex[i]].weight;
		if (sum > FoodData[TableIndex[i + 1]].limit) {
			return false;
		}
	}
#endif
	
	return true;
}

int getG(int n) {
	int G = 0;
	for (int i = 0; i < n; i++) {
		G += FoodData[TableIndex[i]].weight * (n-i);
	}
	return G;
}

int main() {
	int n, tmpG, minG;

	while (cin>>n, n) {
		for (int i = 0; i < n; i++) {
			cin >> FoodData[i].name >> FoodData[i].weight >> FoodData[i].limit;
		}

		for (int i = 0; i < n; i++) {
			TableIndex[i] = i;
		}

		minG = INT_MAX;
		do {
			if (checkWeight(n) && minG > (tmpG = getG(n))) {
				//copy(TableIndex, TableIndex + n, Result);	//OK
				//memmove(Result, TableIndex, n);			//NG
				for (int i = 0; i < n; i++) {
					Result[i] = TableIndex[i];
				}
				minG = tmpG;
			}
		} while (next_permutation(TableIndex, TableIndex + n));

		for (int i = 0; i < n; i++) {
			cout << FoodData[Result[n-1-i]].name << endl;
		}
	}
}


Measured memory_bytes: 3148
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
#include <memory>
using namespace std;
typedef long long LL;

int main() {
    int n, a, b;
    cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
    }
    else {
        cin >> a >> b;
        cout << a + b;
    }

    return 0;
}


Measured memory_bytes: 256
N, *ABC = map(int, input().split())
l = [int(input()) for _ in range(N)]
def grouping(l, g, h, k):
    if all(len(x)>0 for x in [g, h, k]):
        yield g, h, k
    if len(l)>0:
        a, *l = l
        yield from grouping(l, g+[a], h, k)
        yield from grouping(l, g, h+[a], k)
        yield from grouping(l, g, h, k+[a])
        yield from grouping(l, g, h, k)
def func3(l, ABC):
    for g in grouping(l, [], [], []):
        p = sum(len(gg)-1 for gg in g)*10
        l = list(map(sum, g))
        yield sum(abs(x-y) for x,y in zip(l,ABC))+p
print(min(func3(l, ABC)))

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

int main()
{
    string ch;
    while(cin>>ch)
    {
        if(ch[2]==ch[3] && ch[4]==ch[5])
        {
            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 REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
 
using namespace std;
 
auto main() -> int
{
  int HP, Damage; cin >> HP >> Damage;
  
  if(HP / Damage == 0 ||  HP / Damage == 1)
  	cout << 1 << endl;
    
  else if(HP % Damage == 0)
  	cout << (HP / Damage) << endl;
    
  else
  	cout << (HP / Damage + 1) << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define PP pair<int,P>
#define F first
#define S second
#define f(i,n) for(int i=0;i<(n);i++)
#define INF LLONG_MAX/3
#define eps LDBL_EPSILON
#define mod (int)(1000000007)
#define pie 3.141592653589793238462643383279
#define Bpri priority_queue
#define Spri priority_queue<P,vector<P>,greater<P>>
using namespace std;
signed main(){
	int a,b,c,d,n;
	string s,t;
	cin>>a>>b>>n>>c>>d>>s>>t;
	f(j,4){
		char ch1,ch2;
		if(j==0){
			ch1='L';
			ch2='R';
		}
		if(j==1){
			ch1='R';
			ch2='L';
		}
		if(j==2){
			ch1='U';
			ch2='D';
		}
		if(j==3){
			ch1='D';
			ch2='U';
		}
		int x=c,y=d;
		f(i,n){
			if(s[i]==ch1){
				if(j==0) y--;
				if(j==1) y++;
				if(j==2)x--;
				if(j==3)x++;
			}
			if(!x||!y||x>a||y>b){
				puts("NO");
				return 0;
			}
			if(t[i]==ch2){
				if(j==0)y=min(y+1,b);
				if(j==1)y=max(y-1,(int)(1));
				if(j==2)x=min(x+1,a);
				if(j==3)x=max(x-1,(int)(1));
			}
		}
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 776
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val abcList: List<Int> = (0 until 3).map { sc.nextInt() }
    val  distinctList = abcList.distinct()
    if (distinctList.size == 2) {
        println("Yes")
    } else {
        println("No")
    }
}

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

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

    ll a,b;
    cin>>a>>b;
    ll ans=a*b/gcd(a,b);

    cout<<ans<<endl;

 return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

const li mod = 1e9 + 7;

struct Result {
    vector<li> dists;
    vector<li> counts;
};

struct Edge {
    li to;
    li dist;
};

Result dp(const vector<vector<Edge>>& graph, li s, li t) {
    const int n = graph.size();
    vector<li> dists(n, 1LL << 55);
    vector<bool> visit(n);
    vector<li> counts(n, 0);
    counts[s] = 1;
    dists[s] = 0;

    priority_queue<pair<li, li>> q;
    q.emplace(0, s);
    while (not q.empty()) {
        auto f = q.top(); q.pop();
        li cost = -f.first;
        li pos = f.second;

        if (visit[pos]) {
            continue;
        }
        visit[pos] = true;
        for (auto &&edge : graph[pos]) {
            li next_pos = edge.to;
            li next_cost = cost + edge.dist;

            if (next_cost < dists[next_pos]) {
                counts[next_pos] = counts[pos];
                dists[next_pos] = next_cost;
                q.emplace(-next_cost, next_pos);
            } else if (next_cost == dists[next_pos]) {
                counts[next_pos] = (counts[next_pos] + counts[pos]) % mod;
                q.emplace(-next_cost, next_pos);
            }
        }
    }
    return (Result) {dists, counts};
}

int main() {
    li n, m, s, t;
    cin >> n >> m >> s >> t;
    s--; t--;

    vector<vector<Edge>> graph(n);
    vector<li> fr(m), to(m), dists(m);
    for (int i = 0; i < m; ++i) {
        li u, v, d;
        cin >> u >> v >> d;
        u--; v--;
        fr[i] = u;
        to[i] = v;
        dists[i] = d;
        graph[u].push_back((Edge) {v, d});
        graph[v].push_back((Edge) {u, d});
    }

    Result takahashi = dp(graph, s, t);
    Result aoki = dp(graph, t, s);

    li dist = takahashi.dists[t];
    li ans = takahashi.counts[t] * aoki.counts[s] % mod;
    for (int i = 0; i < n; ++i) {
        if (takahashi.dists[i] + aoki.dists[i] > dist) {
            continue;
        }
        if (takahashi.dists[i] != aoki.dists[i]) {
            continue;
        }
        li path_count = takahashi.counts[i] * aoki.counts[i] % mod;
        li comb_count = path_count * path_count % mod;
        ans = (ans - comb_count + mod) % mod;
    }

    for (int i = 0; i < m; ++i) {
        li takahashi_idx, aoki_idx;
        if (takahashi.dists[fr[i]] + dists[i] + aoki.dists[to[i]] == dist) {
            takahashi_idx = fr[i];
            aoki_idx = to[i];
        } else if (aoki.dists[fr[i]] + dists[i] + takahashi.dists[to[i]] == dist) {
            aoki_idx = fr[i];
            takahashi_idx = to[i];
        } else {
            continue;
        }

        li takahashi_start = takahashi.dists[takahashi_idx];
        li aoki_start = aoki.dists[aoki_idx];
        li takahashi_end = takahashi_start + dists[i];
        li aoki_end = aoki_start + dists[i];

        if (takahashi_end <= aoki_start || aoki_end <= takahashi_start) {
            continue;
        }
        li path_count = takahashi.counts[takahashi_idx] * aoki.counts[aoki_idx] % mod;
        li comb_count = path_count * path_count % mod;
        ans = (ans - comb_count + mod) % mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 23488
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;





int main(void) {
    
    int x,a,b;
    cin>>x>>a>>b;
    int pass=b-a;
    if(pass<=0)fin("delicious");
    else if(pass<=x)fin("safe");
    else fin("dangerous");
    
}

Measured memory_bytes: 256
s=input()
n=len(s)
cnts=[0]*2019

cnts[0]=1
now=0
for i in range(n-1,-1,-1):
  now+=int(s[i])*pow(10,n-1-i,2019)
  now%=2019
  #print(now)
  cnts[now]+=1

ans=0
for cnt in cnts:
  ans+=cnt*(cnt-1)//2
  
print(ans)


Measured memory_bytes: 73900
import java.util.Scanner;

//Heian-Kyo Walking
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		while(T--!=0){
			int w = sc.nextInt(), h = sc.nextInt(), n = sc.nextInt();
			int[][] dp = new int[h+1][w+1];
			boolean[][][][] e = new boolean[h+1][w+1][h+1][w+1];
			while(n--!=0){
				int x1 = sc.nextInt(), y1 = sc.nextInt(), x2 = sc.nextInt(), y2 = sc.nextInt();
				e[y1][x1][y2][x2] = e[y2][x2][y1][x1] = true;
			}
			dp[0][0] = 1;
			for(int j=1;j<=w;j++)dp[0][j] = e[0][j-1][0][j]?0:dp[0][j-1];
			for(int i=1;i<=h;i++)dp[i][0] = e[i][0][i-1][0]?0:dp[i-1][0];
			for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)dp[i][j] = (e[i][j][i][j-1]?0:dp[i][j-1])+(e[i][j][i-1][j]?0:dp[i-1][j]);
			System.out.println(dp[h][w]==0?"Miserable Hokusai!":dp[h][w]);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 13000
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n,m) for(int i=n;i<m;i++)
#define repn1(i,n,m) for(int i=n;i<=m;i++)
#define pb push_back
using namespace std;
typedef long long ll;
const int INF = 1e+8;

int main(){

    int N, W;
    int v[1001];
    int w[1001];
    int dp[101][10001];
    cin >> N >> W;
    fill_n(*dp, 101*10001, 0);
    rep(i, N)cin >> v[i] >> w[i];
    for(int i = 0; i < N; i++){
        for(int j = 0; j <= W; j++){
            if(j < w[i]){
                dp[i+1][j] = dp[i][j];
            }else{
                dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i]);
            }
        }
    }
    cout << dp[N][W] << endl;
 
    return 0;	
}

Measured memory_bytes: 5112
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long powMod(long x, long k, long m) {
    if (k == 0) return 1;
    if (k % 2 == 0) return powMod(x * x % m, k / 2, m);
    return x * powMod(x, k - 1, m) % m;
}

void main() {
    auto mn = readints;
    int m = mn[0], n = mn[1];
    const int mod = 10^^9 + 7;

    auto ans = powMod(m, n, mod);
    writeln(ans);
}


Measured memory_bytes: 2504
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <math.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  ll n,a,b;
  cin>>n>>a>>b;
  ll h[n+1],m=0;
  for(ll i=1;i<=n;i++){
    cin>>h[i];
    m=max(m,h[i]);
  }
  ll r=m/b+1,l=0;
  while(l<r){
    ll mid=(l+r)/2;
    ll tmp=0;
    for(ll j=1;j<=n;j++){
      if(h[j]<=b*mid) continue;
      tmp+=((h[j]-b*mid)+a-b-1)/(a-b);
    }
    if(tmp<=mid){
      r=mid;
    }else{
      l=mid+1;
    }
  }
  //cout<<l<<" "<<r<<endl;
  cout<<l<<endl;
  return 0;
}


Measured memory_bytes: 1024