akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
using namespace std;
int main(void)
{
	char buf[101];
	int i,j,suu[100],x,len,sum;
	while(scanf("%s",buf)!=EOF)	{
		len=strlen(buf);
		for(i=0;i<len;i++)	{
			if(buf[i]=='I')	suu[i]=1;
			if(buf[i]=='V')	suu[i]=5;
			if(buf[i]=='X')	suu[i]=10;
			if(buf[i]=='L')	suu[i]=50;
			if(buf[i]=='C')	suu[i]=100;
			if(buf[i]=='D')	suu[i]=500;
			if(buf[i]=='M')	suu[i]=1000;
		}
		sum=0;
		for(i=0;i<len-1;i++)	{
			if(suu[i]<suu[i+1])	{
				sum-=suu[i];
			}
			else {
				sum+=suu[i];
			}
		}
		sum+=suu[len-1];
		printf("%d\n",sum);
	}
	return 0;
}


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

#define rep_(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) rep_(v, 0, n)
#define lep(v, n) rep_(v, 1, n + 1)
#define rrep_(v, f, l) for (int v = (l), v##_ = (f); v >= v##_; --v)
#define rrep(v, n) rrep_(v, 0, n - 1)
#define rlep(v, n) rrep_(v, 1, n)
#define show_a(a, size) rep(a##_it, size) std::cout << a[a##_it] << " \n"[a##_it == a##_it_ - 1];
#define show_v(v) show_a(v, v.size())
#define eachv(v, i) rep(i, v.size())
#define reachv(v, i) rrep(i, v.size())
#define debug(x) std::cerr << #x << " = " << x << "\n";

using namespace std;

typedef long long int lint;

struct Dice {
    int top;
    int side;
    int front;
    Dice(int top=1, int side=3, int front=2) : top(top), side(side), front(front) {}
    void set(int _top, int _side, int _front){
        top = _top;
        side = _side;
        front = _front;
    }
    void North(){set(front, side, 7 - top); }
    void East(){ set(7 - side, top, front); }
    void West(){ set(side, 7 - top, front); }
    void South(){set(7 - front, side, top); }
    void Right(){set(top, 7 - front, side); }
    void Left(){ set(top, front, 7 - side); }
    void cmd(const string& s){
        if (s == "North") North();
        if (s == "East") East();
        if (s == "West") West();
        if (s == "South") South();
        if (s == "Right") Right();
        if (s == "Left") Left();
    }
};

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }

int main()
{
    int n;
    while (n = in()){
        int score = 0;
        Dice dice;
        rep(i, n){
            string s;
            cin >> s;
            dice.cmd(s);
            score += dice.top;
        }
        printf("%d\n", score + 1);
    }
    return (0);
}

Measured memory_bytes: 1252
#include <iostream>
using namespace std;
typedef long long int LLI;
LLI pow(int x, int exp)
{
	LLI res = 1;
	for(int i = 0; i < exp; i++)
		res *= x;
	return res;
}
int main()
{
	LLI d, n;
	cin >> d >> n;
  	if( n < 100 )
		cout << pow(100,d)*n;
  	else cout << pow(100,d) * 101;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long
#define sz 100002
using namespace std;
ll int dp[101][sz+2],w[101],v[101];
int main()
{
   ll int i,j,n,wt;
    cin>>n>>wt;
    for(int i=1;i<=n;i++)cin>>w[i]>>v[i];
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=sz;j++)dp[i][j]=wt+5;
    }
    dp[0][0]=0;
    for(i=1;i<=n;i++)
    {
        for(j=0;j<=sz;j++)
        {
            int l=j-v[i];
            if(j==0)dp[i][j]=0;
            else if(l>=0)dp[i][j]=min(dp[i-1][j],dp[i-1][l]+w[i]);
            else
            {
                dp[i][j]=dp[i-1][j];
            }

        }
    }
    for(i=sz;i>=0;i--)
    {
        if(dp[n][i]<=wt){cout<<i<<endl;return 0;}
    }
    return 0;



}


