akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
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; }
int main(void){
    int n, W; cin>>n>>W;
    vector <int> v(n);
    vector <int> w(n);
    vector <vector<long long>> dp(n ,vector <long long>(100010,0));
    for(int i=0;i<n;i++){
    cin>>w[i]>>v[i];
    }
    for(int i=0;i<100010;i++){
        if(i>=w[0]) dp[0][i]=v[0];
        //cout<<i<<' '<<dp[0][i]<<endl;;
    }
    for(int i=1;i<n;i++){
        for(int j=0;j<100010;j++){
            if(j>=w[i]){
                chmax(dp[i][j],dp[i-1][j-w[i]]+v[i]);
                chmax(dp[i][j],dp[i-1][j]);
            }
            else chmax(dp[i][j],dp[i-1][j]);
        }
    }
    cout<<dp[n-1][W]<<endl;
}

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

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 111, inf = 1000111222;

int cnt[max_n];

int main()
{
    //freopen("input.txt", "r", stdin);
    int n;
    for (int i = 1; i < max_n; ++i) {
        int k = i;
        while (k % 2 == 0) {
            k /= 2;
            cnt[i]++;
        }
    }
    cin >> n;
    int maxx = -1, ans = -1;
    for (int i = 1; i <= n; ++i) {
        if (cnt[i] > maxx) {
            maxx = cnt[i];
            ans = i;
        }
    }
    cout << ans;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ass 1e18
#define MOD 1000000007
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;
#define debug2(x,y) cout<<#x<<": "<< x<< ", "<< #y<< ": "<< y<< endl;
#define debug3(x,y,z) cout<<#x<<": "<< x<< ", "<< #y<< ": "<< y<<" "<<#z<<" : "<<z<< endl;
using namespace std;
typedef long long int ll;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
int main()
{
    ll n,k;
	cin>>n>>k;
	if(k==1)
		cout<<0;
	else
		cout<<n-k;
	return 0;
}

Measured memory_bytes: 256
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn comb2(n: usize) -> Vec<(usize, usize)> {
    let mut v = Vec::new();
    for i in 0..(n - 1) {
        for j in (i + 1)..n {
            v.push((i, j));
        }
    }
    v
}

fn main() {
    let v: Vec<u64> = read_line().split_whitespace().map(|x| x.parse().unwrap()).collect();
    
    let min = comb2(3).into_iter()
        .map(|(i, j)| v[i] + v[j])
        .min()
        .unwrap();
    
    println!("{}", min);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>
#include <utility>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    
    if(A == B){
        if(A == C)
            cout << "No" << endl;
        else
        {
            cout << "Yes" << endl;
        }
        
    }else if(A == C){
        if(A == B)
            cout << "No" << endl;
        else{
            cout << "Yes" << endl;
        }
    }else if(B == C){
        if(A == C)
            cout << "No" << endl;
        else{
            cout << "Yes" << endl;
        }
    }else{
        cout << "No" << endl;
    }

    return 0;

}

Measured memory_bytes: 3592
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<algorithm>
using namespace std;
const double INF=1e14;
const double eps=1e-8;
const double Pi=acos(-1.0);
int cmp (double A){
	if(fabs(A)<eps)return 0;
	else return A>0?1:-1;
}
bool equal(double A,double B){
	return cmp(A-B)==0;
}
struct Point{
	double x,y;
	Point(double _x=0,double _y=0):x(_x),y(_y){}
	friend Point operator + (const Point &A,const Point &B){return Point(A.x+B.x,A.y+B.y);}
	friend Point operator - (const Point &A,const Point &B){return Point(A.x-B.x,A.y-B.y);}
	friend double operator * (const Point &A,const Point &B){return A.x*B.x+A.y*B.y;}
	friend double operator ^ (const Point &A,const Point &B){return A.x*B.y-A.y*B.x;}
	double ang(){
		return atan2(y,x);
	}
	void read(){
		scanf("%lf%lf",&x,&y);
	}
	void write(){
		printf("%lf %lf\n",x,y);
	}
};
struct Square{
	Point A,B,C,D;
	void read(){
		A.read();C.read();
		B.x=C.x;B.y=A.y;
		D.x=A.x;D.y=C.y;
	}
	void write(){
		cout<<"Print\n";
		A.write();
		B.write();
		C.write();
		D.write();
		cout<<'\n';
	}
}A[3001];
struct area{
	double l,r;
	int Id;
}L[6001];
int n;
bool Check(Square A){
	return cmp(A.A.x)==-1&&cmp(A.C.x)==-1&&cmp(A.A.y)==-1&&(cmp(A.C.y)>=0);
}
bool cmpL (area A,area B){
	return cmp(A.l-B.l)==-1||(equal(A.l,B.l)&&A.r>B.r);
}
bool vis[2001];
int main(){
//	freopen("Aizu2472.in","r",stdin);
//	freopen("Aizu2472.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		A[i].read();
		if(Check(A[i])){
			L[i].r=A[i].B.ang();
			L[i].l=A[i].C.ang()-2*Pi;
			L[i].Id=i;
//			cout<<A[i].B.ang()<<" "<<A[i].C.ang()<<'\n';
			continue;
		}
		L[i].l=INF;
		L[i].r=-INF;
		
		L[i].l=min(L[i].l,A[i].A.ang());
		L[i].r=max(L[i].r,A[i].A.ang());
		
		L[i].l=min(L[i].l,A[i].B.ang());
		L[i].r=max(L[i].r,A[i].B.ang());
		
		L[i].l=min(L[i].l,A[i].C.ang());
		L[i].r=max(L[i].r,A[i].C.ang());
		
		L[i].l=min(L[i].l,A[i].D.ang());
		L[i].r=max(L[i].r,A[i].D.ang());
		
		L[i].Id=i;
	}
	for(int i=1;i<=n;++i){
		L[i+n].l=L[i].l+2*Pi;
		L[i+n].r=L[i].r+2*Pi;
		L[i+n].Id=L[i].Id;
	}
	sort(L+1,L+1+2*n,cmpL);
//	for(int i=1;i<=2*n;++i){
//		cout<<fixed<<setprecision(12)<<L[i].l<<" "<<L[i].r<<" "<<L[i].Id<<'\n';
//	}
	int ans=n+1;
	for(int i=1;i<=n;++i){
		int cost=1;
		double R=L[i].r;
		memset(vis,0,sizeof(vis));
		vis[L[i].Id]=1;
		for(int j=i+1;j<=2*n;++j){
//			if(cmp((L[j].l-L[i].l)-2*Pi)>=0)break;
			if(vis[L[j].Id])continue;
			vis[L[j].Id]=1;
			if(cmp(L[j].l-R)<=0)R=min(R,L[j].r);
			else cost++,R=L[j].r;
//			cout<<L[j].l<<" "<<L[j].r<<'\n';
//			cout<<fixed<<setprecision(10)<<R<<" "<<L[j].l<<'\n';
		}
//		for(int i=1;i<=n;++i){
//			if(!vis[i])cerr<<i<<" ";
//		}
		ans=min(ans,cost);
//		cout<<ans<<" "<<cost<<'\n';
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 3880
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
typedef long long ll;
int G[110][110];
int main() {
    int N, K;
    cin >> N >> K;
    FOR(i, 1, N) { G[0][i] = 1; }
    int m = ((N - 1) * (N - 2)) / 2 - K;
    int M = N - 1;
    if(m >= 0) {
        for(int i = 1; i < N; i++) {
            if(m == 0)
                break;
            for(int j = i + 1; j < N; j++) {
                G[i][j] = 1;
                m--;
                M++;
                if(m == 0)
                    break;
            }
        }
        cout << M << endl;
        rep(i, N) rep(j, N) if(G[i][j] == 1) cout << i + 1 << " " << j + 1
                                                  << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int n, h[110];
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> h[i];
    }

    int count = 1;
    int maxh = h[0];

    for (int i = 1; i < n; i++)
    {
        maxh = max(h[i], maxh);
        if (h[i] - maxh >= 0)
            count++;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 10007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    int a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;
    int ans1=0,ans2=0;
    double maxdensity=-1.0;
    for(int x=0;x*a*100<=f;x++){
        for(int y=0;y*b*100<=f;y++){
            for(int p=0;p*c<=30*e;p++){
                for(int q=0;q*d<=30*e;q++){
                    if(x*100*a+y*100*b+p*c+q*d<=f){
                        if(p*c+q*d<=(x*a+y*b)*e){
                            double density = (double)100.0*(p*c+q*d)/(x*100*a+y*100*b+p*c+q*d);
                            if(maxdensity<=density){
                                maxdensity=density;
                                ans1=(x*100*a+y*100*b+p*c+q*d);
                                ans2=(p*c+q*d);
                            }
                        }
                    }
                }
            }
        }
    }

    cout<<ans1<<" "<<ans2<<endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------








































Measured memory_bytes: 256
//gauravsinghh
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ld long double
#define db double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define sii set<int>
#define sll set<long long>
#define vii vector<int> 
#define vll vector<long long>
#define mii map<int,int>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ins insert
#define mp make_pair
#define w(t) cin >> t;while(t--)
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define os cout<<" "
#define bitcount __builtin_popcount
#define gcd __gcd
#define endl "\n"
#define present(s,x) (s.find(x) != s.end()) 
#define cpresent(s,x) (find(all(s),x) != s.end()) 
#define ford(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++) 
#define fors(container, it, a, b) for(__typeof(container.begin()) it = a; it != b; it++) 
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 999999999999999999
#define siz 1000005
#define fbo find_by_order
#define ook order_of_key
#define sz(s) (int)s.size()
#define mem(n,m) memset(n,m,sizeof(n))
#define rep(i,n) for(ll i = 0; i < n; i++)
#define ren(i,n) for(ll i = n-1; i >= 0; i--)
#define all(x) x.begin(),x.end()
#define fo(i, a, b) for(ll i = a; i <= b; i++)
#define ffo(i, a, b) for(ll i = a; i >= b; i--)
#define MAX 100005
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
void io_set() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

bool comp(const pair < ll, ll >&a, const pair < ll, ll >&b){
    return ((a.ss < b.ss) || (a.ss == b.ss && a.ff < b.ff));
}

signed main(){ 
    IOS
    //io_set();
    // ll tt;
    // w(tt){

    // }
    ll n, d;
    cin >> n >> d;
    ll a[n][d];
    rep(i, n){
        rep(j, d){
            cin >> a[i][j];
        }
    }
    ll c =0;
    rep(i, n){
        fo(j, i+1, n-1){
            double ans = 0;
            rep(k, d){
                ans += (abs(a[i][k] - a[j][k])*abs(a[i][k] - a[j][k]));
                // cout << i << " " << j << " "  << k << endl;
                // cout << ans << endl;
            }
            if(sqrt(ans) == floor(sqrt(ans))){
                c++;
            }
        }
    }
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int hp,n;
int main() {
	scanf("%d%d",&hp,&n);
	for(int i=1;i<=n;i++)
	{
		int a;
		scanf("%d",&a);
		hp-=a;
	}
	if(hp<=0)
	puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=Integer.valueOf(sc.next());
		int[] arr= new int[n];
		for(int i=0;i<n;i++){
			arr[i]=Integer.valueOf(sc.next());
		}
		sc.close();
		
		int count=0;
		boolean f=true;
		int j=0;
		while(f){
			f=false;
			for(int i=n-1;i>j;i--){
				int a=arr[i];
				int b=arr[i-1];
				if(a<b){
					arr[i]=b;
					arr[i-1]=a;
					count++;
					f=true;
				}
			}
			j++;
			
		}
		System.out.print(arr[0]);
		for(int i=1;i<n;i++){
			System.out.print(" "+arr[i]);
		}
		System.out.println();
		System.out.println(count);
	}

}

Measured memory_bytes: 26256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	lli A[3];

	for (int i = 0; i < 3; i++)
		cin >> A[i];

	sort(A,A+3);

	COUT(A[2] - A[0]);

	return 0;
}

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


signed main() {
  int N; cin >> N;
  vector<int> A(N);
  rep(i, N) cin >> A[i];
  
  unordered_map<int,int> B;
  rep(i, N) B[A[i]]++;
  
  if(B[1] > 0) {
    if(B[1] > 1) cout << 0 << endl;
    else cout << 1 << endl;
    return 0;
  }
  
  int ans = 0;
  rep(i, N) {
    if(B[A[i]] > 1) {
      ans++;
      continue;
    }
    rep_(j, 2, sqrt(A[i])+1) {
      if(A[i]%j == 0 && (B[j] > 0 || B[A[i]/j] > 0)) {
        ans++;
        break;
      }
    }
  }
  
  cout << N-ans << endl;
  
    
}


Measured memory_bytes: 33256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,S;
  cin >>K>>S;
 int count=0;
  for (int x = 0; x <= K; x++) {
      for (int y = 0; y <=K; y++) {
        int z = S - x- y;
        if(0 <= z && z<=K){
          count++;
        }
  }
}
 cout << count << endl;
}

Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

n=gets.to_i
x=get_i
x_sort=x.sort
medi1=x_sort[n/2-1]
medi2=x_sort[n/2]
n.times do|i|
  if x[i]<=medi1
    puts medi2
  else
    puts medi1
  end
end

Measured memory_bytes: 25316
#include <iostream>
#include <algorithm>
using namespace std;
typedef pair<int, int> P;
int main()
{
	int w, h, n;
	while (cin >> w >> h >> n && w)
	{
		int fx, fy; cin >> fx >> fy;
		P now = P(fx, fy);
		int ans = 0;
		for (int i = 1; i < n; i++)
		{
			int x, y; cin >> x >> y;
			int xsa = now.first - x, ysa = now.second - y;
			ans += xsa * ysa < 0 ? abs(xsa) + abs(ysa) : max(abs(xsa), abs(ysa));
			now = P(x, y);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = a ; i > b ; i--)
#define hahashad ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;
#define VL vector<ll> 
#define what(A) cout<<#A<<" is "<<A<<endl;
int main()
{
    ll n;
    cin>>n;
    ll k=1000,i=1000;
    while(k<n)
    {
        k+=i;
    }
    cout<<k-n;
}

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

int main(){
  int a[3];
  for(int i = 0; i < 3; i++) std::cin >> a[i];
  int max = 0;
  for(int i = 1; i < 3; i++) if(a[i] > a[max]) max = i;
  int sum = 0;
  for(int i = 0; i < 3; i++) sum += a[i];
  std::cout << sum - a[max];

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define clr(a) memset(a, 0, sizeof(a))
#define sz(x) x.size()
#define rep(n) for (ll i = 0; i < n; i++)
#define repc(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, x, y) for (int i = x; i < y; i++)
#define DEC(i, x, y) for (int i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define alla(a, n) a, a + n
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b)/gcd(a, b)
#define int long long int
#define ull unsigned long long

using namespace std;
const int MOD = 1e9 + 7;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    for(int i = 0;i<s.length();i++){
    	if((i+1) % 2 == 0){
    		if(s[i] == 'R'){
    			cout<<"No"<<endl;
    			return 0;
    		}
    	} else {
    		if(s[i] == 'L'){
    			cout<<"No"<<endl;
    			return 0;
    		}
    	}
    }
    cout<<"Yes"<<endl;
    return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll to;
	ll d;
};


///////////////////////////



int main() {

	ll N;
	cin >> N;

	vector<ll> a(N + 1);
	repn(i, N) cin >> a[i];

	ll abmax = -1;
	ll ind = 0;

	repn(i, N) {
		if (abs(a[i]) > abmax) { abmax = abs(a[i]); ind = i; }
	}

	cout << 2 * N - 2 <<endl;

	repn(i, N) {
		if (i == ind) { continue; }
		cout << ind << " " << i << endl;
	}

	if (a[ind] >= 0) {
		repn(i, N - 1) { cout << i << " " << i + 1 << endl; }
	}

	else {
		repn(i, N - 1) { cout << N -i+1 << " " << N - i << endl; }
	}

	system("PAUSE");

	

}


Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int N;
    cin >> N;
    int sum = 0;
    vector<int>A(N+2);
    A[0] = 0;
    A[N+1] = 0;
    for(int i = 1; i <= N; i++){
        cin >> A[i];
        sum += abs(A[i]-A[i-1]);
    }
    sum += abs(A[N]);
    for(int i = 1;i <= N; i++){
        cout << sum-(abs(A[i+1]-A[i])+abs(A[i]-A[i-1]))+abs(A[i+1]-A[i-1]) << endl;
    }
}
  


Measured memory_bytes: 2048
let n, ans, s = read_int (), ref 0, ref 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let _ = Array.(sort (-) a_s; iteri (fun i a -> s := !s + a; if i = n - 1 || a_s.(i + 1) <= 2 * !s then incr ans else ans := 0) a_s); Printf.printf "%d\n" !ans

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

int main(){
    int k; cin >> k;
    int a, b; cin >> a >> b;

    for(int i = a; i <= b; i++){
        if(i % k == 0){
            put("OK");
            return 0;
        }
    }
    put("NG");
}

Measured memory_bytes: 3552
fn getline() -> String{
  let mut __ret=String::new();
  std::io::stdin().read_line(&mut __ret).ok();
  return __ret;
}

fn main() {
  let line = getline();
  let temp:Vec<_> = line.trim().split(' ').collect();
  let x:i32 = temp[0].parse().unwrap();
  let a:i32 = temp[1].parse().unwrap();
  let b:i32 = temp[2].parse().unwrap();

  if (x - a).abs() < (x - b).abs() {
    println!("A");
  } else {
    println!("B");
  }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ff first
#define ss second
#define pb push_back
#define ios                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define fill(x, v) memset(x, v, sizeof(x))
const ll mod = 1000000007;
const double pi = 3.14159265359; // PI
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
/*
std::cout << std::setprecision(9) << f << '\n';//3.141590000;
map<char,int>::reverse_iterator rit;
for(rit = mp.rbegin(); rit!=mp.rend(); rit++)
*/
int power(int x, unsigned int y, int p)
{
    int res = 1;

    x = x % p;

    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
// string parser
vector<int> parse(string s)
{
    stringstream ss(s);
    int x;
    vector<int> v;
    while (ss >> x)
    {
        v.pb(x);
    }
    return v;
}
//-----------------------------

int main()
{
    ios;
    ll n, a, b;
    cin >> a >> b >> n;
    ll mul = min(b - 1, n);
    cout << (a * mul) / b << endl;

    return 0;
}


Measured memory_bytes: 3652
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()
	c := make([]int, N)
	s := make([]int, N)
	f := make([]int, N)
	for i := 0; i < N-1; i++ {
		c[i], s[i], f[i] = getInt(), getInt(), getInt()
	}

	for k := 0; k < N; k++ {
		start := s[k] + c[k]
		for i := k + 1; i < N-1; i++ {
			//out("arrive ", i, " at ", start)
			if s[i] >= start {
				start = s[i] + c[i]
			} else {
				x := ((start + f[i] - 1) / f[i]) * f[i]
				start = x + c[i]
			}
		}

		out(start)
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

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

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

int main(){
    int n;
    cin >> n;
    vector<ll> l(n);
    int cnt=0;
    for(int ix=0;ix<n;ix++) cin >> l.at(ix);
    for(int ix=0;ix<n;ix++){
        for(int ix2=ix+1;ix2<n;ix2++){
            for(int ix3=ix2+1;ix3<n;ix3++){
                bool flag=true;
                ll a=l.at(ix),b=l.at(ix2),c=l.at(ix3);
                if(a == b || b == c || c == a) flag = false;
                if(!(abs(b-c) < a && a < b+c)) flag = false;
                if(flag){
                    cnt++;
                   // cout << ix+1 << " " << ix2+1 << " " << ix3+1 << endl;;
                }
            }
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
int main(){
    int n,r;
    while(1){
        cin>>n>>r;
        if(n==0 && r==0)break;
        int a[50]={},b[50]={};
        for(int i=1;i<=n;i++){
            a[i]=n-i+1;
            b[i]=n-i+1;
        }
        int p,c;
        for(int i=1;i<=r;i++){
            cin>>p>>c;
            for(int j=1;j<=c;j++){
                b[j]=a[p+j-1];
            }
            for(int j=1;j<=p-1;j++){
                b[j+c]=a[j];
            }
            for(int j=1;j<=n;j++){
                a[j]=b[j];
            }
        }
        cout<<a[1]<<endl;
    }
    return 0;
}



Measured memory_bytes: 2972
import java.util.*;

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) % 2 == 0)
            System.out.println("Even");
        else
            System.out.println("Odd");
    }
}

Measured memory_bytes: 21204
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    n, x, t = inl()

    return t * ((n + x - 1) // x)


print(solve())


Measured memory_bytes: 9120
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define INF 1000000000000000
#define MOD 1000000007LL
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a : A) cin >> a;} // input vector


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

int H, N; cin>> H >> N;
VI A(N), B(N); rep(i, 0, N) cin >> A[i] >> B[i];

VI magic(H+1, 0);
i64 zero = 0;
rep(h, 1, H+1){
    magic[h] = magic[h-1] + B[0];
    rep(i, 0, N){
        magic[h] = min(magic[h], magic[max(zero, h - A[i])] + B[i]);
    }
}
cout << magic[H] << "\n";
}
// 書いて考える．場合分け．情報整理．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false)
#define ll long long
string s;
int main()
{
        IO;
        int i, j=0, n, m, k=1, l, r, t,x,y,mx; ll sum=1;
        cin>>s;
        if(s=="ABC")cout<<"ARC"<<endl;
        else cout<<"ABC"<<endl;

    return 0;
}


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

int main(int argc, char const *argv[])
{
	int a,b;
	cin>>a>>b;
	if (b%a==0)
	{
		cout<<a+b<<endl;
	}
	else
	{
		cout<<b-a<<endl;
	}
	return 0;
}


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

max_a = max(a)
min_a = min(a)
if max_a - min_a >= 2:
    print("No")
    exit()

if max_a == min_a:
    if max_a == n - 1:
        print("Yes")
    elif max_a <= n // 2:
        print("Yes")
    else:
        print("No")
    exit()

nokori = min_a + 1 - a.count(min_a)
if nokori <= 0:
    print("No")
elif a.count(max_a) // nokori <= 1:
    print("No")
else:
    print("Yes")


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

vector<int> v;
unordered_map<int, int> mp;

int main()
{
	register int n, cnt = 0;
	scanf("%d", &n);
	for (register int i = 1, x; i <= n; ++i) {
		scanf("%d", &x);
		if (mp[x] == 0) ++cnt, v.push_back(x);
		++mp[x];
	}
	sort(v.begin(), v.end());
	if (cnt == 1) {
		if (v[0] == 0) puts("Yes");
		else puts("No");
	} else if (cnt == 2) {
		if (mp[0] == 0)  puts("No");
		else if (2 * mp[v[0]] == mp[v[1]]) puts("Yes");
		else puts("No");
	} else if (cnt == 3) {
		if ((v[0] ^ v[1] ^ v[2]) != 0) puts("No");
		else if (mp[v[0]] != mp[v[1]] || mp[v[1]] != mp[v[2]]) puts("No");
		else puts("Yes");
	} else puts("No");
	return 0;
}

Measured memory_bytes: 3996
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
	int h, w;
    cin >> h >> w;
    for(int i=0;i<w+2;++i){
        cout << "#";
    }
    cout << endl;
    vector<vector<char>> a;
    for(int i = 0;i<h;++i){
        vector<char> ah;
        cout << "#";
        for(int j=0;j<w;++j){
            char ahw;
            cin >> ahw;
            cout << ahw;
        }
        cout << "#" << endl;
    }
    for(int i=0;i<w+2;++i){
    cout << "#";
    }
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#define INF 1000000007
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
signed main(){
    string s;
    cin>>s;
    int ans[114514]={};
    int c=0;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]=='R')c++;
        if(s[i]=='R'&&s[i+1]=='L'){
            ans[i]+=(c-1)/2+1;
            ans[i+1]+=c/2;
            c=0;
        }
    }
    c=0;
    for(int i=s.size()-1;i>0;i--){
        if(s[i]=='L')c++;
        if(s[i]=='L'&&s[i-1]=='R'){
            ans[i]+=(c-1)/2+1;
            ans[i-1]+=c/2;
            c=0;
        }
    }
    for(int i=0;i<s.size();i++)cout<<ans[i]<<" ";
    cout<<endl;
    return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner;

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

        int a=sc.nextInt();
        int b=sc.nextInt();
        
        ans=Math.abs(a-b);

        System.out.println(ans);
    }
}


