akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N,K;
    Scd2(N,K);
    vi a(N);
    Rep(i,N) Scd(a[i]);

    vi ans;
    int open = -1;
    int prev = -1;
    int fale = 0;
    K++;
    while(K){
        int mi = INF;
        Rep(i,N){
            if( a[i] < mi && prev != i ){
                open = i;
                mi = a[i];
            }
        }
        Rep(i,N) if( i != open && i != prev ) {
            if( a[i] == 0 ) fale = 1;
            ans.push_back(i+1), a[i]--;
        }
        if( a[open] == 0 ) fale = 1;
        ans.push_back(open+1), a[open]--;
        prev = open;
        K--;
    }

    printf ("%d\n", N = fale ? -1 : (int)ans.size() );
    // N = ans.size();
    Rep(i,N) printf ("%d%c", ans[i], i == N-1 ? '\n' : ' ' );

    return 0;
}





Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n) / gcd(n, m)*abs(m);//gl=xy
}
 
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;
}
 
using namespace std;

void solve(){
  string s;
  cin>>s;
  int ans=0;
  int n=s.size();
  rep(i,n){
    REP(j,i,n){
      if(s[j]!='A'&&s[j]!='G'&&s[j]!='T'&&s[j]!='C')break;
      chmax(ans,j-i+1);
    }
  }
  cout<<ans;
}

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

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

int gcd(int a, int b) {
    int tmp;
    if (a < b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    return (a % b == 0 ? b : gcd(b, a % b));
}

int main() {
    int n, x, xi;
    cin >> n >> x;

    cin >> xi;
    int d = abs(x - xi);
    for (int i = 1; i < n; i++) {
        cin >> xi;
        d = gcd(d, abs(x - xi));
    }

    cout << d << endl;
}

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

int main() {
  int n,m;cin>>n>>m;
  vector<int> a(n),b(n),c(m),d(m);
  rep(i,n)cin>>a[i]>>b[i];
  rep(i,m)cin>>c[i]>>d[i];
  rep(i,n){
    int ans,cnt1=1e9;
    rep(j,m){
     int cnt=abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(cnt<cnt1){
        cnt1=abs(a[i]-c[j])+abs(b[i]-d[j]);
        ans=j+1;
      }
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 3632
import itertools
while True:
    n, x = map(int, input().split())
    count = 0
    if n == x == 0:
        break
    num_list = [i for i in range(1, n+1)]
    res = list(itertools.combinations(num_list, 3))
    for i in range(len(res)):
      if sum(res[i]) == x:
        count += 1
    print(count)
    


Measured memory_bytes: 31428
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
typedef long long ll;
typedef pair<int, int> P;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

int main(){
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a+b){cout<<min(a,k);return 0;}
  if(k>a+b){cout<<a-(k-a-b);return 0;}
  return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <stdlib.h>
#define ll long long

int main(void) {
    ll n, k, x, tmp;
    scanf("%lld %lld", &n, &k);
    x = n % k;
    if (x == 0) {
        printf("%lld\n", x);
        return 0;
    }
    
    tmp = llabs(x - k);

    if (x > tmp) printf("%lld\n", tmp);
    else printf("%lld\n", x);

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<algorithm>

using namespace std;

typedef long long ll;

ll a[5];

int main() {
	cin >> a[1] >> a[2] >> a[3];
	sort(a + 1, a + 4);
	if (!(a[1] & 1) || !(a[2] & 1) || !(a[3] & 1)) {
		cout << 0 << endl;
	}
	else {
		cout << a[1] * a[2] << endl;
	}
	return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        if(a>b) {
            System.out.println("a > b");
        }else if(a<b) {
            System.out.println("a < b");
        }else{
            System.out.println("a == b");
        }
    }
}



Measured memory_bytes: 26184
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,cnt=0;
    cin >> n;
    int s[n];
    for(int i=0;i<n;i++) cin >> s[i];
    int q;
    cin >> q;
    int t[q];
    for(int i=0;i<q;i++) cin >> t[i];
    for(int i=0;i<q;i++){
        int left =-1,right=n;
        while(right -left>1){
            int mid = left + (right-left)/2;
            if(s[mid]>= t[i]) right = mid;
            else left = mid;
        }
        if(s[right]==t[i]) cnt++;
    }
    cout << cnt << endl;
}



Measured memory_bytes: 3608
import sys

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

dp = [sys.maxsize] * n
dp[0] = 0
for i in range(n):
    for j in (i + 1, i + 2):
        if j < n:
            dp[j] = min(dp[j], dp[i] + abs(a[i] - a[j]))
print(dp[n - 1], end="")


Measured memory_bytes: 20636
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = int(0)

N = I()
dp = [{} for i in range(N+4)]

def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i - 1], t[i] = t[i], t[i - 1]
        if ''.join(t).find('AGC') != -1:
            return False
    return True

def dfs(i, last3):
    if last3 in dp[i]:
        return dp[i][last3]
    if i == N:
        return 1
    cou = int(0)
    for s in "ACGT":
        if ok(last3+s):
            cou = (cou + dfs(i+1, last3[1:]+s)) % mod

    dp[i][last3] = cou
    return cou

ans = dfs(0,"TTT")
print(ans)


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

int main() {

  int n,x,t,s;
  cin>>n>>x>>t;
  if(n%x!=0){
  s=((n/x)+1)*t;
 }
  if(n%x==0){
    s=(n/x)*t;}
   cout<<s<<endl;}
    

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int H, W;
    cin >> H >> W;
    H += 2;
    W += 2;
    vector<vector<string>> V(H, vector<string>(W));
    rep(i, H) {
        string s;
        if(i != 0 && i != H - 1) cin >> s;
        rep(j, W) {
            if(i == 0 || i == H - 1 || j == 0 || j == W - 1) {
                V[i][j] = '.';
            } else {
                V[i][j] = s[j - 1];
            }
        }
    }

    forr(i, 1, H - 1) {
        forr(j, 1, W - 1) {
            if(V[i][j] == "#") continue;
            int cnt = 0;
            forr(k, i - 1, i + 2) {
                forr(l, j - 1, j + 2) {
                    if(V[k][l] == "#") cnt++;
                }
            }
            V[i][j] = cnt + '0';
        }
    }

    forr(i, 1, H - 1) {
        forr(j, 1, W - 1) {
            cout << V[i][j];
        }
        cout << endl;
    }

    return 0;
}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		for(int i=0;i<3;i++){
			int come = Sec(stdIn.nextInt(),stdIn.nextInt(),stdIn.nextInt());
			int out = Sec(stdIn.nextInt(),stdIn.nextInt(),stdIn.nextInt());
			int ans[] = Work(out-come);
			System.out.println(ans[0]+" "+ans[1]+" "+ans[2]);
		}
	}
	static int Sec(int h, int m, int s){
		return h*60*60+m*60+s;
	}
	static int[] Work(int sec){
		int ret[] = new int[3];
		ret[0] = sec/3600;
		ret[1] = (sec%3600)/60;
		ret[2] = sec%60;
		return ret;
	}
}