Measured memory_bytes: 79232
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long [] in = new long [a];
        long [] in2 = new long [a];
        long b = 0;
        long c;
        int d,e;
        for(int i=0;i<a;i++){in[i] = sc.nextLong();
                             d = (int)in[i];
                             in2[d-1]++;
                            }
        for(int i=0;i<a;i++){b+=in2[i]*(in2[i]-1)/2;                                                 
                            }
        for(int i=0;i<a;i++){e = (int)in[i];
                             c = in2[e-1];
                             System.out.println(b-c+1);
                            }	
	}
}


Measured memory_bytes: 100620
#include <stdio.h>
#include <string.h>
int main(void)
{

	int a,b,c;
	char s1[100],s2[100],s3[100];

	scanf("%s%s%s",s1,s2,s3);

	a=strlen(s1);
	b=strlen(s2);
	c=strlen(s3);

	if((s1[a-1]==s2[0])&&(s2[b-1]==s3[0])) printf("YES\n");
	else printf("NO\n");
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=1e9;
const int mod=1e9+7;
const int maxn=5e5+10;
int n;
int a[22],b[22];
int gcd(int a,int b){
    return b==0?a:gcd(b,a%b);
}
int main(){
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
        cin>>b[i];
        ans+=max(a[i]-b[i],0);
    }
    cout<<ans<<endl;
    return 0;
}
//x+y-a*c1==a*c2;
//x+y=a*2-x;


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string>
#include <vector>

#define el endl
#define fd fixed
#define INF INT_MAX/2-1
#define pb push_back

using namespace std;

int main() {
  int n, tmp;
  string s, res, station = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  while (cin >> n, n) {
    int key[n];
    for (int i = 0; i < n; i++) {
      cin >> tmp;
      key[i] = tmp;
    }
    cin >> s;
    res = "";
    for (int i = 0; i < s.length(); i++) {
      res += station[(station.find(s[i])-key[i%n]+52)%52];
    }
    cout << res << el;
  }
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>

using namespace std;
int main(){
	while(1){
		int n; cin >> n;
		if (n == 0) break;
		string str;
		bool left = true; //1:??? -1:??°
		bool right = true; 
		int ans = 0;
		bool now = true;
		for (int i = 0; i < n ; i++){
			cin >> str;
			if (str == "lu"){
				left = false;
				if (!right and now){
					ans++;
					now = false;
				}
			}else if (str == "ld"){
				left = true;
				if (right and !now){
					ans++;
					now = true;
				}
			}else if (str == "ru"){
				right = false;
				if (!left and now){
					ans++;
					now = false;
				}
			}else if (str == "rd"){
				right = true;
				if (left and !now){
					ans++;
					now = true;
				}
			}

		}
		cout << ans << endl;
	}

return 0;
}

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

int main(){

  int ans,a,b,c,d,e,x;
  ans = 0;
  vector<int> v;
  cin >> a >> b >> c >> d >> e;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);
  v.push_back(d);
  v.push_back(e);

  for(int i=1;i<=10;i++){
    if(v[0]%10==i){
      v.erase(v.begin());
      v.push_back(a);
      break;
    }
    if(v[1]%10==i){
      v.erase(v.begin()+1);
      v.push_back(b);
      break;
    }
    if(v[2]%10==i){
      v.erase(v.begin()+2);
      v.push_back(c);
      break;
    }
    if(v[3]%10==i){
      v.erase(v.begin()+3);
      v.push_back(d);
      break;
    }
    if(v[4]%10==i){
      v.erase(v.begin()+4);
      v.push_back(e);
      break;
    }
  }

  x = (v[0]+9)/10;
  ans += 10*x;
  x = (v[1]+9)/10;
  ans += 10*x;
  x = (v[2]+9)/10;
  ans += 10*x;
  x = (v[3]+9)/10;
  ans += 10*x;
  ans += v[4];

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

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


int main() {
    int n,x,m;
    x=0;
    m=0;
    vector<int> v;
    scanf ("%d",&n);
    while(n){
      v.push_back(n);
      if(n>x){
        x=n;
      }
      scanf ("%d",&n);
      m++;
    }
    vector<int> res;
    vector<int> p(x+1,1);
    p[0]=0;
    p[1]=0;
    for (int t=2;t<=x;t++) {
      if (p[t]==0) continue;
      // p の倍数を全て消す。
      for (int k=t*2;k<=x;k+=t){
        p[k] = 0;
      }
      res.push_back(t);
    }
    int a=0;
    int s;
    for(int t=0;t<m;t++){
      a=0;
      s=res.size();
      for(int k=0;k<s;k++){
        if(v[t]-res[k]>=1){
          if(p[v[t]-res[k]]==1){
            a++;
          }
        }
      }
      a=a/2+a%2;
      printf("%d\n",a);
    }
}



Measured memory_bytes: 3204
import itertools
import math
n,d = map(int,input().split())
xl = []
for _ in range(n):
    x = list(map(int,input().split()))
    xl.append(x)

cnt = 0
for v in itertools.combinations(xl,2):
    x, y = v[0], v[1]
    sum = 0
    for i in range(d):
        sum += (x[i]-y[i])**2
    dist = math.sqrt(sum)
    if dist.is_integer():
        cnt += 1
print(cnt)

Measured memory_bytes: 9100
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int a; cin >> a;
    cout << 3 * a * a << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 4;
ll i;
char c;
string a;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    rep(i,0,4){
        cin>>c;
        a += c;
    }
    sort(all(a));
    cout<<(a == "1479" ? "YES" : "NO");
    return 0;
}

Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