Measured memory_bytes: 26324
K = int(input())
k = K
A,B = map(int, input().split())
for i in range(1, B+1):
    k *= i
    if k >= A and k <= B:
        print('OK')
        a = True
        break
    else:
        k = K
        a = False
        continue
if a != True:
    print('NG')

Measured memory_bytes: 9112
#include <stdio.h>

int main(void){
  int k, odd_cnt, even_cnt;
  scanf("%d", &k);
  even_cnt=k/2;
  odd_cnt=k/2;
  if(k%2==1)
    odd_cnt++;
  printf("%d\n", even_cnt*odd_cnt);
  return 0;
}


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

const double PI=3.14159265358979;

int a,b,x;
int s,v;
double d;
double angle;

int main(void)
{
	cin>>a>>b>>x;
	s=a*b;
	v=s*a;
	if (x<=v/2.0)
	{
		d=2.0*x/s;
		angle=90-180*atan(d/b)/PI;
	}
	else
	{
		d=2.0*(v-x)/(a*a);
		angle=90-180*atan(a/d)/PI;
	}
	printf("%.10lf",angle);
	return 0;
}

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

using namespace std;

struct StronglyConnectedComponents
{
  vector< vector< int > > gg, rg;
  vector< pair< int, int > > edges;
  vector< int > comp, order, used;