Measured memory_bytes: 15328
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    int n,a[105];
    scanf("%d",&n);
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)
    {
    	if(a[i]%2==0)
    	{
    		if(a[i]%3!=0&&a[i]%5!=0){
    			cout<<"DENIED";return 0;
    		}
    	}
    }
   cout<<"APPROVED";
	return 0;
}


Measured memory_bytes: 256
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(ll)(n);++i)
#define _repe3(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(ll)(b)-1;i>=(ll)(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define _rrepe2(i,n) for(ll i=(ll)(n);i>=0;i--)
#define _rrepe3(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);i--)
#define rrepe(...) _overload3(__VA_ARGS__,_rrepe3,_rrepe2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
const string YES = "Yes";
const string NO = "No";

ll D;
ll T;
ll S;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> D;
    cin >> T;
    cin >> S;
    solve();
}

// 1 <= D <= 10000
// 1 <= T <= 10000
// 1 <= S <= 10000
// 入力は全て整数

// ll D, ll T, ll S
// 高橋君が待ち合わせ時刻までに待ち合わせ場所に到着するならば Yes、そうでないなら No を出力せよ。
void solve(){
    cout<<(D<=S*T?YES:NO)<<endl;
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Text;

class TEST{
	static void Main(){
		while(true){
		String S="";
		if((S=Console.ReadLine()) ==null)break;
		var d=Array.ConvertAll(S.Split(' '),elem=>int.Parse(elem));
		Sol mySol=new Sol(d[0],d[1]);
		Console.WriteLine(mySol.Ans);
		}
	}
}

class Sol{
	int ans;
	public int Ans{
		get{return ans;}
	}
	
	int N;
	int R;
	Queue<int> Deck;
	
	public Sol(int n,int r){
		N=n;R=r;
		Deck=new Queue<int>();
		for(int i=0;i<n;i++){
			Deck.Enqueue(i);
		}
		var C=Console.ReadLine().Split(' ');
		for(int i=0;i<R;i++){
			Riffle(int.Parse(C[i]));
		}
		for(int i=0;i<N;i++)ans=Deck.Dequeue();
	}
		
	void Riffle(int c){
		Queue<int>[] D=new Queue<int>[2];
		D[0]=new Queue<int>();
		D[1]=new Queue<int>();
		
		int NN=N/2;
		for(int i=0;i<NN;i++)D[1].Enqueue(Deck.Dequeue());
		if(N%2==1)NN++;
		for(int i=0;i<NN;i++)D[0].Enqueue(Deck.Dequeue());

		int turn=0;
		int cnt=0;
		for(int i=0;i<N;i++){
			Deck.Enqueue(D[turn].Dequeue());
			cnt++;
			if(cnt==c || D[turn].Count==0){
				turn=1-turn;
				cnt=0;
			}
		}
	}
}

Measured memory_bytes: 6128
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#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++)
const long long INF =  999999999;

struct edge{int from,to,cost;};
vector<edge> evec;
int d[1010];

int main(){
  int V,E,r;
  cin>>V>>E>>r;

  REP(i,E){
    int s,t,d;
    cin >>s>>t>>d;
    edge e;
    e.from=s;
    e.to=t;
    e.cost=d;
    evec.push_back(e);
  }

  fill(d,d+V,INF);
  d[r]=0;
  int count=0;
  while(true){
    bool update=false;
    count++;
    REP(i,E){
      edge e=evec[i];
      if(d[e.from]<INF && d[e.from]+e.cost <d[e.to]){
        d[e.to]=d[e.from]+e.cost;
        update = true;
      }
    }
    if(!update)break;
    if(count==V+1)break;
    }

    if(count==V+1){
      cout<<"NEGATIVE CYCLE"<<endl;
    }
    else{
      REP(i,V){
        if(d[i]==INF)cout<<"INF"<<endl;
        else cout<<d[i]<<endl;
      }
    }
  }



Measured memory_bytes: 3212
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            HashSet<string> hs = new HashSet<string>();
            StringBuilder sb = new StringBuilder();

            for(int i = 0; i < n; i++)
            {
                string[] input = Console.ReadLine().Split(' ');

                if (input[0] == "insert") hs.Add(input[1]);
                else
                {
                    sb.AppendLine(hs.Contains(input[1]) ? "yes" : "no");
                }
            }

            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 47352
#include <iostream>

using namespace std;

int main(){
    char data[3];
    int i=0;
    int r=0;
    int s=0;

    cin >> data;
    
    for (i=0; i<4; i++){
        if(data[i]==82){
            if(s==0){
                r += 1;
            }
            else if((s==1) && (r==0)){
                r = 1;
                s = 0;
            }
            else{
            s = 0;
            }
        }
        else{
            s = 1;
        }
    }

    cout << r;

    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define dump(x)  cout << #x << " = " << (x) << endl;
#define pb push_back
#define int long long
//#define lint long long

const int INF = 1e9;
const int MOD = 1e9+7;
//const lint LINF = 1e18;
const double eps = 0.000000001;//もとの値の10^(-16)まで

using namespace std;

//typedef pair<int, int> P;

int n,m;
vector<int> s[15];
int den[11];
int k[15];
int p[15];
int ans;

signed main(){
  cin >> n >> m;
  for(int i=1;i<=m;i++){
    cin >> k[i];
    for(int j=1;j<=k[i];j++){
      int aaa;
      cin >> aaa;
      s[i].pb(aaa);
    }
  }
  for(int i=1;i<=m;i++) cin >> p[i];

  REP(i,pow(2,n)){
    int t = i;
    for(int j=1;j<=n;j++){
      int now = t%2;
      t /= 2;
      den[j] = now;
    }
    int frag = 1;
    for(int j=1;j<=m;j++){
      int fff = 0;
      for(int kk=0;kk<k[j];kk++){
        if(den[s[j][kk]]==1) fff++;
      }
      if(fff%2!=p[j]) frag = 0;
      //cout << fff;
    }
    if(frag==1) ans ++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int MAX_N=123456*2;
bool is_prime[MAX_N+1];
int sum[MAX_N+1];
int main() {
    for(int i=2;i<=MAX_N;i++) is_prime[i]=1;
    for(int i=2;i*i<=MAX_N;i++) {
        if(!is_prime[i]) continue;
        for(int j=i*2;j<=MAX_N;j+=i) is_prime[j]=0;
    }
    for(int i=2;i<=MAX_N;i++) {
        sum[i]=sum[i-1]+is_prime[i];
    }
    int n;
    while(scanf("%d",&n),n) {
        printf("%d\n",sum[2*n]-sum[n]);
    }
}

Measured memory_bytes: 4340
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int michi[] = new int[6];
    for(int i = 0 ; i < 6 ; ++i){
      michi[i] = sc.nextInt();
    }
    int kazu[] = new int[4];
    for(int i = 0 ; i < 4 ; ++i){
      kazu[i] = 0;
    }
    for(int i = 0 ; i < 6 ; ++i){
      if(michi[i] == 1){
        kazu[0]++;
      }else if(michi[i] == 2){
        kazu[1]++;
      }else if(michi[i] == 3){
        kazu[2]++;
      }else if(michi[i] == 4){
        kazu[3]++;
      }
    }
    
    String ans = "YES";
    
    for(int i = 0 ; i < 4 ; ++i){
      if(kazu[i] >= 3){
        ans = "NO";
      }
    }

    System.out.println(ans);
    
  }
}

Measured memory_bytes: 35460
face = [0]*6
class Dice():

    def __init__(self):
        self.number = [inp[i] for i in range(6)]
        self.order = 'NNNNWNNNWNNNENNNENNNWNNN'

    def setnumbers(self, n0, n1, n2, n3, n4, n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5


    def spin(self, command):
        for i in range(6):
            face[i] = self.number[i]
        if command == 'S':
            self.setnumbers(face[4], face[0], face[2], face[3], face[5], face[1])
            # print('command is S')
        elif command == 'N':
            self.setnumbers(face[1], face[5], face[2], face[3], face[0], face[4])
            # print('command is N')
        elif command == 'E':
            self.setnumbers(face[3], face[1], face[0], face[5], face[4], face[2])
            # print('command is E')
        elif command == 'W':
            self.setnumbers(face[2], face[1], face[5], face[0], face[4], face[3])
            # print('command is W')
    def equal(self, another):
        set = False
        for i in self.order:
            self.spin(i)
            FLAG = True
            for k in range(6):
                if self.number[k] != another.number[k]:
                    FLAG = False
                    break
            if FLAG == True:
                return True
        return set

dice = []
n = int(input())
for i in range(n):
    inp = list(map(int, input().split()))

    k= Dice()
    dice.append(k)

    k.setnumbers(inp[0], inp[1], inp[2], inp[3], inp[4], inp[5])


flag = True
j = 0
for i in range(n):
    for j in range(i+1, n):
        if dice[i].equal(dice[j]):
            flag = False
            break
if flag == True:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 5620
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(int argc, const char * argv[]) {
    
    int i, count = 0;
    char s[1000], p[11], stop[] = "END_OF_TEXT";
    
    scanf("%s",p);
    
    for(i=0;i<strlen(p);i++){
        p[i] = tolower(p[i]);
    }
    
    while(1){
        
        scanf("%s",s);
        for(i=0;i<strlen(s);i++){
            if(strcmp(s,stop) == 0) break;
            else s[i] = tolower(s[i]);
        }
        if(strcmp(s,p) == 0){
            count++;
        }
        if(strcmp(s,stop) == 0) break;
    }
    printf("%d\n",count);
    return 0;
}

Measured memory_bytes: 552
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *



def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	S = inputStr()

	S = S[:3]
	print(S)


if __name__ == "__main__":
	main()


Measured memory_bytes: 72580
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n; cin >> n;
	ll c; cin >> c;
	vector<pair<ll,ll>> x(n); rep(i, n)cin >> x[i].first >> x[i].second;
	vector<ll> sum(n + 1), rsum(n + 1);
	rep(i, n)sum[i + 1] += sum[i] + x[i].second;
	rrep(i, n)rsum[i] += rsum[i + 1] + x[i].second;
	vector<ll> mx(n), rmx(n);
	mx[0] = max(0LL, x[0].second - x[0].first);
	rmx[n - 1] = max(0LL, x[n - 1].second - (c - x[n - 1].first));
	rep(i, n - 1)mx[i + 1] = max(mx[i], sum[i + 2] - x[i + 1].first);
	rrep(i, n - 1)rmx[i] = max(rmx[i + 1], rsum[i] - (c - x[i].first));
	ll res = 0;
	rep(i, n)
	{
		if (i == n - 1)res = max(res, mx[i]);
		else res = max(res, mx[i] - x[i].first + rmx[i + 1]);
	}
	rrep(i, n)
	{
		if (i == 0)res = max(res, rmx[0]);
		else res = max(res, rmx[i] - (c - x[i].first) + mx[i - 1]);
	}
	cout << res << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> P;

// real -> X
// imag -> Y
bool isIntersect(P p1, P p2, P p3, P p4){
	return 	(
			((p1.real() - p2.real()) * (p3.imag() - p1.imag()) + (p1.imag() - p2.imag()) * (p1.real() - p3.real())) *
			((p1.real() - p2.real()) * (p4.imag() - p1.imag()) + (p1.imag() - p2.imag()) * (p1.real() - p4.real()))
			) > 0.0;
}

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

	double xa, ya, xb, yb, xc, yc, xd, yd;
	// 0 0 1 0 1 1 0 1
	char c0;
	while(cin >> xa >> c0 >> ya >> c0){
		cin >> xb >> c0 >> yb >> c0;
		cin >> xc >> c0 >> yc >> c0;
		cin >> xd >> c0 >> yd;

		P a(xa, ya);
		P b(xb, yb);
		P c(xc, yc);
		P d(xd, yd);

		cout << ((isIntersect(a, c, b, d) || isIntersect(b, d, a, c)) ? "NO" : "YES") << endl;
	}

	return 0;
}

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

int cmp(const void* p, const void* q) {
	return *(int*)q - *(int*)p;
}

int main(void) {
	int n, k;
	int a[200001] = { 0 };
	int cnt[200001] = { 0 };
	int ans = 0;
	int shurui = 0;

	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		cnt[a[i]]++;
	}
	qsort(cnt, n+1, sizeof(int), cmp);
	for (int i = 0; i < n ; i++) {
		if (cnt[i] != 0)shurui++;
	}
	for (int i = n - 1; i >= 0; i--) {
		if (shurui <= k) {
			printf("%d", ans);
			break;
		}
		else if (cnt[i] > 0)ans += cnt[i], shurui--;
	}
	return 0;
}


Measured memory_bytes: 2556
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;

int main(){
    int n,h,w;
    cin>>n>>h>>w;
    cout<<(n-h+1)*(n-w+1)<<endl;
  
    
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.14159265358979323846;

void solve() {
    ll n, i;
    cin >> n >> i;
    cout << n - i + 1 << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, s;
    cin >> n >> s;
    vector<int>v(n + 3);
    for(int i = 1; i <= n; i++){
        cin >> v[i];
    }
    long long dp[n + 3][s + 3], mod = 998244353;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= s; j++){
            dp[i][j] = 0;
        }
    }
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= s; j++){
            dp[i][j] = (2 * dp[i - 1][j]) % mod;
        }
        for(int j = v[i]; j <= s; j++){
            dp[i][j] = (dp[i][j] + dp[i - 1][j - v[i]]) % mod;
        }
    }
    cout << dp[n][s];
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<(_loop_int)v.size()-1) cout<<sep;} cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;

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