fn main(){
    let stdin = io::stdin();
    let mut buf = String::new();

    loop {
        let _ = stdin.read_line(&mut buf);
        let vec : Vec<i64> = buf.split_whitespace().map( |x| i64::from_str(x).unwrap() ).collect();
        buf.clear();
        let (h, w) = (vec[0], vec[1]);

        if h == 0 && w == 0 {
            break;
        }

        for _ in 0..h {
            for _ in 0..w {
                print!("#");
            }
            println!();
        }
        println!();
    }
}



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

typedef long long ll;
 
int main(){
  ll n, s=0;
  cin >> n;
  ll a[n];
  for(int i=0; i<n; i++){
    cin >> a[i];
    s += a[i];
  }
  ll x=0, ans = 1000000000000000;
  for(int i=0; i<n-1; i++){
    x += a[i];
    ans = min(ans, abs(s-2*x));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e11;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    int n;
    double t,a,h[1005],k;
    cin >> n >> t >> a;
    rep(i,n){
        cin >> k;
        h[i] = t-k*0.006;
    }
    int ans;
    double place = 1e9;
    rep(i,n){
        if (h[i] >= a && h[i]-a < place){
            ans = i+1;
            place = h[i]-a;
        }
        if (h[i] < a && a-h[i] < place){
            ans = i+1;
            place = a-h[i];
        }
    }
    PRINT(ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    int n  = s.size();
    int m = t.size();
    int mini=1e9;
    int count=0;
    for(int i=0;i<n-m+1;i++){
        count=0;
        int tempi=i;
        for(int j=0;j<m;j++,tempi++){
            if(s[tempi]!=t[j])count++;
        }
        mini = min(mini,count);
    }
    cout<<mini;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll A, B;
  cin >> A >> B;

  if ((A + B) % 2 == 1)
    cout << "IMPOSSIBLE" << endl;
  else
    cout << (A + B) / 2 << endl;
}

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

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
	int n;
	int dp[4010];
	fill(dp, dp+4010, 0);
	for(int i=0; i <= 1000; i++)for(int j=0; j <= 1000; j++) dp[i+j]++;
	while(cin >> n){
		int ret = 0;
		for(int i=0; i <= n; i++) ret += dp[i] * dp[n-i];
		cout << ret << endl;
	}
}

Measured memory_bytes: 1176
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var sum = 0;
        for (var i = 1; i <= num; i++)
            if (sum+i < num) { sum += i; continue; }
            else { WriteLine(i); break; }

    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 13268
function Main(input) {
    input = input.split("\n");
    for (i=0; i < input.length; i=i+n+m+2) {
        tmp = input[i].split(" ")
        var n = parseInt(tmp[0])
        var m = parseInt(tmp[1])
        var A =[]
        for (j=i+1; j < n+1; j++) {
            tmpp = input[j].split(" ")
            var a = 0
            for (k=0; k < m; k++) {
                var b = parseInt(input[i+n+k+1])
                var e = parseInt(tmpp[k])
                a = a+b*e
            }
            A.push(a)
        }
        for (l=0; l < A.length; l++) {
            console.log(A[l])
        }
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 17472
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<int> A(N);
    for(int i=0;i<N;i++) cin >> A[i];
    int ans = 0;
    for(int i=1;i<N;i++) ans += (A[i]>A[i-1]);
    cout << ans << endl;
}


Measured memory_bytes: 3368
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        String[] array = {"3","5","7"};
        List<String> rs = new ArrayList<>();
        addNumsComination(rs, array, "", n.length());
        int cnt = 0;
        int ni = Integer.parseInt(n);
        for (String s : rs) {
            if (s.contains("3") && s.contains("5") && s.contains("7")) {
                if (ni >= Integer.parseInt(s))
                    cnt++;
            }
        }
        System.out.println(cnt);
    }

    static void addNumsComination(List<String> r, String[] nums, String s, int digit) {
        for (int i = 0; i < nums.length; i++) {
            if (digit > 1) {
                addNumsComination(r, nums, s + nums[i], digit - 1);
            }
            r.add(s + nums[i]);
        }
    }
}


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