  StronglyConnectedComponents(size_t v) : gg(v), rg(v), comp(v, -1), used(v, 0) {}

  void add_edge(int x, int y)
  {
    gg[x].push_back(y);
    rg[y].push_back(x);
    edges.emplace_back(x, y);
  }

  int operator[](int k)
  {
    return (comp[k]);
  }

  void dfs(int idx)
  {
    if(used[idx]) return;
    used[idx] = true;
    for(int to : gg[idx]) dfs(to);
    order.push_back(idx);
  }

  void rdfs(int idx, int cnt)
  {
    if(comp[idx] != -1) return;
    comp[idx] = cnt;
    for(int to : rg[idx]) rdfs(to, cnt);
  }

  void build(vector< vector< int > > &t)
  {
    for(int i = 0; i < gg.size(); i++) dfs(i);
    reverse(begin(order), end(order));
    int ptr = 0;
    for(int i : order) if(comp[i] == -1) rdfs(i, ptr), ptr++;

    t.resize(ptr);
    set< pair< int, int > > connect;
    for(auto &e : edges) {
      int x = comp[e.first], y = comp[e.second];
      if(x == y) continue;
      if(connect.count({x, y})) continue;
      t[x].push_back(y);
      connect.emplace(x, y);
    }
  }
};


void solve()
{
  int V, E;
  cin >> V >> E;
  StronglyConnectedComponents scc(V);
  for(int i = 0; i < E; i++) {
    int s, t;
    cin >> s >> t;
    scc.add_edge(s, t);
  }
  vector< vector< int > > g;
  scc.build(g);
  cout << (int) (g.size() != V) << endl;
}

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

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