int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin>>n;
    vi a(n);
    VIN(a);
    ll m=1000; //最初は1000円
    ll k=0;
    int p = a[0];

    FOR(i,1,n){
        //DEBUG(i);
        //DEBUG2(m,k);
        if(p<a[i]){//上がった
            k += m/p;
            m %= p;
        }else if(p>a[i]){
            //下がった
            m += k*p;
            k = 0;
        }


        p = a[i];
    }
    //DEBUG2(m,k);
    m += k*p;
    k = 0;
    //DEBUG2(m,k);
    cout << m << endl;
    return 0;
}

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

#define mp make_pair
#define fi first
#define se second
#define pb push_back

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ii,int> iii;
typedef pair<ll,ll> pll;

const int N = 2e5+5;
const int MX = 1e6+5;
int n, ans;
int ar[N], freq[MX];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> ar[i];
        freq[ar[i]]++;
    }
    if (freq[1] > 0)
    {
        cout << ((freq[1] > 1) ? 0 : 1) << '\n';
        return 0;
    }
    for (int i = 1; i <= n; i++)
    {
        bool good = 1;
        if (freq[ar[i]] > 1)
            good = 0;
        for (int j = 2; j*j <= ar[i] && good; j++)
        {
            if (ar[i] % j != 0)
                continue;
            if (freq[j] > 0)
                good = 0;
            int k = ar[i] / j;
            if (freq[k] > 0)
                good = 0;
        }
        // cout << ar[i] << " -> " << good << '\n';
        if (good)
            ans++;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 8204
#include <cstdio>
#include <utility>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
//vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T> vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo

int main() {
	double a = in(), b = in();
	printf("%f\n", a * b / 3.305785);
}


Measured memory_bytes: 2712
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		Long[] v = new Long[N];
		for(int i = 0; i < N; i++) {
			v[i] = sc.nextLong();
		}
		sc.close();
		Arrays.sort(v, Comparator.reverseOrder());
		long sum = 0;
		int cnt = 1;
		long k = v[0];
		for(int i = 0; i < N; i++) {
			if(k != v[i]) {
				cnt++;
				k = v[i];
			}
		}
		for(int i = 0; i < A; i++) {
			sum += v[i];
		}
		double myu = (double) sum / A;

		int[] t = new int[cnt];
		k = v[0];
		int idx = 0;
		for(int i = 0; i < N; i++) {
			if(k == v[i]) {
				t[idx]++;
			}else {
				k = v[i];
				idx++;
				t[idx]++;
			}
		}
		long ans = 0;

		for(int i = A; i <= B; i++) {
			long s = 0;
			for(int j = 0; j < i; j++) {
				s += v[j];
			}
			if(sum * i == s * A) {
				int a = 0;
				for(int j : t) {
					a += j;
					if(a >= i) {
						ans += comb(j, a - i);
						break;
					}
				}
			}else {
				break;
			}
		}
		BigDecimal bd = new BigDecimal(myu);
		System.out.println(bd.toString());
		System.out.println(ans);
	}
	public static long comb(int n, int r) {
        if (n - r < r) r = n - r;
        if (r == 0) return 1;
        if (r == 1) return n;
        int[] num = new int[r];
        int[] den = new int[r];
        for (int k = 0; k < r; k++){
            num[k] = n - r + k + 1;
            den[k] = k + 1;
        }
        for (int p = 2; p <= r; p++) {
            int pivot = den[p - 1];
            if (pivot > 1) {
                int offset = (n - r) % p;
                for (int k = p - 1; k < r; k += p) {
                    num[k - offset] /= pivot;
                    den[k] /= pivot;
                }
            }
        }
        long result = 1;
        for (int k = 0; k < r; k++) {
            if (num[k] > 1) result *= num[k];
        }
        return result;
    }

}

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