int main()
{
    int N, A;
    std::cin >> N;

    int even_cnt = 0;
    int cnt = 0;
    for (int i = 0; i < N; i++)
    {
        std::cin >> A;
        if (A % 2 == 0)
        {
            even_cnt++;
            if (A % 3 == 0 | A % 5 == 0)
                cnt++;
        }
    }

    if (even_cnt == 0)
        std::cout << "APPROVED" << std::endl;
    else if (even_cnt > 0 && even_cnt == cnt)
        std::cout << "APPROVED" << std::endl;
    else
        std::cout << "DENIED" << std::endl;

    return 0;
}

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

using namespace std;
#define cerr cerr << "[DBG] "
#define DBG(x) cerr << #x << ": " << x << endl
// http://genkisugimoto.com/jp/blog/procon/2015/04/15/print-debug-technique-in-cpp.html
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}

template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) { for (int i = 0; i < v.size(); ++i) { s << v[i]; if (i < v.size() - 1) s << "\t"; } return s; }

typedef long long ll;

// UNDONE
int main(){
	int w,h;
	cin >> w >> h;
	vector<int> p(w);
	vector<int> p_sorted(w);
	ll sp = 0;
	for(int i=0; i<w; i++){
		cin >> p[i];
		p_sorted[i] = p[i];
		sp += p[i];
	}
	sort(p_sorted.begin(), p_sorted.end());
	vector<int> q(h);
	vector<int> q_sorted(h);
	for(int i=0; i<h; i++){
		cin >> q[i];
		q_sorted[i] = q[i];
	}
	sort(q_sorted.begin(), q_sorted.end());

	vector<ll> q_sum(h+1);
	q_sum[0] = 0;
	for(int i=0; i<h; i++){
		q_sum[i+1] = q_sum[i]+q_sorted[i];
	}

	ll result = sp+q_sum[h];
	for(int i=0; i<w; i++){
		int index = lower_bound(q_sorted.begin(), q_sorted.end(), p_sorted[i]) - q_sorted.begin();
		result += (ll)p_sorted[i]*(h-index);
		result += q_sum[index];
	}
	cout << result << endl;
	return 0;
}


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

int main() {
  string s;
  cin >> s;

  string a, b;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'x') continue;
    a += s[i];
    b += s[i];
  }

  reverse(b.begin(), b.end());

  if (a != b) {
    cout << -1 << endl;
    return 0;
  }

  int i = 0, j = s.size() - 1;
  int ans = 0;
  while (i < j) {
    if (s[i] == s[j]) {
      i++;
      j--;
      continue;
    }
    if (s[i] == 'x') {
      while (s[i] == 'x') {
        i++;
        ans++;
      }
    } else {
      while (s[j] == 'x') {
        j--;
        ans++;
      }
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod =1e9+7;
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res=res*a%mod;
        b>>=1;
        a=a*a%mod;
    }
    return res;
}
ll inv(ll x){
    return power(x,mod-2);
}
ll gcd(ll a,ll b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int main(){
    ll n,temp=1,i;
    cin>>n;
    for(i=2;i*i<=n;i++){
        if(n%i==0)temp=i;
    }
    cout<<temp+n/temp-2;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const double PI=acos(-1);
typedef pair<int,int>P;
const int mod =1e9+7;

struct mint
{
    ll x;
    //constructor
    mint(ll y=0):x((y%mod+mod)%mod){}

    
    mint operator-() const{return mint(-x);}

    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==0)return 1;
        mint a=pow(t/2);
        a*=a;
        if(t%2==1)a*=2;
        return a;
    }

    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;
    }

};