int n, ta = 0;

int main() {
	cin >> n;
	while (n) {
		if (n % 10 == 2) {
			ta++;
		}
		n /= 10;
	}
	cout << ta << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
const int N = 2 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
int main(){/*
    freopen("in","r",stdin);
    freopen("out","w",stdout);*/
    string a,b,c;
    cin >> a >> b >> c;
    if(a[sz(a) - 1] == b[0] && b[sz(b) - 1] == c[0])
        cout << "YES\n";
    else
        cout << "NO\n";
    return 0;
}   

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

const int hmax = 50;
int w, h;
void move(string area[], int i, int j){
	area[i][j] = '0';
	for(int k = -1; k <= 1; k++){
		for(int l = -1; l <= 1; l++){
			if(i+k < h && i+k >= 0 && j+l < w && j+l >= 0)
				if(area[i+k][j+l] == '1') move(area,i+k,j+l);
		}
	}
}

int main(){
	while(cin >> w >> h){
		string area[hmax];
		if(w == 0 && h == 0) break;
		for(int i = 0; i < h; i++){
			string s;
			for(int j = 0; j < w; j++){
				char c;
				cin >> c;
				s.push_back(c);
			}
			area[i] = s;
		}
		int count = 0;
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if(area[i][j] == '1'){
					count++;
					move(area,i,j);
				}
			}
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  if(a >= b) {
      for(int i = 0; i<a;i++){
      cout << b;
      }
  }
  else{
      for (int i = 0; i <b; i++)
      {
    cout << a;
      }
      cout << endl;
      
  }
}

Measured memory_bytes: 256
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

N=gets.to_i
A=get_i
s=A.inject(:+)-A[0]
a=A[0]
ans=(s-a).abs
1.upto(N-2) do|i|
    a+=A[i]
    s-=A[i]
    val=(s-a).abs
    ans=val if ans>val
end
puts ans

Measured memory_bytes: 16524
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int n,m;cin>>n>>m,n|m;){
		vector<pii> a(m);
		rep(i,m) a[i].second=-(i+1);
		rep(i,n) rep(j,m){
			int x; cin>>x;
			a[j].first+=x;
		}
		sort(allof(a),greater<pii>());
		rep(i,m)
			cout<<-a[i].second<<(i==a.size()-1?"\n":" ");
	}
	
	return 0;
}