int main(void){
  int n;
  cin >> n;
  int student;
  vector<int> order(n);
  for(int i = 1; i <= n; i++){
    cin >> student;
    order[student-1] = i;
  }
  for(int i = 0; i < n; i++){
    cout << order[i];
    if(i == n-1) cout << endl;
    else cout << " ";
  }
  return 0;
}


Measured memory_bytes: 1152
N,M,X=map(int,input().split())
A=[]
C=[]
for i in range(N):
    tmp=list(map(int,input().split()))
    C.append(tmp[0])
    A.append(tmp[1:])

INF=float("INF")
min_cost=INF

def dfs(i,cost,learn):
    if i==N:
        if min(learn)>=X:
            return cost
        else:
            return INF
    else:
        new_learn=[x+y for (x,y) in zip(A[i],learn)]

        # ここの仕組みがよく分からない・・・
        cost=min(dfs(i+1,cost,learn),dfs(i+1,cost+C[i],new_learn))
        return cost

min_cost=dfs(0,0,[0]*M)

if min_cost==INF:
    print(-1)
else:
    print(min_cost)


Measured memory_bytes: 9224
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    double A[100];
    int N;
    cin>>N;
    double sum=0;
    for(int i=0;i<N;i++){
    cin>>A[i];
    //cout<<A[i]<<endl;
    }
    sort(A, A+N);
    sum=A[0];
    //cout<<sum<<endl;
    for(int i=0;i<N-1;i++){
    //cout<<A[i]<<endl;
    sum=(sum+A[i+1])/2;
    }
    cout<<sum<<endl;
}


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