mint choose(int n, int a)
{
    mint x=1,y=1;
    if(a==1)
    {
        x=n;
        return x;
    }
    if(a==n)
    {
        return x;
    }
    rep(i,a)
    {
        x*=n-i;
        y*=i+1;
    }
    return x/y;
}

bool isPrime(int n)
{
    for(int i=2;i*i<=n;i++)
    {
        if(n%i==0)
        {
            return false;
        }
    }
    return true;
}

int main()
{

    int n;
    cin>>n;
    vector<int> primelist;
    for(int i=2;i<=1000;i++)
    {
        if(isPrime(i))
        {
            primelist.push_back(i);
        }
    }

    mint ans=1;
    map<int,int> gc;
    for(int i=2;i<=n;i++)
    {
        int x=i;
        for(auto v:primelist)
        {
            while(x%v==0)
            {
                gc[v]++;
                x/=v;
            }
        }
    }

    
    for(auto v:gc)
    {
        ans*=(1+v.second);
    }
    cout<<ans.x;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59
using ld = long double;

const int MAX = 510000;

ll dp[100010][4];

ll pow_mod(ll n, ll x)
{
    ll res = 1;
    while (n > 0)
    {
        if ((n & 1) == 1)
        {
            res *= x;
            res %= MOD;
        }
        x = x * x;
        x %= MOD;
        n >>= 1;
    }
    return res;
}
int alph[26];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //cout << fixed << setprecision(5);

    int N;
    cin >> N;
    string s;
    cin >> s;
    for (int i = 0; i < N; ++i)
    {
        alph[s[i] - 'a']++;
    }

    ll t = 1;
    for (int i = 0; i < 26; ++i)
    {
        t *= (alph[i]+1);
        t %= MOD;
    }

    cout << t - 1 << endl;

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl "\n"
#define all(v) v.begin(),v.end()
#define mp make_pair
#define mm(a) memset(a,0,sizeof(a))
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define repn(i,a,b) for(ll i = a; i >= b; i--)
#define pb push_back
#define ff first
#define ss second
#define in_edges(m) repp(i, 1, m){ ll a, b; cin >> a >> b; adj[a].pb(b), adj[b].pb(a);}
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define MOD 1000000007
//atoi() = char to int
// stoi() = int to char
//string g(1,"1"); char to string
//f[stoi(g)] = '0';
//cout.precision(14);
ll power(ll x,ll y);
int main()
{
	    // freopen("in.txt","r",stdin);
	    // freopen("out","w",stdout);
		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	    ll t;t=1;
	    // cin >> t;
	    while(t--)
	    {
         ll n; cin >> n;
          ll sum=0;
          rep(i,1,n+1)
          {
             if(i%3==0 || i%5 == 0)continue;
             sum+=i;
          }
            cout << sum <<endl;
            
        }    
}
// wooooowooooowwwoowwo

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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 = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll k; cin>>k;
  vll a(k);
  rep(i,k) cin>>a[i];
  reverse(all(a));
  
  ll l=2, r=2;
  rep(i,k){
    l=(l+a[i]-1)/a[i];
    r=r/a[i];
    if(l>r){
      cout<<-1<<endl;
      return 0;
    }
    l=l*a[i];
    r=r*a[i]+a[i]-1;
  }
  cout<<l<<" "<<r<<endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define fore(x,a,b) for(int x=a, qwerty=b; x<qwerty; x++)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define pb push_back
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fst first
#define snd second
#define mset(a,v) memset((a),(v),sizeof(a))
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
using namespace std;
typedef long long ll;
const int N=100500;
int k,n;
ll dp[100500],h[N];
ll f(int i){
	if(i==n-1)return 0;
	ll &r=dp[i];
	if(r!=-1)return r;
	r=1LL<<50;
	fore(j,1,k+1)if(i+j<n)r=min(r,f(i+j)+abs(h[i+j]-h[i]));
	return r;
}
int main(){FIN;
	cin>>n;
	k=2;
	cin>>k;
	fore(i,0,n)cin>>h[i];
	memset(dp,-1,sizeof dp);
	cout<<f(0)<<"\n";
}

Measured memory_bytes: 6528
#include <iostream>

int main() {
  int N, K;
  char S[11];
  
  std::cin >> N >> S >> K;

  const char C = S[K-1];

  for (char* p=S; *p!='\0'; ++p) {
    if (*p != C) *p = '*';
  }

  std::cout << S;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e3 + 10;

class Base {
public:
    virtual void f() {
        cout << "base" << endl;
    }
};
class Derive : public Base {
public:
    virtual void f() {
        cout << "derive" << endl;
    }
};
void solve() {
   int n;
   cin >> n;
   ll res = 1;
   ll x;
   for (int i = 0; i < n; i++) {
        cin >> x;
        res = res / __gcd(x, res) * x;
   }
   cout << res << endl;
}

int main() {
   // freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define LL long long
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
typedef pair<int,int>pii;
using namespace std;
int n,s[233333],S,ans,f[66666],inf,sum[20];
int dfs(int S){
	if(!S)return 0;
	if(f[S]<inf)return f[S];
	for(int i=0;i<16;i++)if((S>>i)&1)
		for(int j=0;j<16;j++)if(i!=j&&(S>>j)&1){
			int p=i^j,x=S^(1<<i)^(1<<j)^(1<<p);
			if(S>>p&1)f[S]=min(f[S],dfs(x)+2);
			else f[S]=min(f[S],dfs(x)+1);
		}
	return f[S];
}
int main(){
	cin>>n;
	for(int i=1,a,b,c;i<n;i++){
		cin>>a>>b>>c;
		s[a]^=c,s[b]^=c;
	}
	for(int i=0;i<n;i++)sum[s[i]]++;
	for(int i=1;i<16;i++){
		ans+=(sum[i]>>1);
		S+=(1<<i)*(sum[i]&1);
	}
	memset(f,127,sizeof f);
	inf=f[0];
	ans+=dfs(S);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())

from collections import Counter
c = Counter(A)
cc = list(c.values())
ans = 0
for i in range(len(cc)):
    if cc[i] % 2 == 1:
        ans += 1

print(ans)

Measured memory_bytes: 20816
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(true){
            int x=sc.nextInt(),y=sc.nextInt();

            if(x == 0&&y==0) break;
            System.out.println(x>y?y+" "+x:x+" "+y);
        }
    }
}



Measured memory_bytes: 35528
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let mut n: usize = iter.next().unwrap().parse().unwrap();
    let k: usize = iter.next().unwrap().parse().unwrap();

    let mut ans = 0;

    while n > 0 {
        ans += 1;
        n /= k;
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

function main()
	n,k = readline() |> split |> parseMap
	a = readline() |> split |> parseMap
	l = zeros(Int,n)
	r = zeros(Int,n)
	for i in 1:n
		l[i]=max(1,i-a[i])
		r[i]=min(n,i+a[i])
	end
	for i in 1:k
		b = zeros(Int,n)
		for j in 1:n
			b[l[j]]+=1
			if r[j]<n
				b[r[j]+1]-=1
			end
		end
		for j in 2:n
			b[j]+=b[j-1]
		end
		a = copy(b)
		if sum(b)==n*n
			break
		end
		for j in 1:n
			l[j]=max(1,j-a[j])
			r[j]=min(n,j+a[j])
		end
	end
	for i in 1:n-1
		print(a[i]," ")
	end
	println(a[n])
end

main()

Measured memory_bytes: 259288
#include<stdio.h>
#include<string.h>
int main()
{
  char str[100];
  gets(str);
  int l=strlen(str);
  int count =0;
  int yes=0;
  for(int i=0;i<l/2;i++) // 0 1 2 3 4 5 6
  {
      if(str[i]!=str[l-1-i])
      {
          count++;
      }
  }
  if(count==0)
  {
      yes++;
  }
  count =0;
  for(int i=0;i<l/2;i++)
  {
      if(str[i]!=str[(l-3)/2-i])
      {
          count++;
      }
  }
  if(count==0)
  {
      yes++;
  }
  count =0;
   for(int i=(l+1/2);i<l;i++)
  {
      if(str[i]!=str[l-1-i])
      {
          count++;
      }
  }
  if(count==0)
  {
      yes++;
  }
  if(yes==3)
  {
      printf("Yes");

  }
  else printf("No");
}


Measured memory_bytes: 1640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
    ll n;   cin >> n;
    vector<ll> ans(n+1, 0);
    FOR(i, 1, n+1){
        for(ll j=1; j*i<=n; j++){
            ans[j*i] += 1;
        }
    }
    ll res=0;
    REP(i, n+1) res += i*ans[i];
    cout << res << endl;
}


Measured memory_bytes: 81372
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
int tmp[100000];
void pakuri_sort(int N, int A[]) {
	const int b = 8;
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N = getint();
	rep(i, N) tmp[i] = getint();

	ll tarinai = 0;
	int k = 0;
	int amari[100000];
	int kotae = 0;

	rep(i, N) {
		int B = getint();
		if (tmp[i] > B) amari[k++] = tmp[i] - B;
		else if (tmp[i] < B) {
			tarinai += B - tmp[i];
			kotae++;
		}
	}
	pakuri_sort(k, amari);
	for (int i = k - 1; i >= 0; i--) {
		if (tarinai > 0) {
			tarinai -= amari[i];
			kotae++;
		}
	}
	if (tarinai > 0) printf("-1");
	else printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 896
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        String S = scan.next();
        String answer = S;
        Deque<Character> stack = new ArrayDeque<>();
        
        for(int i = 0; i < S.length(); i++) {
            if(S.charAt(i) == ')') {
                if(stack.isEmpty() || stack.peek() != '(') {
                    answer = '(' + answer;
                } else {
                    stack.poll();
                }
            } else {
                stack.offerFirst(S.charAt(i));
            }
        }
        
        while(!stack.isEmpty()) {
            stack.poll();
            answer += ')';
        }
        
        System.out.println(answer);
    }
}


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