Measured memory_bytes: 0
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr= input.trim().split("\n");
var x=arr[1].split(" ").map(Number);
var a=arr[3].split(" ").map(Number);
var box=[];
for(var i=0;i<=2020;i++)box[i]=0;
x.forEach(v=> box[v]=1);
box[2020]=1;
a.forEach(v=>{
   if(box[x[v-1]+1]==0){
      box[x[v-1]]=0;
      x[v-1]++;
      box[x[v-1]]=1;
   }
});
console.log(x.join("\n"));


Measured memory_bytes: 16300
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main(){
    ll a, b, x;
    cin >> a >> b >> x;
    ll ans;
    if(a == 0) ans = b/x + 1;
    else ans = b/x - (a-1)/x;
    cout << ans << endl;
}

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

int main(){
	char s;
	cin>>s;
	if('A'<=s&&s<='Z'){
		cout<<'A';
		return 0;
	}
	else{
		cout<<'a';
		return 0;
	}

	return 0;
}

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

int main() {
	int a, b;

	string ope;

	cin >> a >> b;

	ope = (a == b ? " == " : a > b ? " > " : " < ");

	cout << "a"<< ope << "b" << endl;
	
	return 0;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int x;
    cin>>x;
    int count = 0;

    vector<int> v(x);
    for(int i = 0; i< x; i++)
        cin>>v[i];

    for(int i = 1; i< x-1; i++)
    {
        if((v[i-1]<v[i] && v[i]<v[i+1]) || (v[i-1]>v[i] && v[i]>v[i+1]))
            count++;
    }

    cout<<count;
}


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