int main(){
  int N, M, tmpX,res=0;
  vector<int> X,delta;
  scanf("%d %d\n", &N, &M);
  for(int i=0;i<M;i++){
	scanf("%d", &tmpX);
    X.push_back(tmpX);
  }
  sort(X.begin(),X.end());  
  for(int i=0;i<X.size()-1;i++){
    delta.push_back(abs(X[i]-X[i+1]));
  }
  sort(delta.begin(),delta.end());

  for(int i=0;i<N-1;i++){
    if(delta.size()==0){
	  printf("0\n");
      return 0;
    }
    delta.pop_back();
  }

  for(auto &num:delta)
    res+=num;
  printf("%d\n",res);


  return 0;
}

Measured memory_bytes: 1400
W=87,i,n;char a[100002],s[100002];f(x,y){*a=x;a[1]=y;for(i=0;++i<=n;)a[i+1]=a[i]==W^a[i-1]==W^s[i]=='o'?83:W;if(!strncmp(a,a+n,2))a[n]=0,puts(a),exit(0);}main(){scanf("%d%s",&n,&s);s[n]=*s;s[n+1]=s[1];f(83,83);f(83,W);f(W,83);f(W,W);puts("-1");}

Measured memory_bytes: 512
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#include<cmath>


#define REP(i,n) for (int i = 0; (i) < (n); ++ (i))
#define FOR(i,n) for (int i = 1; (i) <= (n); ++ (i))
#define lint long long