int main() {
    long long x, y, spaces;
    cin >> x >> y;
    spaces = x*y;
    if(x == 1 || y == 1){
    	cout << 1 << endl;
    }else if(spaces%2 == 1){
    	cout << x*y/2+1 << endl;
    }else{
    	cout << x*y/2 << endl;
    }
} 

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

constexpr ll p = 1000000007;

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

    return 0;
}

Measured memory_bytes: 256
n, m, k = gets.split.map(&:to_i)
a = (0..1).map { gets.split.map(&:to_i) }.transpose
f = -> is {
    b = is.map {|i| a[i]}.sort_by!(&:first)
    has = m
    to_get = 0
    until b.empty? || has == 0
        if has >= b[-1][1]
            to_get += b[-1].reduce(:*)
            has -= b[-1][1]
        else
            to_get += has * b[-1][0]
            has = 0
        end
        b.pop
    end
    has + to_get
}
p (0..n-1).to_a.combination(k).map {|is| f[is]}.max



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

int main() {
  int n;
  int b, f, r, v;
  int A[5][4][11] = {0};

  cin >> n;
  for (int i=0; i < n; ++i) {
    cin >> b >> f >> r >> v;
    A[b][f][r] += v;
  }

  for (int i = 1; i < 5; ++i) {
    for (int j = 1; j < 4; ++j) {
      for (int k = 1; k < 11; ++k) {
        cout << " " << A[i][j][k];
      }
      cout << endl;
    }
    if (i != 4) {
      for (int l = 0; l < 20; ++l ) {
        cout << "#";
      }
      cout << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
typedef long long LL;
const LL mod=1000000007;
#define MAX 10000
#define NIL -1
const double PI  = acos(-1.0);
const int INF = 1e9 + 7;
//-------------------------------------------


string b;
string ans;

int main(){
    cin >> b;

    if(b == "A") cout << "T";
    else if( b == "T") cout << "A";
    else if( b == "C") cout << "G";
    else if( b == "G") cout << "C";

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int a[4];
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    sort(a,a+4);
    //cout << a[0]*1000+a[1]*100+a[2]*10+a[3] << endl;
    if(a[0]*1000+a[1]*100+a[2]*10+a[3]==1479){
        
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100

main(){
  int n;
  scanf("%d", &n);

  int i, array[n+1][n+1], u, v, j, e;
  for(i = 1; i < n+1; i++){
    for(j = 1; j < n+1; j++){
      array[i][j] = 0;
    }
  }

  for(i = 1; i < n+1; i++){
    scanf("%d%d", &u, &e);
    for(j = 1; j < e+1; j++){
      scanf("%d", &v);
      array[i][v] = 1;
    }
  }
  for(i = 1; i < n+1; i++){
    for(j = 1; j < n+1; j++){
      if(j > 1) printf(" ");
      printf("%d", array[i][j]);
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=0;i<=(int)n;i++)
int main(void){
    // Your code here!
    ll n,m;cin>>n>>m;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    //reverse(a.begin(),a.end());
    vector<ll> b(n+1,0);b[n-1]=a[n-1];
    rep1(i,n-1)b[n-i-1]=b[n-i]+a[n-1-i];
    ll sum=0,left=0,right=a[n-1]*2+1,ans=0;
    while(right-left>1){
        ll mid=(right+left)/2;
        sum=0;
        rep(i,n){
            ll buf=mid-a[i];
            auto it=lower_bound(a.begin(),a.end(),buf);
            ll k=it-a.begin();
            //cout<<n-k<<endl;
            sum+=n-k;
        }
        if(sum<=m)right=mid;
        else if(sum>m)left=mid;
    }
    //cout<<right<<endl;
    rep(i,n){
        ll buf=right-a[i];
        auto it=lower_bound(a.begin(),a.end(),buf);
        ll k=it-a.begin();
        ans+=(n-k)*a[i]+b[k];
        m-=n-k;
    }
    ans+=m*left;
    if(n*n==m){
        ans=(n+1)*b[0];
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

const double PI = 3.14159265358979323846;

void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;

typedef pair<double, double> P;


const double cos13pi = cos(1.0 / 3 * PI);
const double sin13pi = sin(1.0 / 3 * PI);

P next(P a, P b) {
    P b2(b.first - a.first, b.second - a.second); // aを原点に移したときのbの位置
    P c(b2.first * cos13pi - b2.second * sin13pi,
        b2.first * sin13pi + b2.second * cos13pi);
    P n(c.first + a.first, c.second + a.second);
    return n;
}

vector<P> split(P a, P b) {
    P p(a.first + (b.first - a.first) / 3, a.second + (b.second - a.second) / 3);
    P q(a.first + (b.first - a.first) * 2 / 3, a.second + (b.second - a.second) * 2 / 3);
    vector<P> ans;
    ans.push_back(p);
    ans.push_back(q);
    return ans;
}

vector<P> koch(P a, P b) {
    vector<P> pr = split(a, b);
    P n = next(pr[0], pr[1]);

    vector<P> ans;
    ans.push_back(pr[0]);
    ans.push_back(n);
    ans.push_back(pr[1]);
    return ans;

}

int main() {
    int n;
    cin >> n;
    vector<P> now;
    now.push_back(P(0, 0));
    now.push_back(P(100, 0));
    for (int i = 0; i < n; i++) {
        vector<P> ne;

        for (int j = 0; j < now.size() - 1; j++) {

            P a = now[j], b = now[j + 1];
            vector<P> pr = split(a, b);
            P n = next(pr[0], pr[1]);
            ne.push_back(a);
            ne.push_back(pr[0]);
            ne.push_back(n);
            ne.push_back(pr[1]);

        }
        ne.push_back(now.back());
        now = ne;
    }

    for (int i = 0; i < now.size(); i++) {
        printf("%.20f %.20f\n", now[i].first, now[i].second);

    }


}



Measured memory_bytes: 3288
while 1:
    k=input().split()
    H=int(k[0])
    W=int(k[1])
    if H==0 and W==0:
        break
    for i in range(H):
        msg=""
        for j in range(W):
            if (i+j)%2 ==0:
                msg +="#"
            else:
                msg +="."
        print(msg)
    print("")



Measured memory_bytes: 5608