akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  
  string s;
  int k;
  cin>>s;
  cin>>k;
  int n;
  n = s.size();
  int temp;
  int templ;
  string t ="";
  REP(i,n){
    if(i==n-1){
      temp = k%26;
      templ = s[i]-'a';
      char lastc = 'a' + (temp+templ)%26;
      t += lastc;
      continue;
    }
    temp = s[i]-'a';
    if(k>=(26-temp)%26){
      k -= (26-temp)%26;
      t += "a";
    }else{
      t += s[i];
    }
  }
  cout<<t<<endl;
  return 0;
}


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

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

using namespace std;

//v.push_back(123);
//sort(v.begin(), v.end(),greater<int>());
//for(int x : v) {cout << x << endl;}

//for(int x: v) cout << x << endl;
//vector<vector<char>> v(H, vector<char>(W));
//vector<int> v(1000);

long long pow_mod(long long x, long long y, long long MOD){
	long long ret = 1;
	while(y){
		if (y & 1) ret = ret * x % MOD;
		x = x * x % MOD;
		y>>=1;
	}
	return ret;
}

signed main(){
  int N, X;
  cin>>N>>X;
  int zahyo=0;
  int L[N];
  int count=1;

  rep(i, N) cin >> L[i];

  rep(i, N){
    zahyo += L[i];
    if(zahyo<=X){
      count++;
    }
  }
  cout << count << endl;

  return 0;
}



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

int main() {
    string s;
    int n = 0;
    cin >> s;
    for(int i = 0; i < s.size(); ++i) {
        if(s[i] == 'x') n++;
    }
    if(n <= 7) {
    cout << "YES" << '\n';
    } else {
        cout << "NO" << '\n';
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define deb(x) cout << #x << " " << x << endl;
#define PI 3.14159265358979323846264338327950L
#define fi(i,a,b) for(int i = a; i<b; i++)
#define ll long long int
#define ld long double
#define pii pair<int, int>
#define F first
#define S second
#define vi vector<int>
#define N 1000000007
#define endl "\n"
#define pb push_back
#define mp make_pair
using namespace std;

//*************************************************************************************

void solve() {

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

int main() {

// #ifndef ONLINE_JUDGE
// 	freopen("input1.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif

	IOS;

	int t = 1;
	fi(i, 0, t) {solve();}
	return 0 ;
}


Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <random>
#include <fstream>

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

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

std::random_device rd;

std::mt19937 mt(rd());


struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<ll> _size; // 属する連結成分の大きさ

    UnionFind(ll N) : par(N), _size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) {
            par[i] = i;
            _size[i] = 1;
        }
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        if (mt() < 0.5) swap(rx, ry);
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        _size[ry] += _size[rx];
    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }

    ll size(ll x){
        ll rx = root(x);
        return _size[rx];
    }
};
int main() {
      //std::ifstream in("35.txt");
  //std::cin.rdbuf(in.rdbuf());

    ll N, M;
    cin >> N >> M;
    vector<vector<P>> e(N);
    UnionFind u = UnionFind(N);
    ll a, b, c;
    REP(i, M){
        cin >> a >> b >> c;
        a--;
        b--;
        e[a].push_back(P(b, c));
        e[b].push_back(P(a, -c));
        u.unite(b, a);
    }

    vector<ll> cnd;
    vector<ll> x(N);
    vector<bool> visited(N, false);
    REP(i, N) if(u.root(i) == i) {
        cnd.push_back(i);
        visited[i] = true;
    }
    REP(i, cnd.size()){
        queue<ll> next;
        next.push(cnd[i]);
        while(next.size() > 0){
            ll j = next.front();
            //cout << next.size() << endl;
            for(auto p : e[j]){
                if (!visited[p.first]){
                    x[p.first] = x[j] + p.second;
                    visited[p.first] = true;
                    next.push(p.first);
                }else{
                    if(x[p.first] != x[j] + p.second){
                        cout << "No" << endl;
                        return 0;
                    }
                }
            }
            next.pop();
        }

    }

    cout << "Yes" << endl;

    return 0;
}



Measured memory_bytes: 15616
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct list {
	int value;
	struct list *front;
	struct list *back;
};
struct list List[2000000]	= {};