# AtCoder Beginner Contest
# Problem A

if __name__ == '__main__':
    A, B, C, D = list(map(int, input().split()))

    left_weight = A + B
    right_weight = C + D

    if left_weight > right_weight:
        print("Left")
    elif left_weight == right_weight:
        print("Balanced")
    else:
        print("Right")


Measured memory_bytes: 2940
answers=[]
while True:
    iquation=[]
    iquation=input().split()
    iquation[0]=int(iquation[0])
    iquation[2]=int(iquation[2])
    if iquation[1]=='+':
        answers.append(iquation[0]+iquation[2])
    elif iquation[1]=='-':
        answers.append(iquation[0]-iquation[2])
    elif iquation[1]=='*':
        answers.append(iquation[0]*iquation[2])
    elif iquation[1]=='/':
        answers.append(int(iquation[0]/iquation[2]))
    elif iquation[1]=='?':
        break
    else:
        print('error')
for i in range(0,len(answers)):
    print(answers[i])

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


int main()
{
	int n=0;
	char a[5] = { 0 };
	
	cin >> a;
	sort(rbegin(a),rend(a));
	
	if ((a[0] == a[1]) && (a[2] == a[3]) && (a[1] != a[2]))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


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

int main(){
    int N,K,Q;
    cin >> N >> K >> Q;
    vector<int> ans(N,K-Q);
    for(int i=0;i<Q;i++){
        int a;
        cin >> a;
        a--;
        ans[a]++;
    }
    for(int i=0;i<N;i++){
        if(ans[i]>0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int r=nxt(),g=nxt();
    cout<<2*g-r<<endl;
    
    return 0;   
}




 
 


Measured memory_bytes: 256
import java.util.*;
 
class Main{
    final static long mod = 1000000007;
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        sc.close();
        long ans = 0;
        long[] a = new long[k + 1];
        for(int i = k; i >= 1; i--){
            a[i] = modpow(k / i , n);
            for(int j = 2; j <= k / i; j++){
                a[i] = (a[i] - a[i * j] + mod) % mod;
            }
            ans = (ans + (a[i] * i)) % mod;
        }
        System.out.println(ans);
    }
    public static long modpow(long a, long n){
        long ans = 1;
        while(n > 0){
            if((n & 1) == 1){
                ans *= a;
            }
            n >>= 1;
            a *= a;
            a %= mod;
            ans %= mod;
        }
        return ans;
    }
}

Measured memory_bytes: 36408
/*
            _ _  ___            __ _ _  _       _     
 _   _  ___| | |/ _ \__      __/ _| | || |  ___| |__  
| | | |/ _ \ | | | | \ \ /\ / / |_| | || |_/ __| '_ \ 
| |_| |  __/ | | |_| |\ V  V /|  _| |__   _\__ \ | | |
 \__, |\___|_|_|\___/  \_/\_/ |_| |_|  |_| |___/_| |_|
 |___/                 

*/

#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define debug(x) cout<<#x<<": "<<x<<endl
#define For(i, st, en) for(ll i=st; i<en; i++)
#define rfor(i, st, en) for(ll i=st; i>=en; i--)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define printv(x) For(i, 0, x.size()){cout<<x[i]<<" ";} cout<<endl;
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define ll long long
#define int long long
#define F first
#define S second
#define pb push_back
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector< vector<int> > vvi;
typedef vector< pair<int, int> > vpi;
#define MAXN 300005
#define MOD 1000000007
#define INF 1000000000000000007


signed main(){
	fast
	int m, d;
	cin>>m>>d;
	int ans=0;
	For(i, 1, m+1){
		For(j, 1, d+1){
			int d1 = j%10;
			int d2 = (j/10)%10;
			if(d1<2 || d2<2){
				continue;
			}
			if(d1*d2==i){
				// cout<<d1<<" "<<d2<<" "<<i<<endl;
				ans++;
			}
		}
	}	
	cout<<ans<<endl;
    return 0;
}
    



Measured memory_bytes: 256
N, M = map(int, input().split())

A_image = [input() for i in range(N)]
B_image = [input() for i in range(M)]
Flag = False

for i in range(N):
    for j in range(N): # 画像Aをすべてループ
        if i + M <= N and j + M <= N:
            temp = []
            for k in range(M):
                temp.append(A_image[i+k][j : j+M])
            if temp == B_image:
                Flag = True

if Flag is True:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 3060