using namespace std;
lint n,m;
lint ans;

int main(){
  cin >> n >> m;
  if(2*n>=m){
    cout << m/2 << endl;
    return 0;
  }
  ans += n;
  m -= 2*n;
  n = 0;


  ans += m/4;
  cout << ans <<endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np
S = np.zeros(5)
s = np.zeros(5)

S[0] = int(input())
S[1] = int(input())
S[2] = int(input())
S[3] = int(input())
S[4] = int(input())
ANS = 0
for i in range(5):
    s[i] = (S[i]-1)%10
    ANS = ANS -(-S[i]//10)*10

ANS = ANS - (10-(s[s.argmin()]+1))
print(str(int(ANS)))

Measured memory_bytes: 20388
x, y = map(int, raw_input().split())
t = abs(abs(y) - abs(x))
if 0 < y < x:
    t += 2
elif y < x < 0:
    t += 2
elif y < 0 <= x:
    t += 1
elif y <= 0 < x:
    t += 1
elif x < 0 < y:
    t += 1
print t


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

inline void ioThings() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#define debug(x) cerr << #x << ": <" << (x) << ">\n"
#else
#define debug(x)
#endif
}

#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc()    int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)     (int)x.size()
#define eb        emplace_back
#define pb        push_back
#define mp(x, y)  make_pair(x, y);
#define all(x)    x.begin(), x.end()
#define rall(x)   x.rbegin(), x.rend()
#define fi        first
#define se        second
#define mod       1000000007

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

int main() {
  ioThings();

  ll n, k;
  cin >> n >> k;

  map<int, int> m;
  rep(i, n) {
    int x;
    cin >> x;
    m[i + 1] = x;
  }

  map<int, int> d;
  d[1] = 0;
  int cur = 1;
  for (ll i = 0; i < k; i++) {
    cur = m[cur];
    if (i < 1e6) {
      if (d.count(cur)) {
        int clen = i + 1 - d[cur];
        i += (k - i - 1) / clen * clen;
      } else d[cur] = i + 1;
    }
  }

  cout << cur;

  return 0;
}


Measured memory_bytes: 20468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 1e5 + 10;
const int mod = 1e9+7;
const int INF=0x3f3f3f3f;

int p[MAX];
int c[MAX];
int biao[MAX];

ll res=-INF;
ll tem=-INF;
ll dfs(ll u,ll fen){
    if(biao[p[u]]!=0){
        return biao[u];
    }
    biao[p[u]]=biao[u]+1;
    tem=max(tem,fen+c[p[u]]);
    return dfs(p[u],fen+c[p[u]]);
}

ll dfs2(ll u,ll fen,ll ci,ll deep){
    if(deep==ci){
        return fen;
    }
    return dfs2(p[u],fen+c[p[u]],ci,deep+1);
}

ll dfs3(ll u,ll fen,ll ci,ll deep){
    if(ci==deep){
        return fen;
    }
    tem=max(tem,fen+c[p[u]]);
    return dfs3(p[u],fen+c[p[u]],ci,deep+1);
}
void solve() {
    ll n,k;
    cin>>n>>k;
    for(ll i=1;i<=n;i++){
        cin>>p[i];
    }
    for(ll i=1;i<=n;i++){
        cin>>c[i];
    }
    for(ll i=1;i<=n;i++) {
        memset(biao,0,sizeof(biao));
        tem=-INF;
        biao[i]=1;
        ll ci=dfs(i, 0);
        if(ci>=k){
            tem=-INF;
            dfs3(i,0,k,0);
            res=max(res,tem);
        }else{
            ll shu=dfs3(i,0,ci,0);
            if(shu>0){
                ll jici=k/ci;
                ll sheng=k%ci;
                ll zhi=jici*shu;
                tem=-INF;
                if(sheng!=0) {
                    dfs3(i, 0, sheng, 0);
                }else{
                    zhi=zhi-shu;
                    dfs3(i, 0, ci, 0);
                }
                zhi=zhi+(tem>0?tem:0);
                res=max(res,zhi);
            }else{
                res=max(res,tem);
            }
        }
        //cout<<"----------"<<ci<<" "<< tem<<" "<<dfs2(i,0,ci,0)<<'\n';
    }
    cout<<res;
}

int main() {
    int _ = 1;
    //cin >> _;
    while (_--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4056
//        VIVEK UPADHYAY
//        MANIT, BHOPAL(M.P)


//                         JAB-TAK TODEGA NHI,
//                         TAB -TAK CHODEGA NHI :D
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<cstdlib>
#include<unistd.h>
#include<string>
#include<cstring>
#include<stack>
#include<queue>
#include<utility>
#include<cmath>
#include<set>
#include<unordered_map>
#include<cstdio>
#include<map>
#include<numeric>
using namespace std;
#define F first
#define S second
#define mk(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define LINE cout<<endl
#define ok cout<<"ok\n" ;
typedef long long ll;
const int MAXN = 1e6 + 10 ;
const int MAX = 1e7 ;
double pi = 3.1415926535897932384626433832795;
const ll inf=1e18 ;
int main() {
    int N , M ;
    cin >> N >> M ;
    string s[N] ;
    for(int i=0;i<N;i++)
            cin >> s[i] ;
    
    for(int i=0;i<N;i++){
        int cnt=0 ;
        for(int j=0;j<M;j++)
            if(s[i][j]=='.') cnt++ ;
        if(cnt==M)
            for(int j=0;j<M;j++)
                s[i][j]='$' ;
    }
    for(int i=0;i<M;i++)
    {
        int cnt= 0 ;
        for(int j=0;j<N;j++)
            if(s[j][i]=='.'|| s[j][i]=='$') cnt++ ;
        if(cnt==N)
            for(int j=0;j<N;j++)
                s[j][i]='$' ;
    }
    for(int i=0;i<N;i++){
        bool flag = true ;
        for(int j=0;j<M;j++)
            if(s[i][j]!='$'){
                cout<<s[i][j];
                flag=false ;
            }
        if(flag==false)
        cout<<endl;
    }
    return 0 ;
}


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

int main() {
  string s;
  int cnt = 0, ans = 0;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'R') {
      cnt++;
    } else {
      cnt = 0;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3584
from collections import Counter  

blue = []
red = []
N = int(input())
for i in range(N):
    blue.append(input())
M = int(input())
for j in range(M):
    red.append(input())
b = Counter(blue)
r = Counter(red)
print(max([0] + [b[x] - r[x] for x in b]))


Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
priority_queue<int> q;
int getin;
int main()
{
	int sum=0;
	for(int i=1;i<=3;i++)
	{
		scanf("%d",&getin);
		q.push(getin*-1);
	}
	for(int i=1;i<=2;i++)
	{
		sum+=q.top()*-1;
		q.pop();
	}
	printf("%d\n",sum);
	return 0;
}

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

int main() {
  int s1s2s3, x, y, z;
  
  cin >> s1s2s3;
  x = s1s2s3 / 100;
  y = (s1s2s3 - 100 * x) / 10;
  z = s1s2s3 % 10;
  cout << x + y + z << endl;
}

Measured memory_bytes: 3588
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>

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

static const ll INF = 1001001001;

void debug_out() {};
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 1
#endif

struct C1 {
        ll N_{};
    string S_{};
    explicit C1(string S) : N_(S.size()), S_(move(S)){}

    ll resolve() {
        ll count = 0;
        char prev{};
        for(ll i=0; i < N_; ++i) {
            if (S_[i] != prev) {
                count++;
                prev = S_[i];
            }
        }
        return count;
    }
};

int main() {
    ll N;
    string S;
    cin >> N ;
    cin >> S ;
    C1 c{move(S)};
    cout << c.resolve() << endl;
    debug(c.resolve());
    return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h> 
using namespace std;
 
#define ll long long int
#define absdiff(a,b) (a>b)?a-b:b-a
#define debug cout<<"debug";
#define mp make_pair 
#define pb push_back
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);
#define MOD 1000000007
#define ll_MAX 19223372036859
#define endl "\n"
ll fast_expo(ll x,ll p){if(p==0) return 1;
	else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} 
	else return (x*(fast_expo(x,p-1))%MOD)%MOD;}

ll arr[50][50], ans[50][50];

void multiply(ll ans[][50], ll mat1[][50], ll mat2[][50], ll n)
{
    ll arr[50][50];
	memset(arr, 0 ,sizeof(0));
    for(ll i=0; i<n; ++i){
        for(ll j=0; j<n; ++j){
            ll temp=0;
            for(ll k=0; k<n; ++k){
                temp=(temp+mat1[i][k]*mat2[k][j])%MOD;
            }
            arr[i][j]=temp;
        }
    }

    for(ll i=0; i<n; ++i){
        for(ll j=0; j<n; ++j) 
			ans[i][j]=arr[i][j];
	}
}

void mat_expo(ll mat[][50], ll ans[][50], ll k, ll n)
{
    if(k==1){
        for(ll i=0; i<n; ++i){
            for(ll j=0; j<n; ++j) 
				ans[i][j]=mat[i][j];
        }
        return;
    }

    else if(k%2==0){
       mat_expo(mat, ans, k/2, n);
       multiply(ans, ans, ans, n);
    }
    else{
        mat_expo(mat, ans, k-1, n);
        multiply(ans, mat, ans, n);
    }
}

int main()
{
    ll q=1;
    // cin>>q;
    for(ll x=0; x<q; ++x){
        ll n,k; cin >> n >> k;
		for(ll i=0; i<n; ++i){
			for(ll j=0; j<n; ++j){
				cin >> arr[i][j];
			}
		}

		mat_expo(arr, ans, k, n);
		ll opt = 0;
		for(ll i=0; i<n; ++i){
			for(ll j=0; j<n; ++j)
				opt = (opt + ans[i][j])%MOD;
		}

		cout << opt << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import fractions
from functools import reduce

def lcm(a,b):
    return a*b // fractions.gcd(a,b)

n = input()
a = [int(_) for _ in input().split()]

# gcd = functools.reduce(math.gcd, values)
m = reduce(lcm, a) - 1

f = 0
for ai in a:
    f = f + m%ai

print(f)

Measured memory_bytes: 5560
int main()
{
    int array[3], a, b, c, s;

    scanf("%d %d %d", &a, &b, &c);
    array[0] = a;
    array[1] = b;
    array[2] = c;

    for (int i = 0 ; i < 2; i++)
     {
        for (int j = 0 ; j < 2 - i; j++)
        {
            if (array[j] > array[j + 1])
            {
               s = array[j];
               array[j] = array[j + 1];
               array[j + 1] = s;
             }
        }
    }
    
    printf("%d %d %d", array[0], array[1], array[2]);
    
    printf("\n");
    
    return 0;
}


Measured memory_bytes: 2120
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0

for a in range(0, A+1):
    for b in range(0, B+1):
        for c in range(0, C+1):
            Y = 500 * a + 100 * b + 50 * c
            if X == Y:
                ans += 1

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,N) for(ll i=0; i<N; i++)
using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main(){
    ll n; cin >> n;
    ll a[n], b[n], c[n];
  	rep(i,n) cin >> a[i];
  	rep(i,n) cin >> b[i];
  	rep(i,n) cin >> c[i];

    sort(a, a+n); sort(b, b+n); sort(c, c+n);
    ll ans = 0;
    rep(i,n){
        auto itr1 = upper_bound(a, a+n, b[i]-1);
        auto itr2 = lower_bound(c, c+n, b[i]+1);
        ans += (itr1 - a) * (c + n - itr2);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<pii>
#define vll vector<pll>
#define all(v) v.begin(),v.end()
#define mem(v,x) memset(v,x,sizeof(v))
#define ar array
#define N 200005

using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	int n,m,x;
	cin>>n>>m>>x;
	int c[n];
	int a[n][m];
	for(int i=0;i<n;i++){
        cin>>c[i];
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
	}
	int ans = -1;
	for(int i=1;i<(1<<n);i++){
        vector<int> v(m);
        int val = i;
        int pos = 0;
        int cost = 0;
        while(val){
            if(val&1){
                for(int j=0;j<m;j++){
                    v[j] += a[pos][j];
                }
                cost += c[pos];
            }
            pos++;
            val >>= 1;
        }
        bool flag = true;
        for(int j=0;j<m;j++){
            flag &= (v[j]>=x);
        }
        if(flag){
            ans = (ans==-1?cost:min(ans,cost));
        }
	}
	cout<<ans;
	return 0;
}


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

using namespace std;
int main() {
  int n;
  cin >> n;
  int l[n];
  int m = 0;
  int total = 0;

  for (int i = 0; i < n; i++) {
    cin >> l[i];
    m = max(m, l[i]);
    total += l[i];
  }

  cout << (m < total - m ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll c, s, f, n;std::cin >> n;
  vvl train = vv(n, 3, 0, ll);
  re(i, n-1) std::cin >> train[i][0] >> train[i][1] >> train[i][2];

  for(int j=0;j<n;j++){
    ll t = 0;
    for(int i=j;i<n-1;i++){
      c = train[i][0], s = train[i][1], f = train[i][2];
      if(t<=s) t = s + c;
      else if(t%f!=0) t += (f - t%f) + c;
      else t += c;
    }
    std::cout << t << '\n';
  }
  return 0;
}


Measured memory_bytes: 256