int main(void)
{
	int max_order				= 0;
	char str[256]				= {};
	int i 						= 0;
	int j						= 0;
	struct list *First			= NULL;
	struct list *Last			= &List[0];
	struct list *tmp			= NULL;
	struct list *tmp1			= NULL;
	struct list *tmp2			= NULL;
	int num						= 0;
	int cmp						= 0;
	fgets( str, 256, stdin );
	max_order = atoi(&str[0]);
	
	//printf("%d\n", max_order);
	
	for ( j = 0; j < max_order; j++ ) {
		fgets( str, 256, stdin );
		for ( i = 0; str[i] != ' '; i++ ) {
		    if ( str[i] == '\r' || str[i] == '\n') {
		        break;
		    }
		}
		str[i] = '\0';
		//printf("%s\n", str);
		
		if ( strcmp( str, "insert" ) == 0 ) {
			List[num].value = atoi(&str[i+1]);
			List[num].back = First;
			List[num].front = NULL;
			if ( First != NULL ) {
			    First->front = &List[num];
			} else {
			    Last = &List[num];
			}
			First = &List[num];
			/*if ( First -> back != NULL && First -> back -> front != NULL) {
			printf("value:%d value_:%d value__:%d\n", First->value, 
			First -> back -> value, First -> back -> front -> value);
			}*/
			num++;
			//printf("%d\n", num);
		}
		
		if ( strcmp( str, "delete" ) == 0 ) {
			tmp = First;
			cmp = atoi(&str[i+1]);
			//printf("%d %d\n", cmp, tmp -> back -> value);
			
			while ( tmp != NULL ) {
				if ( tmp  -> value == cmp ) {
					tmp1 = tmp -> front;
					tmp2 = tmp -> back;
					if ( tmp1 != NULL ) {
    					tmp1 -> back = tmp -> back;
					} else {
					    First = tmp2;
					}
					if ( tmp2 != NULL ) {
    					tmp2 -> front = tmp -> front;
					} else {
					    Last = tmp1;
					}

					break;
				}
				tmp = tmp -> back;
			}
			
		}
		
		if ( strcmp( str, "deleteFirst" ) == 0 ) {
			tmp = First -> back;
			if ( tmp != NULL ) {
    			tmp -> front = NULL;
			} else {
			    Last = tmp;
			}
			First = tmp;
			//printf("%d\n", Last -> front);
			//printf("aa\n");
		}
		
		if ( strcmp( str, "deleteLast" ) == 0 ) {
			tmp = Last -> front;
			if ( tmp != NULL) {
    			tmp -> back = NULL;
    			//printf("aa\n");
			} else {
			    First = tmp;
			}
			Last = tmp;
		}
		
	}
	
	tmp = First;
	//printf("%d\n\n", tmp -> value);

    if ( tmp != Last ) {
    	while ( tmp != Last ) {
    	    printf("%d ", tmp->value);
    	    tmp = tmp -> back;
	   	}
   		
    } 
    printf("%d\n", Last->value);  
	
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 27440
N = int(input())

ans = 0
cnt = 0

for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        break
if cnt == 3:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9176
m,k=map(int,input().split())
if 2**m<=k:
    print(-1)
elif m==1:
    if k==0:
        print(0, 0, 1, 1)
    else:
        print(-1)
else:
    a=[i for i in range(2**m) if i!=k]
    ans=[k]+a+[k]+a[::-1]
    print(*ans)  

Measured memory_bytes: 16912
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

void solve(){
  string s;
  cin >> s;
  reverse(all(s));
  s+='0';
  ll n=s.size();
  vvll dp(n+1,vll(2,inf));
  dp[0][0]=0;
  
  rep(i,0,n){
   rep(j,0,2){ 
    ll x=s[i]-'0';
     x+=j;
     rep(a,0,10){
      if(a-x<0) chmin(dp[i+1][1],dp[i][j]+a+a-x+10); 
      else chmin(dp[i+1][0],dp[i][j]+a+a-x); 
     }
   }
  }
  
  cout << dp[n][0] << endl;
  

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

Measured memory_bytes: 55964
from heapq import heapify, heappush, heappop
class PriorityQueue():
    def __init__(self, queue=[]):
        self.queue = queue
        heapify(queue)
    def push(self, item):
        heappush(self.queue, item)
    def pop(self):
        return heappop(self.queue)
    def __str__(self):
        return self.queue
    def __len__(self):
        return len(self.queue)
    def __iter__(self):
        return iter(self.queue)
N, M = map(int, input().split())
def int_(num_str):
    return -int(num_str)


Alist = list(map(int_, input().split()))
pq = PriorityQueue(Alist)
for _ in range(M):
    max_val = pq.pop()
    pq.push(-1 * (-1*(max_val))/2)
ans = sum([int(-1 * item) for item in pq])
print(ans)

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
    cin >> a.at(i);
  sort(a.begin(),a.end());
  cout << a.at(N-1) - a.at(0) << endl;
}  

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>

int main(){

	double a,b,c,d,e,f;
	double x,y;
	
	while(std::cin>>a>>b>>c>>d>>e>>f){
		y = (f*a-c*d)/(e*a-b*d);
		x = (c-b*y)/a;
		printf("%.3lf %.3lf\n",x,y);
	}
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
inline long long getnum()
{
    long long now=0;long long fh=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')fh=-1;ch=getchar();}
    while(ch>='0' && ch<='9'){now=(now<<3)+(now<<1)+ch-'0';ch=getchar();}
    return now*fh;
}
int main()
{
  int x=getnum()*100;
  x+=getnum()*10;
  x+=getnum();
  if (x%4==0) printf("YES\n");else printf("NO\n");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

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

	vector<int> nums = {a, b, c};

	int mini = *min_element(nums.begin(), nums.end());
	int maxi = *max_element(nums.begin(), nums.end());
	int ans = 99999;

	for (int to = mini; to <= maxi + 1; to++) {
		int tmp = 0;
		for (auto x: nums) {
			int diff = abs(to - x);
			if (x < to) {
				tmp += diff / 2;
				if (diff % 2 == 1) {
					tmp += 2;
				}
			} else {
				tmp += diff;
			}
		}
		ans = min(ans, tmp);
	}

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


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

int N,M;
Graph(G);
int ans=0;

void input(){
  cin >> N >> M;
  G.resize(N,vector<int>(N));
  int a,b;
  for(int i=0;i<M;i++){
    cin >> a >> b;
    G[a-1][b-1]=G[b-1][a-1]=1;
  }
}


void solve(){
  vector<int> order(N);
  for(int i=0;i<N;i++){
    order[i]=i;
  }
  do {
    int temp=0;
    for(int i=1;i<N;i++){
      temp+=G[order[i-1]][order[i]];
    }
    if(temp==N-1){
      ans+=1;
    }
  } while (next_permutation(order.begin()+1,order.end()));
}

int main(){
  input();
  solve();
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int len=s.length();
    int len2=t.length();
    int cnt=0;
    for(int i=0;i<len;i++)
    {
        if(s[i]!=t[i]){
            cnt++;
        }
    }
    if(cnt>0)
    {
        cout<<"No\n";
    }
    else {
        cout<<"Yes\n";
    }
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
long long H[10000000];
int main()
{
    long long n,i;
    cin>>n;
    long long A[n];
    for(i=0;i<n-1;i++){
        cin>>A[i];
      H[A[i]]++;}
  for(i=1;i<=n;i++)
    cout<<H[i]<<endl;
    return 0;
}


Measured memory_bytes: 6744
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long
#define MAX 1000001
#define mod 1000000007
#define pie 3.14159265358979323846
void solve()
{
	int a,b;
	cin>>a>>b;
	if((a)<=(2*b))
	cout<<"0";
	else
	cout<<((a)-(2*b));
}
int main()
{ 
    cool;
    int t;
    //cin>>t;
    t=1;
    while(t--){
    	solve();
	}
    return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>

int main(void) {
	int x[3], i, j, temp;
	scanf("%d %d %d", &x[0], &x[1], &x[2]);
	for (i = 0;i < 2; i++) {
		for (j = 2;j > i; j--) {
			if (x[j - 1] > x[j]) {
				temp = x[j];
				x[j] = x[j - 1];
				x[j - 1] = temp;
			}
		}
	}
	printf("%d %d %d\n", x[0], x[1], x[2]);
	return 0;
}

Measured memory_bytes: 592
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const list = lines[1].split(" ").map(v=>v-1);
    let ans = 0;
    const map = [];
    list.forEach((v,i)=>{
        if(map[`${i}_${v}`]) ans++;
        map[`${v}_${i}`] = true;
    })
    console.log(ans);
});

min = (...a)=>{return a.reduce((a,b)=>a<b?a:b, a[0])};


Measured memory_bytes: 74696
#include <bits/stdc++.h>
#define rep(i, n) for (ll(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define print(x) cout << (x) << endl;

typedef long long ll;
const ll INF = 99999999999999;
const ll MOD = 1000000007;

using namespace std;

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

    cout << a * a << endl;

    return 0;
}

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

bool easy_dance(std::string dance)
{
	for (int i {}; i < dance.size(); i++)
	{
		if ((i + 1) % 2 == 1 && dance[i] == 'L')
			return false;
		else if ((i + 1) % 2 == 0 && dance[i] == 'R')
			return false;
	}
	return true;
}
	
int main()
{
	std::string dance {};
	std::cin >> dance;
	
	if (easy_dance(dance))
		std::cout << "Yes";
	else
		std::cout << "No";
}

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 305;







int n, m;
ll dp[maxn][maxn][maxn];

vector<pair<int,int>> a[maxn];



ll *mem(int a, int b, int c, int d) {
    vector<int> v={b,c,d};
    sort(v.begin(), v.end());

    b = v[0];
    c = v[1];

    return &dp[a][b][c];
}

ll go(int pos, int lr, int lg, int lb) {
    ll *res = mem(pos, lr, lg, lb);
    if (*res != -1) return *res;

    *res = 0;

    vector<int> v = {lr,lg,lb};
    sort(v.begin(), v.end());
    
    for (auto p: a[pos]) {
	if (p.first <= v[0]) {
	    if (p.second != 3) {
		return *res = 0;
	    }
	} else if (p.first <= v[1]) {
	    if (p.second != 2) {
		return *res = 0;
	    }
	} else if (p.first <= v[2]) {
	    if (p.second != 1) {
		return *res = 0;
	    }
	}
    }

    if (pos == n) {
	return *res = 1;
    }

    *res += go(pos+1, pos+1, lg, lb);
    *res %= mod;
    *res += go(pos+1, lr, pos+1, lb);
    *res %= mod;
    *res += go(pos+1, lr, lg, pos+1);
    *res %= mod;
    return *res;
}


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

    memset(dp,-1,sizeof(dp));
    cin>>n>>m;


    for (int i=1; i<=m; i++) {
	int l, r, x; cin>>l>>r>>x;
	a[r].push_back({l,x});
    }


    ll ans = go(0,0,0,0);
    ans %= mod;
    ans += mod;
    ans %= mod;
    out(ans);
  

    return 0;
}


Measured memory_bytes: 221952
#include<iostream>
#include<string.h>
using namespace std;

int main() {
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b&&a!=c){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(a==c&&a!=b){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(c==b&&a!=c){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#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;


typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

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

#define fi first
#define se second

typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const ll inf = ll(1e18);
const int MOD = (1e9 + 7);

ll n,t;
vpll v;

ll memo[3001][3001];

ll func(ll i,ll T){
	if(T>=t) return 0;
	if(i==n-1){
		if(T<t) return v[i].se;
		else return 0;
	}

	if(memo[i][T]!=-1)
		return memo[i][T];
	ll xx = func(i+1,T);
	if(T<t)
		xx = max(xx,func(i+1,T+v[i].fi)+v[i].se);
	return memo[i][T] = xx;

}

int main() {

	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
	#ifdef DEBUG_
		freopen("input.txt","r",stdin);
	#endif
	cout.setf(ios::fixed), cout.precision(20);
	cin >> n >> t;
	v.resize(n);
	for(int i=0;i<n;i++){
		cin >> v[i].first >> v[i].second;
	}
	for(int i=0;i<3001;i++){
		for(int j=0;j<3001;j++){
			memo[i][j]=-1;
		}
	}
	sort(v.begin(),v.end());
	cout<<func(0,0)<<"\n";
	return 0;
}



Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  string s[110],t[110];
  cin>>n;
  for(int i=0;i<n;i++) cin>>s[i];
  cin>>m;
  for(int i=0;i<m;i++) cin>>t[i];
  int max=0;
  for(int i=0;i<n;i++){
    int cnt=0;
    string x=s[i];
    for(int j=0;j<n;j++) if(x==s[j]) cnt++;

    for(int j=0;j<m;j++) if(x==t[j]) cnt--;
    if(max<cnt) max=cnt;
  }
  if(max!=0) cout<<max;
  else cout<<"0";
}


Measured memory_bytes: 256
import sys
from io import StringIO
import unittest
import os

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


# 実装を行う関数
def resolve(test_def_name=""):
    m = int(input())
    b_s = list(map(int, input().split()))

    divisors = [[0]] + [make_divisors(i) for i in range(1, m + 1)]
    ans = [0] + [0 for i in range(1, m + 1)]
    count = [0] + [0 for i in range(1, m + 1)]

    for num, b in reversed(list(enumerate(b_s, start=1))):
        if (b == 1 and count[num] % 2 == 0) or (b == 0 and count[num] % 2 != 0):
            ans[num] = 1
            for div in divisors[num]:
                count[div] += 1

    # 結果比較
    # if b_s != ans:
    #     print(-1)
    #     return
    ans = ans[1:]
    print(ans.count(1))

    if ans.count(1) == 0:
        return

    aaa = []
    for cnt, i in enumerate(ans, start=1):
        if i == 1:
            aaa.append(cnt)

    print(*aaa)

    # テストクラス


class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """3
1 0 0"""
        output = """1
1"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """5
0 0 0 0 0"""
        output = """0"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """5
1 0 0 0 1"""
        output = """1
5"""
        self.assertIO(test_input, output)

    def test_input_4(self):
        test_input = """5
0 0 0 0 1"""

        output = """2
1 5"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def tes_t_1original_1(self):
        test_input = """データ"""
        output = """データ"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()


Measured memory_bytes: 172592
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<string>
#include<time.h>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;

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

int main() {
    int n;
    cin >> n;
    vector<pair<ll, ll>> a;
    rep(i, n) {
        ll x, l;
        cin >> x >> l;
        a.push_back(pair<ll, ll>(x - l, x + l));
    }
    sort(a.begin(), a.end(), [](const pair<ll, ll>& a, const pair<ll, ll>& b) {return a.second < b.second; });
    ll cur = -1000000000;
    int ret = 0;
    rep(i, n) {
        if (a[i].first >= cur) {
            ++ret;
            cur = a[i].second;
        }
    }
    cout << ret << endl;
    return 0;
}

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

public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int R = Integer.valueOf(br.readLine());
        System.out.println(R * 2 * Math.PI);
    }
}

Measured memory_bytes: 33180
import java.util.*;

public class Main {
  static int count = 0;
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<>();
    for(int i = 0; i < 3; i++) {
      list.add(sc.nextInt());
    }
    sc.close();

    for(int i = list.get(0); i <= list.get(1); i++) {
      if(list.get(2) % i == 0) {
        count++;
      }
    }
    System.out.println(count);

  }
}


Measured memory_bytes: 26292
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
#include <random>
#include <iomanip>

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end())
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<long>())
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin()
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin()
#define bs(xs, x) binary_search(xs.begin(), xs.end(), x)

#define rep(i,n) for(auto i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};


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

  int n, k;
  cin >> n >> k;

  string s;
  cin >> s;
  
  int i=0;
  int groups = 0;
  while(true) {
    char now = s[i];
    while(i<s.length()&&s[i]==now)i++;
    groups++;
    if(i==s.length())break;
  }

  cout << s.length()-max(1, (groups-k*2)) << endl;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  string s;cin>>s;
  for(int i=0;i<s.size();i++){
    for(int j=i;j<s.size();j++){
      string t=s;
      t.erase(t.begin()+i,t.begin()+j);
      if(t=="keyence"){
        cout<<"YES"<<endl;
        return 0;
      }
    }
  }
  cout<<"NO"<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t,u;
    int a,b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    cout << (s == u?a-1:a) << " " << (t == u?b-1:b) << endl;
}

Measured memory_bytes: 256
N=int(input())
for i in range(N):
     a,b,c=map(int,input().split())
     if (a**2+b**2)==c**2 or (a**2+c**2)==b**2 or (c**2+b**2)==a**2:
          print('YES')
     else:
          print('NO')
   


Measured memory_bytes: 5592
MOD = 1000000007


def mult(a, b):
    c = [[0] * len(a) for _ in range(len(a))]
    for i in range(len(a)):
        for j in range(len(a)):
            for k in range(len(a)):
                c[i][j] += a[i][k] * b[k][j] % MOD
                c[i][j] %= MOD
    return c

def power(a, n):
    p = [[0] * len(a) for _ in range(len(a))]
    for i in range(len(a)):
        p[i][i] = 1

    while n:
        if n % 2:
            p = mult(p, a)
        a = mult(a, a)
        n /= 2
    return p

n, k = map(int, raw_input().split())
graph = []
for i in range(n):
    graph.append(map(int, raw_input().split()))
graph = power(graph, k)
resp = 0
for r in graph:
    resp += sum(r)
    resp %= MOD
print(resp)


Measured memory_bytes: 33256
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
typedef long long int ll;
int n;
ll ans, cur;
ll a[111111];
int main(void)
{
	cin>>n;
	int i;
	for(i=1 ; i<=n ; i++)
	{
		scanf("%lld",&a[i]);
		if(a[i]!=0)
		{
			cur+=a[i];
		}
		else
		{
			ans+=cur/2;
			cur=0;
		}
	}
	ans+=cur/2;
	cout<<ans;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int> P;

int main(){
	int d,n,m;
	int place[100010],k[10000];
	while(cin >> d , d){
		cin >> n; cin >> m;
		place[0] = 0;
		place[n] = d;
		for(int i=1;i<n;i++){
			cin >> place[i];
		}
		n++;
		sort(place,place+n);
		for(int i=0;i<m;i++){
			cin >> k[i];
		}
		int ans = 0;
		for(int i=0;i<m;i++){
			int check = k[i];
			int* pos1 = lower_bound(place,place+n+2,check);
			int* pos2 = pos1 - 1;
			ans += min(*pos1 - check,check - *pos2);
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 1604
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////


signed main(){
  int n,k;cin>>n>>k;
  int h[110000];rep(i,n)cin>>h[i];
  sort(h,h+n);
  int ans = INF;
  rep(i,n){
    if(i+k-1 >= n)break;
    chmin(ans, h[i+k-1]-h[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    int N = s.nextInt();
    Double Sum = 0.0;
    for (int i=0;i<N;i++){
      Sum += (1/s.nextDouble());
    }
    System.out.println(1/Sum);
    
    
  }
}

Measured memory_bytes: 24660
#include<iostream>
#include<vector>
using namespace std;
int n,k,a[1000];
long sum[1001];
vector<long>s;
main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)sum[i+1]=sum[i]+a[i];
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<=n;j++)s.push_back(sum[j]-sum[i]);
	}
	long ans=0;
	for(int i=50;i>=0;i--)
	{
		vector<long>tmp;
		for(int j=0;j<s.size();j++)
		{
			if(s[j]>>i&1)tmp.push_back(s[j]);
		}
		if(tmp.size()>=k)
		{
			s=tmp;
			ans|=1LL<<i;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 6512
import java.util.Scanner;

public class Main {
	static int l;
	
	static int count(String str) {
		int cnt = 0;
		for(int i=0;i<str.length();i++) {
			if(str.charAt(i)=='.')
				cnt++;
		}
		return cnt;
	}
	
	static int f(int[] a,char d,int k) {		//数字と演算子を送って計算
		
		int sum = 0;
		int n = 0;
		boolean isMul = false;
		if(d=='*') {
			sum = 1;
			isMul = true;
		}
		for(int aa:a) {
			if(isMul) sum *= aa;
			else sum += aa;
			n++;
			if(n==k)break;
		}

		return sum;
	}
	
	static int parse(int max,String[] str,int min) {
		
		char d = ' ';
		int k = 0;
		int[] put = new int[9];
		boolean change = false;
		String rs = "";
		
		if(max==min+1) {
			d = str[0].charAt(min-1);
			for(String s:str) {
				if(s.length()>=max) {	
					int cnt = count(s);			//数字だけ抜き出すため
					put[k] = Integer.parseInt(s.substring(cnt));
					k++;
				}
			}
			return f(put,d,k);
		}
		
		for(String s:str) {
			if(change && s.length()<=max-1) {
				String S ="";
				for(int i=0;i<max-2;i++) {
					if(i==0) 
						S = ".";
					else
						S += ".";
				}
						
				S += String.valueOf(f(put,d,k));
				k = 0;
				if(rs=="")
					rs = S;
				else
					rs = rs +":"+S;
				change = false;
			}
			if(s.length() >= max-1 && !Character.isDigit(s.charAt(max-2))) {
				change = true;
				if(s.length()==max-1 && !Character.isDigit(s.charAt(max-2))) {
					d = s.charAt(max-2);
				}
				if(s.length()>=max) {
					int cnt = count(s);
					put[k] = Integer.parseInt(s.substring(cnt));	
					k++;
				}
			}
			else {	
				if(rs=="")
					rs = s;
				else
					rs = rs+":"+s;
			}
		}
		if(change) {
			String S ="";
			for(int i=0;i<max-2;i++) {
				if(i==0) S = ".";
				else
					S += ".";
			}
				
			S += String.valueOf(f(put,d,k));
			if(rs=="")
				rs = S;
			else
				rs = rs +":"+S;
		}
		str = rs.split(":");
		return parse(max-1,str,min);
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int n = sc.nextInt();
			if(n==0)break;
			int l = 0;
			int ll = 999999999;
			String[] str = new String[n];
			for(int i=0;i<n;i++) {
				str[i] = sc.next();
				l = Math.max(l, str[i].length());	//最大の長さ
				ll = Math.min(ll, str[i].length());
			}
			if(n>1)
				System.out.println(parse(l,str,ll));
			else
				System.out.println(str[0]);
		}
	}
}


Measured memory_bytes: 36196
#include<stdio.h>
#include<stdlib.h>
#define N 101

int main(){
  int i,j,k,n,u[N],v,V[N][N];
  
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){ 
      V[i][j]=0;
    }
  }
  
  
  for(i=1;i<=n;i++){
    scanf("%d",&u[i]);
    scanf("%d",&k);
    if(k==0){
      continue;
    }
    else{
      for(j=0;j<k;j++){
	scanf("%d",&v);
	V[i][v]=1;
      }
    }
  }
  for(i=1;i<=n;i++){
    for(j=1;j<n;j++){ 
      printf("%d ",V[i][j]); 
    }
    printf("%d\n",V[i][n]);
  }

  return 0;

}

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

int N; 
char c;

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		scanf("%c", &c);
		
		if (c == 'Y') {
			printf("%s", "Four");
			return 0;
		}
	}
	printf("%s", "Three");
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
const int INF = 1001001001;

vector<int> to[100005];

void test_case(){
	int n,m; cin >> n >> m;
	for(int i = 0 ; i < m ; i++){
		int a ,  b;
		cin >> a >> b;
		a--;b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	queue<int> q;
	vector<int> dist(n,INF);
	vector<int> pre(n,-1);
	dist[0] = 0;
	q.push(0);
	while(!q.empty()){
		int v = q.front(); q.pop();
		for(int u : to[v]){
			if(dist[u] != INF)
				continue;
			dist[u] = dist[v]+1;
			pre[u] = v;
			q.push(u);
		}
	}
	cout<<"Yes\n";
	for(int i = 0 ; i < n ; i++){
		if(i==0)
			continue;
		int ans = pre[i];
		++ans;
		cout<<ans<<"\n";
	}
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 10592
#include <map>
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
    int n; cin >> n;
    map<int, int> m;
    for (int i = 0; i < n; i++) { int a; cin >> a; m[a]++; }
    int ans = 0;
    while (!m.empty()) {
        int a = m.rbegin()->first;
        int e = 0;
        while (a >= 1<<e) e++;
        int b = (1<<e) - a;
        if (a == b) {
            ans += m[a]/2;
            m.erase(a);
        } else if (m.find(b) != m.end()) {
            while (m[a] > 0 && m[b] > 0) { m[a]--; m[b]--; ans++; }
            if (m[a] == 0) m.erase(a);
            if (m[b] == 0) m.erase(b);
        } else
            m.erase(a);
    }
    cout << ans << endl;
}


Measured memory_bytes: 9600
import scala.io.Source

object Main extends App {
  val lines: Iterator[String] = Source.stdin.getLines()
  val line = lines.next.split(" ").map(_.toInt)
  val a = line.head
  val b = line(1)
  val c = line(2)
  val k = lines.next.toInt

  val max = List(a, b, c).max
  val rest = if (a == max) List(b, c) else if (b == max) List(a, c) else List(a, b)
  println((max * Math.pow(2, k) + rest.sum).toInt)
}


Measured memory_bytes: 25420
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<set>
#include<fstream>
#include<map>
#include<string>
#include <stdio.h>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<stack>
#include<climits>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll>vl;
typedef vector<int>vi;
typedef vector<bool>vb;
typedef vector<double>vd;
typedef vector<char>vc;
typedef vector<string>vs;
#define MP make_pair
#define all(v) v.begin(),v.end()
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
const int OO = (int)1e8;
const int dx[] = { 0, 1, -1, 0 };
const int dy[] = { 1, 0, 0, -1 };
ll gcd(ll a, ll b){ if (b == 0){ return a; }return gcd(b, a % b); }

//#pragma warning (disable : 4996)
void in_out_txt()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}
vs vec;
char arrc[4];
int arr[4];
void func()
{
	map < string, bool>mp;
	string st = "";
	int t;
	queue<pair<string, int>>q;
	q.push(MP("", 0));
	while (!q.empty())
	{
		st = q.front().first;
		t = q.front().second;
		q.pop();
		if (t == 3)
		{
			vec.push_back(st);
			continue;
		}
		st += '+';
		if (mp[st] == false)
			q.push(MP(st, t + 1)), mp[st] = true;
		st[st.size() - 1] = '-';
		if (mp[st] == false)
			q.push(MP(st, t + 1)), mp[st] = true;
	}
}
int main()
{
	IO;
	//in_out_txt();
	cin >> arrc[0] >> arrc[1] >> arrc[2] >> arrc[3];
	arr[0] = arrc[0] - '0';
	arr[1] = arrc[1] - '0';
	arr[2] = arrc[2] - '0';
	arr[3] = arrc[3] - '0';
	func();
	int k = 1;
	int sum;
	for (int i = 0; i < vec.size(); i++)
	{
		k = 1, sum = arr[0];
		for (int j = 0; j < 3; j++, k++)
		{
			if (vec[i][j] == '+')
				sum += arr[k];
			else
				sum -= arr[k];
		}
		if (sum == 7)
		{
			cout << arr[0] << vec[i][0] << arr[1] << vec[i][1] << arr[2] << vec[i][2] << arr[3] << "=7"<<endl;
			break;
		}
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static void main(String[] args) throws NumberFormatException, IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int w = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());
        int[] seq = new int[w];
        for(int i = 0; i < seq.length;i++){
            seq[i] = i+1;
        }
        for(int i = 0 ; i < n;i++){
            String[] s= br.readLine().split(",");
            int a=Integer.parseInt(s[0]);
            int b=Integer.parseInt(s[1]);
            int c = seq[a-1];
            seq[a-1] = seq[b-1];
            seq[b-1] = c;
        }
        for(int i = 0; i<seq.length;i++){
            System.out.println(seq[i]);
        }
    }
 
}

Measured memory_bytes: 24184
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m, k;
	cin >> n >> m >> k;

	int total = 0;

	vector<vector<char>> v(n, vector<char>(m));
	
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < m; j++) {
			cin >> v[i][j];
			if(v[i][j] == '#') total++;
		}
	}

	function<int(int, int)> process = [&](int row, int col) {
		int ret = total;

		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++) {
				if(v[i][j] == '.') continue;
				bool f = false, g = false;
				if(row >> i & 1) f = true;
				if(col >> j & 1) g = true;

				ret -= (f || g);
			}
		}
		return ret;
	};

	int ans = 0;

	for(int i = 0; i < (1<<n); i++) {
		for(int j = 0; j < (1<<m); j++) {
			if(process(i, j) == k) ans++;
		}
	}

	cout << ans;


	return 0;
}


Measured memory_bytes: 3656
N_GROUP,NUM_A,NUM_B,NUM_C,NUM_D,NUM_E = (0...6).map { gets.to_i }
MIN = [NUM_A,NUM_B,NUM_C,NUM_D,NUM_E].min
if MIN > N_GROUP
  puts 5
else
  time = N_GROUP / MIN
  time += 1 if N_GROUP % MIN != 0
  puts time+4
end


Measured memory_bytes: 1788
a = input().split()
for i in range(len(a)):
    a[i]=int(a[i])

x = input().split()
for i in range(len(x)):
    x[i]=int(x[i])

y = input().split()
for i in range(len(y)):
    y[i]=int(y[i])
    
X = [a[2]]
Y = [a[3]]
X_and_x = X + x
Y_and_y = Y + y

if min(Y_and_y)> max (X_and_x):
    print("No War")
else:
        print("War")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;
//clang++ -std=c++11 -stdlib=libc++ 
int grid[3][3];
int main() {
  int sum =0;
  rep(i,3)rep(j,3) {
    cin>>grid[i][j];
    sum+=grid[i][j];
  }
  rep (a1, 101) rep(a2,101) rep(a3, 101) {
    double b1,b2,b3;
    b1 = ((a1+a2+a3)*(-1)+grid[0][0]+grid[1][0]+grid[2][0])/(double)3;
    b2 = ((a1+a2+a3)*(-1)+grid[0][1]+grid[1][1]+grid[2][1])/(double)3;
    b3 = ((a1+a2+a3)*(-1)+grid[0][2]+grid[1][2]+grid[2][2])/(double)3;
    if (b1 == floor(b1) && b2 == floor(b2) && b3 == floor(b3)) {
      cout << "Yes" << endl; return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ITP1_2_A
{
    class Program
    {
        static void Main(string[] args)
        {
            //2つの整数a,bを読み込んで、aとbの大小関係を出力する

            string[] s = Console.ReadLine().Split();
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);

            if (a < b)
            {
                Console.WriteLine("a < b");
            }
            else if (a > b) 
            {
                Console.WriteLine("a > b");
            }
            else
            {
                Console.WriteLine("a == b");
            }

            Console.ReadKey();
        }
    }
}



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

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

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

    int div = n / 2;
    int cnt = 0, abc;
    sort(d.begin(), d.end());
    for (int i = d.at(div-1); i <= d.at(div); i++) cnt++;

    cout << cnt-1 << endl;

    return 0;
}


Measured memory_bytes: 3728
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int a,b,c,d,e,f,k,l,m,n,x,y,z;
	int ans;
	int[] chk;
	String[] S;

	Main(){
		// 整数の入力
		n = sc.nextInt();
		chk = new int[n];

		int before = sc.nextInt();
		for(int i=1;i<n;i++){
			int after = sc.nextInt();
			if(before==after-1){
				chk[before-1]=1;
			}
			before=after;
		}
		for(int i=0;i<n;i++)ans+=sc.nextInt();

		for(int i=0;i<n-1;i++){
			int num = sc.nextInt();
			if(chk[i]==1)ans+=num;
		}

		// 出力
		System.out.println(ans);
	}

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

Measured memory_bytes: 23764
import java.util.*;

public class Main{
	public static void main(String[] args){
		try(Scanner sc = new Scanner(System.in)){
			int N = sc.nextInt();
			int[] A = new int[N];
			for(int i = 0; i < N; i++){
				A[i] = sc.nextInt();
			}
			Arrays.sort(A);
			System.out.println(A[N-1] - A[0]);
		}
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    int n,m;
    cin >> n >> m;
    cout << (1900*m+100*(n-m)) * (1<<m) << endl;
    return 0;
}

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

int main(){
    ll n;
    cin >> n;
    vector<ll> a(1000000,0);
    for(ll l=3;l<=200;l++){
        for(ll i=1;i<=l/3;i++){
            for(ll j=i;j*2<=l-i;j++){
                ll k=l-i-j;
                ll res=i*i+j*j+k*k+i*j+j*k+k*i;
                ll count;
                if(i==j&&j==k) count=1;
                else if(i!=j&&j!=k&&k!=i) count=6;
                else count=3;
                a[res]+=count;
            }
        }
    }
    for(ll i=1;i<=n;i++) cout << a[i] << endl;
}


Measured memory_bytes: 10948
#include <bits/stdc++.h>
#define _itr ::iterator
#define forn(i, x, y) for (ll i = x; i < y; ++i)
#define ford(i, x, y) for (ll i = x; i > y; --i)
#define forne(i, x, y) for (ll i = x; i <= y; ++i)
#define forde(i, x, y) for (ll i = x; i >= y; --i)
#define rd(x) cin >> x; cin.ignore();
#define rdstr(x) getline(cin, x);
#define rdarr(x, y) for (ll i = 0; i < y; ++i) cin >> x[i];
#define rdmtr(x, y, z) for (ll i = 0; i < y; ++i) for (ll j = 0; j < z; ++j) cin >> x[i][j];
#define pb push_back

#define X first
#define Y second

#define MaxN 100007
#define MaxM 507
#define Mdl 1000000007

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;
typedef vector<ll> vi;
typedef ll arr[MaxN];

ll REPIT = 1;

const bool MQ = false;
ll n;
string st;

void Solve()
{
    getline(cin, st);
    ll res = 0, len = 0;
    for (char c : st)
    {
        if (c == 'R')
        {
            ++len;
            res = max(res, len);
        }
        else
        {
            len = 0;
        }
    }
    cout << res;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifdef OFFLINE
    freopen("INPUT.inp", "r", stdin);
    #endif
    if (MQ == true)
    {
        rd(REPIT);
    }
    while (REPIT--) Solve();
    cout.flush();
    #ifdef OFFLINE
    fclose(stdin);
    #endif
}


Measured memory_bytes: 3616